code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import unittest
import uuid
from mock import patch, Mock
import omnijson as json
import requests
from brockman.client import FocusLabClient
from brockman.exceptions import (BadAPIKey, BadRequest, ResourceNotFound,
ServerError, UnknownError)
class ClientTests(unittest.TestCase):
def get_client(self, **kwarg... | FocusLab/brockman | tests/client.py | Python | bsd-3-clause | 7,040 |
from bitboard import *
from ldata import *
from pychess.Utils.const import *
#
# Caveat: Many functions in this module has very similar code. If you fix a
# bug, or write a perforance enchace, please update all functions. Apologies
# for the inconvenience
#
def isAttacked (board, cord, color):
""" To determine if... | jskurka/PyChess-Learning-Module | lib/pychess/Utils/lutils/attack.py | Python | gpl-3.0 | 10,373 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_v2_generated_environments_delete_environment_async.py | Python | apache-2.0 | 1,441 |
# -*- coding: utf-8 -*-
from robot.libraries import BuiltIn
from keywordgroup import KeywordGroup
BUILTIN = BuiltIn.BuiltIn()
class _RunOnFailureKeywords(KeywordGroup):
def __init__(self):
self._run_on_failure_keyword = None
self._running_on_failure_routine = False
# Public
... | michaelmendoza42/robotframework-appiumlibrary | src/AppiumLibrary/keywords/_runonfailure.py | Python | apache-2.0 | 2,924 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed ... | SCSSoftware/BlenderTools | addon/io_scs_tools/exp/pim/piece.py | Python | gpl-2.0 | 9,608 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
#
# This file is part of Medusa.
#
# Medusa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | FireBladeNooT/Medusa_1_6 | medusa/metadata/__init__.py | Python | gpl-3.0 | 1,680 |
from b import C
class D(C):
def <warning descr="'b.C.method' is marked as '@final' and should not be overridden">method</warning>(self):
pass | siosio/intellij-community | python/testData/inspections/PyFinalInspection/OverridingFinalMethod/a.py | Python | apache-2.0 | 153 |
from django.db import models
import simplejson
from time import localtime, strftime
from datetime import datetime, timedelta
import re
from django_thermostat.utils import gen_comparing_time
from django_thermometer.temperature import read_temperatures
#from django_thermostat.mappings import get_mappings
from django.db.m... | jpardobl/django-thermostat | django_thermostat/models.py | Python | bsd-3-clause | 8,988 |
#***
#*********************************************************************
#*************************************************************************
#***
#*** GizmoDaemon Config Script
#*** Powermate ButtonTimeout config
#***
#*****************************************
#**************************************... | jtriley/gizmod | scripts/modules.d/200-Powermate-ButtonTimeout.py | Python | apache-2.0 | 4,462 |
from p1_support import load_level, show_level
from math import sqrt
from heapq import heappush, heappop
import operator
VERBOSE = False
def debug(*args):
if (VERBOSE):
print ''.join([str(arg) for arg in args])
def dijkstras_shortest_path(src, dst, graph, adj):
dist = {}
prev = {}
dist[src] = 0
prev[src] = Non... | jtsommers/dijkd | p1.py | Python | gpl-2.0 | 3,077 |
#-------------------------------------------------------------------------------
# Name: base_converter
# Purpose: Provides Basic MARC21 RDA converter for use in other classes
#
# Author: Jeremy Nelson
#
# Created: 2014/09/15
# Copyright: (c) Jeremy Nelson, Colorado College 2014
# Licence: MIT... | Tutt-Library/rda-enhancement | rda_enhancement/base_converter.py | Python | mit | 2,599 |
"""
TODO
Would be nice to load the entire config at once rather
than each time per method
"""
import json
import os.path
class UserData():
LOCATION = os.path.join('assets', 'game-data' ,'saved-games' + os.sep)
FILENAME = 'game-data.json'
FULL_PATH = LOCATION + FILENAME
def __init__(self):
self... | joereynolds/Mr-Figs | src/user_data.py | Python | gpl-3.0 | 5,064 |
import unittest
from sql import Sql
class SqlTest(unittest.TestCase):
def test_create_word_table_sql_correct(self):
self.assertEqual(Sql().create_word_table_sql(3), 'CREATE TABLE IF NOT EXISTS word (word1, word2, word3, count)')
def test_create_param_table_sql_correct(self):
self.assertEqu... | codebox/markov-text | test/sql_test.py | Python | mit | 1,618 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | huiyiqun/check_mk | web/htdocs/valuespec.py | Python | gpl-2.0 | 177,705 |
#!/usr/bin/python3
import os
from gi.repository import Gtk, Gdk
import pageutils
class ModulePage(pageutils.BaseListView):
def __init__(self, parent):
store = Gtk.ListStore(str, str, str, str, str, str, str, bool, str)
pageutils.BaseListView.__init__(self, store)
self.parent = parent
... | Fantu/Cinnamon | files/usr/share/cinnamon/cinnamon-looking-glass/page_extensions.py | Python | gpl-2.0 | 3,877 |
# -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# Lic... | CERNDocumentServer/invenio | modules/webmessage/lib/webmessage_mailutils.py | Python | gpl-2.0 | 9,479 |
# -*- coding: utf-8 -*-
"""
Global tables and re-usable fields
"""
# =============================================================================
# Import S3 meta fields into global namespace
#
exec("from applications.%s.modules.s3.s3fields import *" % request.application)
# Faster for Production (where app-name... | flavour/porto | models/00_tables.py | Python | mit | 25,033 |
import numpy as np
import pytest
from pandas.core.dtypes.cast import construct_1d_arraylike_from_scalar
from pandas.core.dtypes.dtypes import CategoricalDtype
from pandas import (
Categorical,
Timedelta,
Timestamp,
)
import pandas._testing as tm
def test_cast_1d_array_like_from_scalar_categorical():
... | rs2/pandas | pandas/tests/dtypes/cast/test_construct_from_scalar.py | Python | bsd-3-clause | 1,786 |
#!/usr/bin/env python
import os
import SocketServer
import threading
import random
import time
from Crypto.Cipher.AES import AESCipher
key = 'XXXXXXXXXXXXXXXX' # obviously, this is not the real key.
secret_data = 'This is not the real secret data'
class threadedserver(SocketServer.ThreadingMixIn, SocketServer.TCPSer... | Oksisane/PicoCTF-2014-Write-ups | cryptography/server.py | Python | gpl-3.0 | 1,639 |
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
import xgboost as xgb
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Dropout
from keras.layers.advanced_activations import PReLU
from keras.models import Sequential
from keras.utils import np... | korbonits/kaggle-tau-to-three-muons | ensemble_model.py | Python | mit | 5,133 |
# -*- coding: utf-8 -*-
"""Script to compact all Brython scripts in a single one."""
import datetime
import os
import re
import sys
import tarfile
import zipfile
import javascript_minifier
if(sys.version_info[0]!=3):
raise ValueError("This script only works with Python 3")
# path of parent directory
pdir = o... | harukaeru/Brython-Django | static/brython/scripts/make_dist.py | Python | mit | 4,186 |
"""
Example 6
Just another example
9/1/2016
"""
###Variables
x = "There are %d types of people." % 10
binary = "binary"
do_not = "don't"
y = "Those who know %s and those who %s." % (binary, do_not)
###Main
print x
print y
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
print joke_evaluation % ... | chrisortman/CIS-121 | k0765042/lpthy/ex6.py | Python | mit | 411 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Newspipe - A web news aggregator.
# Copyright (C) 2010-2021 Cédric Bonhomme - https://www.cedricbonhomme.org
#
# For more information: https://sr.ht/~cedric/newspipe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | JARR-aggregator/JARR | newspipe/lib/misc_utils.py | Python | agpl-3.0 | 5,626 |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
# def deleteDuplicates(self, head):
# """
# :type head: ListNode
# :rtype: ListNode
# """
# if head is None:
... | qiyuangong/leetcode | python/083_Remove_Duplicates_from_Sorted_List.py | Python | mit | 1,004 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
import coverage # pylint: disable=import-error
coverage.process_startup()
# pylint: disable=bare-except
except: # nopep8
pass
| JosuaKrause/quick_server | test/cov.py | Python | mit | 191 |
#
# From https://github.com/rguthrie3/BiLSTM-CRF/blob/master/model.py
#
import dynet
import numpy as np
class CRF():
def __init__(self, model, id_to_tag):
self.id_to_tag = id_to_tag
self.tag_to_id = {tag: id for id, tag in id_to_tag.items()}
self.n_tags = len(self.id_to_tag)
sel... | onurgu/ner-tagger-tensorflow | crf.py | Python | mit | 5,119 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17-8-31 下午1:29
# @Author : Tom.Lee
# @File : config_parser.py
# @Product : PyCharm
# @Docs :
# @Source :
from oslo_config import cfg
from oslo_config import types
class ConfigManager(object):
PortType =... | amlyj/pythonStudy | OpenStack/oslo_/config/config_parser.py | Python | mit | 2,480 |
"""
==========================================
Outlier detection with several methods.
==========================================
When the amount of contamination is known, this example illustrates three
different ways of performing :ref:`outlier_detection`:
- based on a robust estimator of covariance, which is assum... | herilalaina/scikit-learn | examples/covariance/plot_outlier_detection.py | Python | bsd-3-clause | 5,242 |
#!/usr/bin/python3
import argparse
import sys
from usersync import config, lp, sync
PROVIDERS = {
'lp': lp,
}
def _configured_users(args, cfg):
provider = PROVIDERS[args.provider]
users = {}
for team in cfg.get('team', []):
users.update(provider.get_people(team))
for user in cfg.get('us... | doanac/user-sync | usersync/main.py | Python | gpl-3.0 | 1,786 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | djkonro/client-python | kubernetes/client/models/runtime_raw_extension.py | Python | apache-2.0 | 3,127 |
# -*- coding: utf-8 -*-
from setuptools import find_packages
from setuptools import setup
import os
version = '1.3.1'
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
long_description = (
read('README.txt')
+ '\n' +
read('js', 'jquery_maskedinput', 'test_jque... | tonthon/js.jquery_maskedinput | setup.py | Python | bsd-3-clause | 1,111 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
JSON to Fdt dumper
See JSONDeviceTree.md for format
@author: Neil 'superna' Armstrong <superna9999@gmail.com>
"""
import argparse
from pyfdt.pyfdt import FdtJsonParse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Device Tree Blob JSON ... | superna9999/pyfdt | jsonfdtdump.py | Python | apache-2.0 | 1,186 |
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | tombstone/models | research/object_detection/meta_architectures/context_rcnn_lib.py | Python | apache-2.0 | 8,672 |
import signal
import time
import wiringpi as wp
from rasp.allgo_utils import PCA9685
from rasp.allgo_utils import ultrasonic as uls
LOW = 0
HIGH = 1
OUTPUT = wp.OUTPUT
INPUT = wp.INPUT
CAR_DIR_FW = 0
CAR_DIR_BK = 1
CAR_DIR_LF = 2
CAR_DIR_RF = 3
CAR_DIR_ST = 4
DIR_DISTANCE_ALERT = 20
preMillis = 0
... | IsmoilovMuhriddin/allgo | rasp/diagnosis.py | Python | mit | 3,928 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | guillaume-philippon/aquilon | lib/aquilon/worker/commands/update_cluster_systemlist.py | Python | apache-2.0 | 1,990 |
from flask import Flask
from flask import request
from subprocess import call
import git, json, os, sys
newname = "gitlistener"
from ctypes import cdll, byref, create_string_buffer
libc = cdll.LoadLibrary('libc.so.6') #Loading a 3rd party library C
buff = create_string_buffer(len(newname)+1) #Note: One larger ... | WilliamMarti/gitlistener | gitlistener.py | Python | mit | 1,001 |
# -*- coding: utf-8 -*-
"""Coregistration between different coordinate frames."""
# Authors: Christian Brodbeck <christianbrodbeck@nyu.edu>
#
# License: BSD-3-Clause
import configparser
import fnmatch
from glob import glob, iglob
import os
import os.path as op
import stat
import sys
import re
import shutil
from funct... | bloyl/mne-python | mne/coreg.py | Python | bsd-3-clause | 74,115 |
# -*- coding: utf-8 -*-
"""test_replay."""
import os
import pytest
from cookiecutter import replay, main, exceptions
def test_get_replay_file_name():
"""Make sure that replay.get_file_name generates a valid json file path."""
exp_replay_file_name = os.path.join('foo', 'bar.json')
assert replay.get_file... | luzfcb/cookiecutter | tests/replay/test_replay.py | Python | bsd-3-clause | 2,207 |
from PyQt5 import QtGui, QtCore, QtWidgets
from idaapi import PluginForm
from DIE.Lib import BpHandler
import DIE.UI.Die_Icons
class BreakpointView(PluginForm):
"""
DIE Value View
"""
def __init__(self):
super(BreakpointView, self).__init__()
self.bp_handler = None
... | ynvb/DIE | DIE/UI/BPView.py | Python | mit | 3,987 |
import win32net
import win32netcon
shinfo={}
shinfo['netname']='python test'
shinfo['type']=win32netcon.STYPE_DISKTREE
shinfo['remark']='data files'
shinfo['permissions']=0
shinfo['max_uses']=-1
shinfo['current_uses']=0
shinfo['path']='c:\\my_data'
shinfo['passwd']=''
server='servername'
win32net.NetShareAdd(server,... | ActiveState/code | recipes/Python/303341_creating_share_windows/recipe-303341.py | Python | mit | 330 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Libhugin documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 30 15:21:12 2013.
#
# This file is execfile()d with the current directory set to its containing dir
#
# Note that not all possible configuration values are present in this
# auto... | qitta/libhugin | docs/conf.py | Python | gpl-3.0 | 11,701 |
import functools
import logging
import os
from lintreview.tools import Tool
from lintreview.tools import run_command
from lintreview.utils import in_path
from lintreview.utils import npm_exists
log = logging.getLogger(__name__)
class Sasslint(Tool):
name = 'sasslint'
def check_dependencies(self):
... | zoidbergwill/lint-review | lintreview/tools/sasslint.py | Python | mit | 1,616 |
import smtplib
# Sample code for sending email
# Make sure to check 'email' documentation to construct messages!
def prompt(prompt):
return raw_input(prompt).strip()
fromaddr = prompt("From: ")
toaddrs = prompt("To: ").split()
print "Enter message, end with ^D (Unix) or ^Z (Windows):"
# Add the From: and To: ... | aarestad/gradschool-stuff | xml-class/hw3/src/smtp.py | Python | gpl-2.0 | 714 |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
"""
Publish and subscribe to MQTT messages.
Additional information at http://mqtt.org and
http://ibmstreams.github.io/streamsx.messaging
"""
from future.builtins import *
from streamsx.topology.topology import *
from streamsx.topology ... | wmarshall484/streamsx.topology | com.ibm.streamsx.topology/opt/python/packages/streamsx/topology/mqtt.py | Python | apache-2.0 | 7,558 |
# -*- coding: utf-8 -*-
"""Page model for Cloud Intel / Reports / Reports"""
from cached_property import cached_property
from navmazing import NavigateToAttribute, NavigateToSibling
from cfme.utils.wait import wait_for
from cfme.utils.pretty import Pretty
from cfme.utils.update import Updateable
from cfme.utils.timeuti... | okolisny/integration_tests | cfme/intelligence/reports/reports.py | Python | gpl-2.0 | 22,519 |
#! /usr/bin/env python3
# Script for comparing the md5sum of a posix file with the md5sums of a multi chunk swift object
#
# swhashcomp dirkpetersen / Feb 2015
#
import swiftclient, sys, os, argparse, functools, hashlib, json
class KeyboardInterruptError(Exception): pass
def main():
c=create_sw_conn()
md5... | trel/swift-commander | bin/swhashcomp.py | Python | apache-2.0 | 5,839 |
import os
import sys
import numpy as np
import re
from astropy.table import Table
from astropy.io import fits
## Import some helper functions, you can see their definitions by uncomenting the bash shell command
from desispec.io.util import parse_cameras, difference_camwords, validate_badamps
from desispec.workflow.exp... | desihub/desispec | py/desispec/scripts/exposuretable.py | Python | bsd-3-clause | 8,118 |
import inspect
import logging
import os
from unittest.mock import Mock
import pytest
from ert_shared.plugins import workflow_config
@pytest.mark.parametrize(
"workflows, expected",
[
([], {}),
([("a", "/a/path")], {"a": "/a/path"}),
(
[("a", "/a/path"), ("b", "/another/pa... | joakim-hove/ert | tests/ert_tests/all/plugins/test_workflow_config.py | Python | gpl-3.0 | 2,978 |
import unittest
from test import test_support
class LongExpText(unittest.TestCase):
def test_longexp(self):
REPS = 65580
l = eval("[" + "2," * REPS + "]")
self.assertEqual(len(l), REPS)
def test_main():
test_support.run_unittest(LongExpText)
if __name__=="__main__":
t... | ktan2020/legacy-automation | win/Lib/test/test_longexp.py | Python | mit | 332 |
# -*- coding: utf-8 -*-
import numpy as np
import numpy.random as np_random
print("## square-root of an array:")
arr = np.arange(10)
print(np.sqrt(arr))
print("## Compare array:")
x = np_random.randn(8)
y = np_random.randn(8)
print(x)
print(y)
print(np.maximum(x, y))
print()
print("## Get fractional and integral pa... | lamontu/data-analysis | numpy/universal_functions.py | Python | gpl-3.0 | 386 |
"""
Django settings for SMes project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Buil... | Byx69/SMes | SMes/settings.py | Python | gpl-2.0 | 3,270 |
import warnings
import numpy as np
from numpy.testing import assert_allclose
import pytest
from scipy.fft._fftlog import fht, ifht, fhtoffset
from scipy.special import poch
def test_fht_agrees_with_fftlog():
# check that fht numerically agrees with the output from Fortran FFTLog,
# the results were generated... | ilayn/scipy | scipy/fft/tests/test_fftlog.py | Python | bsd-3-clause | 5,819 |
# Copyright (c) 2016 Dmitry Dolzhenko
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, dis... | ddolzhenko/jacis | jacis/packages.py | Python | mit | 7,250 |
from traceback import print_exc
from django.core.management.base import BaseCommand
from cthulhubot.models import Buildmaster
class Command(BaseCommand):
help = 'Restart all Buildmaster processes'
args = ""
def handle(self, *fixture_labels, **options):
verbosity = int(options.get('verbosity', 1))... | centrumholdings/cthulhubot | cthulhubot/management/commands/restart_masters.py | Python | bsd-3-clause | 918 |
from corrobo import _meta
__version__ = _meta.version
__version_info__ = _meta.version_info
| johnwlockwood/corrobo | corrobo/__init__.py | Python | apache-2.0 | 94 |
# #
# Copyright 2013-2018 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... | bartoldeman/easybuild-framework | easybuild/framework/easyconfig/parser.py | Python | gpl-2.0 | 9,527 |
emojis = defaultdict(list)
for r in csv.reader(open('./emoji.tsv'), delimiter='\t'):
emojis[r[1]].append(r[0])
def emoji_syn(word):
if word in emojis:
return emojis[word]
else:
return []
def unicode_len(word):
word = cgi.unescape(word)
return len(unicodedata.normalize('NFC', word)... | adamobeng/chirp | util.py | Python | mit | 1,272 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import validate_email_add
from frappe.model.document import Document
from email.utils import ... | indautgrp/frappe | frappe/email/doctype/email_group/email_group.py | Python | mit | 3,434 |
import pandas as pd
import numpy as np
import scipy.stats as stats
from sklearn import preprocessing
def main():
dat=pd.read_table('data/train_v2.csv',sep=',')
print "reading done, train"
loss=np.asarray(dat.loss)
dat=dat.drop(['loss','id'],1)
dat['new1']=dat['f528']-dat['f527'] #golden feature 1
... | wallinm1/kaggle-loan-default | read.py | Python | mit | 1,565 |
"""Tests for functions provided by tools.py"""
from contextlib import contextmanager
import time
import tools
import models
from google.appengine.ext import ndb
from google.appengine.ext import testbed
@contextmanager
def ndb_context():
tb_obj = testbed.Testbed()
tb_obj.activate()
tb_obj.init_datastore_v... | PFCM/slack-ml | data/test_tools.py | Python | mit | 974 |
import os
def computador_escolhe_jogada(n,m):
print('computador_escolhe_jogada\n')
jogada_computador = 1
while(jogada_computador < m):
variavel_temp = (n % (m + 1))
multiplos = checa_multiplos(n,m)
#if(jogada_computador == (n % (m + 1) == 0)):
if (multiplos):
pri... | RodFernandes/Python_USP_Curso_Ciencias_da_Computacao_1 | jogo_nim_c.py | Python | apache-2.0 | 3,464 |
''' dfsr_query.py '''
from collections import defaultdict
import uuid
from wmi_client import WmiClient, ArgumentError
import dfsr_settings
def safe_guid(function):
''' A decorator to validate guids. '''
def _function(*args, **kwargs):
''' The internal function for the decorator '''
... | tgross/gilamon | gilamon/dfsr_query.py | Python | bsd-3-clause | 6,331 |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2010 Task Coach developers <developers@taskcoach.org>
Task Coach is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
... | wdmchaft/taskcoach | tests/unittests/guiTests/PrinterTest.py | Python | gpl-3.0 | 5,279 |
# -*- coding: iso-8859-1 -*-
# Natural Language Toolkit: York-Toronto-Helsinki Parsed Corpus of Old English Prose (YCOE)
#
# Copyright (C) 2001-2008 University of Pennsylvania
# Author: Selina Dennis <selina@tranzfusion.net>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
"""
Corpus reader for ... | hectormartinez/rougexstem | taln2016/icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk/corpus/reader/ycoe.py | Python | apache-2.0 | 11,296 |
# This test module covers support in various parts of the standard library
# for working with modules located inside zipfiles
# The tests are centralised in this fashion to make it easy to drop them
# if a platform doesn't support zipimport
import test.support
import os
import os.path
import sys
import textwrap
import ... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.3.0/Lib/test/test_zipimport_support.py | Python | mit | 9,949 |
from magetool.libraries.globalclass import GlobalClass
class Helper(GlobalClass):
"""Class which represents Mage helpers, i.e., PHP classes which go in
a module's Helper/ directory.
"""
@staticmethod
def help():
print """Usage: magetool [OPTION]... (create|register) helper [NAME]
Options:... | jhckragh/magetool | magetool/commands/helper.py | Python | bsd-2-clause | 1,341 |
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^rosetta/', include('rosetta.urls')),
url(r'^grappe... | ilstreltsov/django-db-mailer | demo/demo/urls.py | Python | gpl-2.0 | 702 |
# List all ant build.xml files in the sandbox that should be called by the
# build system.
import os
import sandbox
import ioutil
import sys
if __name__ == '__main__':
if 'True' in sys.argv:
quick = True
else:
quick = False
x = []
try:
sb = sandbox.current
deps = [l.nam... | perfectsearch/sandman | code/buildscripts/list_ant_builds.py | Python | mit | 792 |
from Child import Child
from Node import Node # noqa: I201
AVAILABILITY_NODES = [
# availability-spec-list -> availability-entry availability-spec-list?
Node('AvailabilitySpecList', kind='SyntaxCollection',
element='AvailabilityArgument'),
# Wrapper for all the different entries that may occur ... | huonw/swift | utils/gyb_syntax_support/AvailabilityNodes.py | Python | apache-2.0 | 4,794 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='MaintenanceAlert',
fields=[
('id', models.AutoF... | qedsoftware/commcare-hq | corehq/apps/hqwebapp/migrations/0001_initial.py | Python | bsd-3-clause | 755 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2015 CERN.
#
# INSPIRE is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | Dziolas/inspire-next | inspire/modules/predicter/arxiv.py | Python | gpl-2.0 | 5,673 |
import slippytiles
import xml.etree.cElementTree as ET
import os, uuid
if __name__ == "__main__":
fina = "mod.osm"
xml = ET.parse(fina)
root = xml.getroot()
#Check which tiles contain the nodes
for obj in root:
if obj.tag != "node":
continue
print float(obj.attrib['lat']), float(obj.attrib['lat'])
| TimSC/gitgis | Upload.py | Python | bsd-2-clause | 320 |
# Scrapy settings for familynames project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'FontBakery'
SPIDER_MODULES = ['familynames.spiders']
NEWSPIDER_MODULE =... | googlefonts/namecheck | bakery/crawl/familynames/familynames/settings.py | Python | apache-2.0 | 523 |
import pyuaf
import unittest
from pyuaf.util.unittesting import parseArgs
ARGS = parseArgs()
def suite(args=None):
if args is not None:
global ARGS
ARGS = args
return unittest.TestLoader().loadTestsFromTestCase(NodeIdIdentifierTest)
class NodeIdIdentifierTest(unittest.TestCase):
... | robi-wan/uaf | unittests/pyuaftests/util/nodeididentifier.py | Python | lgpl-3.0 | 2,359 |
#
# sabayon.py: Sabayon and Kogaion Linux Anaconda install method backend
#
#
# Copyright (C) 2010 Fabio Erculiani
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the Licen... | Rogentos/rogentos-anaconda | sabayon/__init__.py | Python | gpl-2.0 | 4,742 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your op... | ofer43211/unisubs | apps/externalsites/syncing/kaltura.py | Python | agpl-3.0 | 4,831 |
# -*- coding: utf-8 -*-
"""
A collection of methods that can search for good parameters for the neural network
"""
__author__ = 'Sindre Nistad'
from Classifier.neural_network import ClassificationNet
from RegionOfInterest.regions_of_interest import RegionsOfInterest
folder = '../ASCII roi/'
normalized = 'normalizing/... | cLupus/neighborhood_classifier | src/Classifier/finding_parameters.py | Python | gpl-3.0 | 2,619 |
#!/usr/bin/env python
import sys
if sys.argv.__len__() < 4:
print "Usage : Enter time needed for each portion of the code"
print " % overhead <walltime> <advance> <exchange> <regrid>"
sys.exit();
if (sys.argv.__len__() == 4):
a = float(sys.argv[1])
e = float(sys.argv[2])
r = float(sys.argv... | ForestClaw/forestclaw | scripts/overhead.py | Python | bsd-2-clause | 1,293 |
import re
import urllib
from repoze.bfg.traversal import find_model
from repoze.bfg.traversal import find_root
from repoze.bfg.traversal import model_path
from karl.content.interfaces import ICalendarCategory
from karl.content.interfaces import ICalendarEvent
from karl.content.interfaces import ICalendarLayer
from ka... | boothead/karl | karl/evolve/zodb/evolve4.py | Python | gpl-2.0 | 3,893 |
import planckStyle as s
g = s.getPlotter()
g.settings.lineM = ['-k', '-r', '-b', '-g', '-m', '--c']
labels = [s.planckTT, s.NoLowLE, s.planckTT + '+lensing', s.NoLowLE + '+lensing', s.NoLowLE + '+lensing+BAO',
s.planckTTlowTEB]
roots = [s.defdata_TTonly,
s.defdata_allNoLowE,
s.defdata_TTo... | ClaudioNahmad/Servicio-Social | Parametros/CosmoMC/CosmoMC-master/batch2/outputs/tau_compare.py | Python | gpl-3.0 | 753 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ast
import inspect
import linecache
import sys
import textwrap
import tokenize
import warnings
from ast import PyCF_ONLY_AST as _AST_FLAG
from bisect import bisect_right
import py
import six
class Sou... | txomon/pytest | src/_pytest/_code/source.py | Python | mit | 10,430 |
import operator
import weakref
import pymongo
from bson import SON, DBRef, ObjectId
from mongoengine.base.common import UPDATE_OPERATORS
from mongoengine.base.datastructures import (
BaseDict,
BaseList,
EmbeddedDocumentList,
)
from mongoengine.common import _import_class
from mongoengine.errors import Dep... | MongoEngine/mongoengine | mongoengine/base/fields.py | Python | mit | 25,864 |
import json
import sys
from sys import stdout
#takes a series id, returning an object containing its attributes iff the series has info about race, education, age, and/or sex
def parseSeriesId(l):
series = {}
l = l.split('\t')
if (int(l[1]) == 40 and l[2] == 'M' and int(l[5]) == 0 and int(l[17]) == 0 and int(l[3... | xqin1/unemployment | parseBLS.py | Python | mit | 2,188 |
# -*- coding: utf-8 -*-
"""Shared functionality for dtFabric-based data format parsers."""
import abc
import os
from dtfabric import errors as dtfabric_errors
from dtfabric.runtime import data_maps as dtfabric_data_maps
from dtfabric.runtime import fabric as dtfabric_fabric
from plaso.lib import errors
from plaso.pa... | kiddinn/plaso | plaso/parsers/dtfabric_parser.py | Python | apache-2.0 | 9,892 |
# -*- coding: utf-8 -*-
"""
WSGI config for Kiwi TCMS project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application vi... | kiwitcms/Kiwi | tcms/wsgi.py | Python | gpl-2.0 | 1,656 |
# -*- coding: utf-8 -*-
#
# classjs documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 3 09:48:09 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | ojii/classjs | docs/conf.py | Python | bsd-3-clause | 7,760 |
'''Deep Dreaming in Keras.
Run the script with:
```
python deep_dream.py path_to_your_base_image.jpg prefix_for_results
```
e.g.:
```
python deep_dream.py img/mypic.jpg results/dream
```
It is preferrable to run this script on GPU, for speed.
If running on CPU, prefer the TensorFlow backend (much faster).
Example re... | dandxy89/ExperiKeras | Keras/Artwork/deep_dream.py | Python | mit | 8,598 |
from django.template.loader import make_origin
from django.template import TemplateDoesNotExist
from django.conf import settings
from djinja2.models import Jinja2Template
class Jinja2Loader(object):
skip_dirs = getattr(settings, 'KEEP_DJANGO_TEMPLATES', ())
def load_template(self, template_name, template_di... | comoga/django-djinja2 | djinja2/loaders/__init__.py | Python | bsd-3-clause | 1,429 |
from amigocloud import AmigoCloud
amigocloud = AmigoCloud(token='<token>')
owner_id = 1 # Project Owner ID
project_id = 2 # Project ID
dataset_id = 3 # Dataset ID
amigocloud.listen_dataset_events(owner_id, project_id, dataset_id)
def realtime(data):
print 'Realtime dataset id=%(dataset_id)s' % data
for ob... | amigocloud/amigocloud_samples | python/listen_realtime_example.py | Python | mit | 500 |
# ============================================================================
#
# Copyright (c) 2007-2011 Integral Technology Solutions Pty Ltd,
# All Rights Reserved.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL... | Integral-Technology-Solutions/ConfigNOW | wlst/apps.py | Python | mit | 6,847 |
from django.conf import settings
def all(request):
return {
'settings': settings,
'request': request,
}
| gitmill/gitmill | django/web/context_processors.py | Python | mit | 129 |
# Copyright 2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | jcanizales/grpc | src/python/grpcio_tests/tests/unit/_channel_args_test.py | Python | bsd-3-clause | 2,004 |
__author__ = 'quentin'
import unittest
class TestExple(unittest.TestCase):
def test_exple(self):
ans = 1
ref = 1
self.assertEqual(ans, ref)
| gilestrolab/ethoscope | src/ethoscope/tests/unittests/test_utils.py | Python | gpl-3.0 | 172 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import waypoints.models
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
dependencies = [
('routes', '0001_initial'),
]
operations = [
migrations.Cre... | bjohare/comap | waypoints/migrations/0001_initial.py | Python | gpl-3.0 | 2,051 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Magnetic/luigi | luigi/lock.py | Python | apache-2.0 | 5,561 |
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... | BurtBiel/azure-cli | src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/mgmt_vm/lib/models/template_link.py | Python | mit | 1,661 |
from shutit_module import ShutItModule
class test8(ShutItModule):
def build(self, shutit):
shutit.add_line_to_file(['asd'],'/tmp/asd')
shutit.add_line_to_file('asd2','/tmp/asd2')
shutit.add_line_to_file('asd2','/tmp/asd2')
shutit.add_line_to_file(['asd3','asd4'],'/tmp/asd2')
res = shutit.send_and_get_outpu... | ianmiell/shutit-test | test/docker_tests/8/test8.py | Python | mit | 584 |
"""
Implementation of optimized einsum.
"""
from __future__ import division, absolute_import, print_function
from numpy.core.multiarray import c_einsum
from numpy.core.numeric import asanyarray
__all__ = ['einsum', 'einsum_path']
einsum_symbols = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
einsum_symbols... | DailyActie/Surrogate-Model | 01-codes/numpy-master/numpy/core/einsumfunc.py | Python | mit | 35,518 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | bealdav/OpenUpgrade | addons/sale/sale.py | Python | agpl-3.0 | 67,360 |
import collections
from typing import Any, Dict
from config import paths
Resolution = collections.namedtuple('Resolution', ['height', 'width'])
DATASET_ROOT = {'nuscenes': paths.DIR_NUSCENES}
TRAIN_RESOLUTION = {'nuscenes': Resolution(height=448, width=800)}
def _get_dataset_param(dataset: str, all_params: Dict[st... | googleinterns/keypoint-mot | src/config/config.py | Python | apache-2.0 | 655 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.