code
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
226
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('core', '0013_merge'), ] operations = [ migrations.AlterField( model_name='user', name='public', ...
joshsamara/game-website
core/migrations/0014_auto_20150413_1639.py
Python
mit
496
#!/usr/bin/env python import subprocess import sys import signal import datetime import argparse import requests import calendar import json import zlib import time def get_median (values): sv = sorted(values) if len(sv) % 2 == 1: return sv[(len(sv) + 1) / 2 - 1] else: lower = sv[len(sv) / 2 - 1] upper = sv[...
fillest/rtmp_load
run.py
Python
mit
5,727
from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ class ContactsAppConfig(AppConfig): name = 'apps.contacts' verbose_name = _('Contacts')
samupl/simpleERP
apps/contacts/app_config.py
Python
mit
189
import importlib.util import logging import os import warnings from os import getenv from typing import Any, Optional, Mapping, ClassVar log = logging.getLogger(__name__) default_settings_dict = { 'connect_timeout_seconds': 15, 'read_timeout_seconds': 30, 'max_retry_attempts': 3, 'base_backoff_ms': 2...
pynamodb/PynamoDB
pynamodb/settings.py
Python
mit
2,509
#-*- coding: utf-8 -*- """ envois.test ~~~~~~~~~~~~ nosetests for the envois pkg :copyright: (c) 2012 by Mek :license: BSD, see LICENSE for more details. """ import os import json import unittest from envois import invoice jsn = {"seller": {"name": "Lambda Labs, Inc.", "address": {"street": "857...
lambdal/envois
test/test_envois.py
Python
mit
1,000
# Taken from https://github.com/salesforce/awd-lstm-lm/blob/master/weight_drop.py import torch from torch.nn import Parameter from functools import wraps class WeightDrop(torch.nn.Module): def __init__(self, module, weights, dropout=0, variational=False): super(WeightDrop, self).__init__() self.mod...
eladhoffer/seq2seq.pytorch
seq2seq/models/modules/weight_drop.py
Python
mit
1,803
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Apr 27 12:16:26 2017 @author: Anand A Joshi, Divya Varadarajan """ import glob from os.path import isfile, split import configparser config_file = u'/big_disk/ajoshi/ABIDE2/study.cfg' Config = configparser.ConfigParser() Config.read(config_file) Conf...
ajoshiusc/brainsuite-workflows
utility_scripts/main_check_remaining.py
Python
mit
1,120
import json from django.template.loader import render_to_string from django.http import HttpResponse from django.utils import timezone from django.shortcuts import render_to_response from cir.models import * import claim_views from cir.phase_control import PHASE_CONTROL import utils def get_statement_comment_list(r...
xsunfeng/cir
cir/phase5.py
Python
mit
3,009
from setuptools import setup # Based on # https://python-packaging.readthedocs.io/en/latest/minimal.html def readme(): with open('README.md','r') as fr: return fr.read() setup(name='docker_machinator', version='0.1', description='A tool for managing docker machines from multiple' ...
realcr/docker_machinator
setup.py
Python
mit
1,193
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Message' db.create_table('firstclass_message', ( ...
bennylope/django-firstclass
firstclass/south_migrations/0001_initial.py
Python
mit
1,013
#%% # Copyright 2015 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 required by app...
fx2003/tensorflow-study
TensorFlow实战/《TensorFlow实战》代码/3_2_HelloWorld.py
Python
mit
1,784
from flask import Flask from flask import render_template from .. import app @app.route('/') def index(): user = {'first_name': 'Lance', 'last_name': 'Anderson'} return render_template('index.html', user=user) @app.route('/user/<user_id>/board/<board_id>') @app.route('/new_board') def board(user_id=None, boa...
Lancea12/sudoku_solver
sudoku/views/index.py
Python
mit
445
raise NotImplementedError("getopt is not yet implemented in Skulpt")
ArcherSys/ArcherSys
skulpt/src/lib/getopt.py
Python
mit
69
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # MODIFIED FROM ORIGINAL VERSION # # This file is not the same as in pypi. It includes a pull request to fix py3 # incompabilities that never ended up getting merged. ###########################...
psistats/linux-client
psistats/libsensors/lib/sensors.py
Python
mit
8,525
# Regular expressions are a powerful tool for pattern matching when you # know the general format of what you're trying to find but want to keep # it loose in terms of actual content: think finding email addresses or # phone numbers based on what they have in common with each other. Python # has a standard library that...
ireapps/coding-for-journalists
2_web_scrape/completed/fun_with_regex_done.py
Python
mit
3,044
# Generated by Django 2.2.11 on 2020-11-09 17:00 import daphne_context.utils from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ...
seakers/daphne_brain
daphne_context/migrations/0011_auto_20201109_1100.py
Python
mit
1,011
import matplotlib.transforms import numpy def has_legend(axes): return axes.get_legend() is not None def get_legend_text(obj): """Check if line is in legend.""" leg = obj.axes.get_legend() if leg is None: return None keys = [h.get_label() for h in leg.legendHandles if h is not None] ...
m-rossi/matplotlib2tikz
tikzplotlib/_util.py
Python
mit
1,258
import functools from time import strftime import tensorflow as tf # lazy_property: no need for if $ not None logic def lazy_property(function): attribute = '_cache_' + function.__name__ @property @functools.wraps(function) def decorator(self): if not hasattr(self, attribute): set...
JuliusKunze/thalnet
util.py
Python
mit
2,098
class Solution(object): def multiply(self, A, B): """ :type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]] """ p = len(B[0]) C = [[0 for _ in xrange(p)] for _ in xrange(len(A))] for i in xrange(len(A)): for j in xrange(...
quake0day/oj
Sparse Matrix Multiplication.py
Python
mit
535
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This is a doctest example with Numpy arrays. For more information about doctest, see https://docs.python.org/3/library/doctest.html (reference) and www.fil.univ-lille1.fr/~L1S2API/CoursTP/tp_doctest.html (nice examples in French). To run doctest, execute this script...
jeremiedecock/snippets
python/doctest/numpy_example.py
Python
mit
2,806
# coding: utf-8 # In[1]: import matplotlib.pyplot as plt #import modules import matplotlib.patches as mpatches import numpy as np #get_ipython().magic(u'matplotlib inline') # set to inline for ipython # In[2]: water = [0,2,2,3,1.5,1.5,3,2,2,2,2,2.5,2] #arrange data from lab alc = [0,2.5,2.5,2.5,2.5,3,2.5,2.5] wei...
aknh9189/code
physicsScripts/flotation/flotation.py
Python
mit
1,813
from __future__ import with_statement from cuisine import * from fabric.api import env from fabric.colors import * from fabric.utils import puts from fabric.context_managers import cd, settings, prefix from flabric import ApplicationContext as AppContext from flabric.ubuntu import UbuntuServer import os, flabric clas...
mattupstate/flabric
flabric/ubuntu/nginx_uwsgi_supervisor.py
Python
mit
7,722
import json_creator class Message: def __init__(self, sent_to, sent_from, text): self.sent_from = sent_from self.text = text self.sent_to = sent_to def parse_message(self, message_dict): self.sent_from = json_creator.get_message_sendfrom(message_dict) self.sent_to = js...
ndmoroz/dont-wanna-talk
jim_chat.py
Python
mit
1,075
""" Settings for testing the application. """ import os DEBUG = True DJANGO_RDFLIB_DEVELOP = True DB_PATH = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'rdflib_django.db')) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': DB_PATH, 'USER': '', ...
publysher/rdflib-django
src/rdflib_django/testsettings.py
Python
mit
1,265
import Image import json south = 51.416; north = 51.623; west = -0.415; east = 0.179; if __name__ == "__main__": x = Image.fromstring("RGBA", (2668,1494), open("output_pixel_data").read()) x.save("lit-map.png", "PNG")
samphippen/london
render.py
Python
mit
232
# coding=utf-8 import threading server = None web_server_ip = "0.0.0.0" web_server_port = "8000" web_server_template = "www" def initialize_web_server(config): ''' Setup the web server, retrieving the configuration parameters and starting the web server thread ''' global web_server_ip, web_server...
hiei171/lendingbotpoloniex
modules/WebServer.py
Python
mit
3,367
#!/usr/bin/env python2 """ Quick helper to add HTML5 DOCTYPE and <title> to every testcase. """ import os import re import sys def fixhtml(folder): changed = 0 for dirpath, _, filenames in os.walk(folder): for file in filenames: name, ext = os.path.splitext(file) if ext != '.ht...
qll/autoCSP
testsuite/testcases/fixhtml.py
Python
mit
1,054
import subprocess import sys import shutil import os import os.path import unittest import json import getpass import requests import zipfile import argparse import io import tempfile import time import lark from osspeak import version OSSPEAK_MAIN_PATH = os.path.join('osspeak', 'main.py') OSSPEAK_SRC_FOLDER = 'ossp...
osspeak/osspeak
buildit.py
Python
mit
3,203
T = int(raw_input()) for test in xrange(T): N = int(raw_input()) a, b, result = 0, 1, 0 c = a+b while c < N: if c%2 == 0: result += c a,b = b,c c = a+b print result
MayankAgarwal/euler_py
002/euler002.py
Python
mit
236
import numbers import warnings from functools import wraps, partial from typing import List, Callable import logging import numpy as np import jax import jax.numpy as jnp import jax.scipy as scipy from jax.core import Tracer from jax.interpreters.xla import DeviceArray from jax.scipy.sparse.linalg import cg from jax i...
tum-pbs/PhiFlow
phi/jax/_jax_backend.py
Python
mit
16,438
def urepr(x): import re, unicodedata def toname(m): try: return r"\N{%s}" % unicodedata.name(unichr(int(m.group(1), 16))) except ValueError: return m.group(0) return re.sub( r"\\[xu]((?<=x)[0-9a-f]{2}|(?<=u)[0-9a-f]{4})", toname, repr(x) ...
ActiveState/code
recipes/Python/541082_Unicode_repr/recipe-541082.py
Python
mit
528
def no_extreme(listed): """ Takes a list and chops off extreme ends """ del listed[0] del listed[-1:] return listed def better_no_extreme(listed): """ why better ? For starters , does not modify original list """ return listed[1:-1] t = ['a','b','c'] print t print '\n' print 'pop any element : by t.pop(1) ...
kaustubhhiware/hiPy
think_python/lists2.py
Python
mit
1,424
import os, sys import random import time import feedparser import itertools import HTMLParser from feed import Feed if os.getcwd().rstrip(os.sep).endswith('feeds'): os.chdir('..') sys.path.insert(0, os.getcwd()) from gui_client import new_rpc import web import reddit class RSSFeed(Feed): def __init__(se...
pjurik2/pykarma
feeds/rss.py
Python
mit
3,205
import argparse parser = argparse.ArgumentParser() parser.add_argument("--mat", type=str, help="mat file with observations X and side info", required=True) parser.add_argument("--epochs", type=int, help="number of epochs", default = 2000) parser.add_argument("--hsize", type=int, help="size of the hidden layer", ...
jaak-s/chemblnet
models/vaffl.py
Python
mit
7,837
import os.path import subprocess import pkg_resources import setuptools # pylint: disable=unused-import def get_package_revision(package_name): # type: (str) -> str """Determine the Git commit hash for the Shopify package. If the package is installed in "develop" mode the SHA is retrieved using Git. Ot...
Shopify/shopify_python
shopify_python/packaging.py
Python
mit
2,108
#!/usr/bin/env python3 from setuptools import setup setup( name='SecFS', version='0.1.0', description='6.858 final project --- an encrypted and authenticated file system', long_description= open('README.md', 'r').read(), author='Jon Gjengset', author_email='jon@thesquareplanet.com', mainta...
mit-pdos/secfs-skeleton
setup.py
Python
mit
883
from django.conf.urls import url from blog import views urlpatterns = [ url(r'^view$', views.archive), url(r'^$', views.welcome), url(r'^create', views.create_blogpost), ]
kalicodextu/djangoblog
blog/urls.py
Python
mit
186
"""Helper to handle a set of topics to subscribe to.""" from __future__ import annotations from collections import deque from collections.abc import Callable import datetime as dt from functools import wraps from typing import Any import attr from homeassistant.core import HomeAssistant from homeassistant.helpers im...
rohitranjan1991/home-assistant
homeassistant/components/mqtt/debug_info.py
Python
mit
8,644
def is_palindrome(data): if isinstance(data, list): data = ''.join(c.lower() for c in ''.join(data) if c.isalpha()) if isinstance(data, str): return "Palindrome" if data == data[::-1] else "Not a palindrome" else: return "Invalid input" if __name__ == "__main__": with open("inpu...
marcardioid/DailyProgrammer
solutions/232_Easy/solution.py
Python
mit
427
from typing import Any, Dict, List, Sequence, Tuple from gym3.types import ValType class Env: """ An interface for reinforcement learning environments. :param ob_space: ValType representing the valid observations generated by the environment :param ac_space: ValType representing the valid actions th...
openai/gym3
gym3/env.py
Python
mit
3,105
# -*- coding:utf-8 -*- from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 10 _modified_time = 1440369075.543512 _enable_loop = True _template_filename = u'themes/monospace/templates/index.tmpl' _template_uri = u'index.tmpl' _source_...
wcmckee/brobeurdotcom
cache/.mako.tmp/index.tmpl.py
Python
mit
5,371
import csv import os #### make sure these file names are the same as the ones on your system baseline_csv = r"baseline.csv" new_csv = r"cleaned_csv.csv" ########### do not edit below this line ################# baseline_as_rows = [] new_as_rows = [] if not os.path.exists(baseline_csv): quit("The basel...
jayGattusoNLNZ/DROID_comparer
DROID_export_comparer.py
Python
mit
1,579
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # feeluown documentation build configuration file, created by # sphinx-quickstart on Fri Oct 2 20:55:54 2015. # # 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 # a...
JanlizWorldlet/FeelUOwn
sphinx_doc/source/conf.py
Python
mit
9,220
from django.test import TestCase from django.core.urlresolvers import reverse from django.contrib.auth.models import User from django.forms.models import modelformset_factory from django.forms.formsets import formset_factory from formsettesthelpers import * from formsettesthelpers.test_app.forms import ( UserF...
Raekkeri/django-formsettesthelpers
src/formsettesthelpers/tests.py
Python
mit
4,321
# Copyright (C) MetaCarta, Incorporated. # # 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. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; ...
diffeo/py-nilsimsa
nilsimsa/deprecated/_deprecated_nilsimsa.py
Python
mit
9,977
""" graph.py ------------- Deal with graph operations. Primarily deal with graphs in (n, 2) edge list form, and abstract the backend graph library being used. Currently uses networkx or scipy.sparse.csgraph backend. """ import numpy as np import collections from . import util from . import grouping from . import ex...
dajusc/trimesh
trimesh/graph.py
Python
mit
30,522
# coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # --------------------------------------------------------------------...
Azure/azure-sdk-for-python
sdk/storage/azure-storage-file-datalake/samples/datalake_samples_access_control_recursive_async.py
Python
mit
5,962
#------------- Daniel Han-Chen 2017 #------------- https://github.com/danielhanchen/sciblox #------------- SciBlox v0.02 #------------- maxcats = 15 import warnings warnings.filterwarnings("ignore") true = True; TRUE = True false = False; FALSE = False import pip def install(package): pip.main(['install', package]) #...
danielhanchen/sciblox
sciblox (v1)/sciblox.py
Python
mit
74,277
# -*- coding: utf-8 -*- ''' Creates a Gene Wiki protein box template around a gene specified by the first argument passed to it on the command line. Usage: `python create_template.py <entrez_id>` ''' import sys from genewiki.mygeneinfo import parse if len(sys.argv[1]) > 1: entrez = sys.argv[1] try: in...
SuLab/genewiki
old-assets/scripts/create_template.py
Python
mit
480
"""pytest_needle.driver .. codeauthor:: John Lane <jlane@fanthreesixty.com> """ import base64 from errno import EEXIST import math import os import re import sys import pytest from needle.cases import import_from_string from needle.engines.pil_engine import ImageDiff from PIL import Image, ImageDraw, ImageColor from...
jlane9/pytest-needle
pytest_needle/driver.py
Python
mit
13,087
#!/usr/bin/env python # -*- coding: utf-8 -*- """Facebook OAuth interface.""" # System imports import json import logging try: from urllib import quote_plus except ImportError: from urllib.parse import quote_plus import oauth2 as oauth from django.conf import settings # Project imports from .base_auth import...
jojanper/draalcore
draalcore/auth/sites/fb_oauth.py
Python
mit
2,606
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from tests import IntegrationTestCase from tests.holodeck import Request from twilio.base.exceptions import TwilioException from twilio.http.response import Response class ShortCodeTestCase(Integra...
twilio/twilio-python
tests/integration/api/v2010/account/test_short_code.py
Python
mit
6,758
class GeneticEngine: genomLength = 10 generationCount = 10 individualCount = 10 selectionType = 10 crossingType = 10 useMutation = 1 mutationPercent = 50 """constructor""" def __init__(self, fitnessFunction): return 0 """main body""" def run(): ret...
GrimRanger/GeneticAlgorithm
GeneticLib/genetic_engine.py
Python
mit
512
import argparse import logging from typing import List, Optional from redis import StrictRedis from minique.compat import sentry_sdk from minique.work.worker import Worker def get_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser() parser.add_argument("-u", "--redis-url", required=True) ...
valohai/minique
minique/cli.py
Python
mit
1,399
""" Contains basic interface (abstract base class) for word embeddings. """ import os from abc import ABCMeta, abstractmethod class IWordEmbedding(object): """ Abstract base class for word embeddings """ __metaclass__ = ABCMeta def __init__(self, path, vector_length): self.model = None ...
mikolajsacha/tweetsclassification
src/features/word_embeddings/iword_embedding.py
Python
mit
1,681
""" Views for PubSite app. """ from django.conf import settings from django.contrib.auth.views import ( PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, PasswordResetCompleteView, ) from django.shortcuts import render import requests import logging logger = logging.getLogger(__name__...
sigmapi-gammaiota/sigmapi-web
sigmapiweb/apps/PubSite/views.py
Python
mit
4,610
import os import re from amlib import conf, utils, log ''' Functions for parsing AD automount maps into a common dict format. Part of ampush. https://github.com/sfu-rcg/ampush Copyright (C) 2016 Research Computing Group, Simon Fraser University. ''' # ff = flat file automount map def get_names(): ''' Return a li...
sfu-rcg/ampush
amlib/file_map.py
Python
mit
6,519
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-01-06 12:34 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.forms.widgets class Migration(migrations.Migration): initial = True depen...
t-mertz/slurmCompanion
django-web/sshcomm/migrations/0001_initial.py
Python
mit
1,536
from operator import mul def multiply(n, l): return map(lambda a: mul(a, n), l)
the-zebulan/CodeWars
katas/beta/multiply_list_by_integer_with_restrictions.py
Python
mit
86
# Copyright (c) 2014 - 2016 townhallpinball.org # # 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, p...
town-hall-pinball/project-omega
pin/lib/dmd.py
Python
mit
6,277
#!/usr/bin/env python #-*- coding: utf-8 -*- f = open('data.txt', 'w') size = f.write('Hello\n') f.write('World\n') f.close() f = open('data.txt') text = f.read() print(text) f.close()
Furzoom/learnpython
usefull_scripts/write_to_file.py
Python
mit
187
r"""OS routines for Mac, NT, or Posix depending on what system we're on. This exports: - all functions from posix, nt, os2, or ce, e.g. unlink, stat, etc. - os.path is either posixpath or ntpath - os.name is either 'posix', 'nt', 'os2' or 'ce'. - os.curdir is a string representing the current directory ('.' or...
MalloyPower/parsing-python
front-end/testsuite-python-lib/Python-3.0/Lib/os.py
Python
mit
21,471
from mabozen.lib.url import parse_rfc1738_args def parse_url(db_url): """parse url""" components = parse_rfc1738_args(db_url) return components
mabotech/mabozen
mabozen/lib/parse_url.py
Python
mit
163
"""Unit tests for PyGraphviz interface.""" import os import tempfile import pytest import pytest pygraphviz = pytest.importorskip('pygraphviz') from networkx.testing import assert_edges_equal, assert_nodes_equal, \ assert_graphs_equal import networkx as nx class TestAGraph(object): def build_graph(sel...
sserrot/champion_relationships
venv/Lib/site-packages/networkx/drawing/tests/test_agraph.py
Python
mit
3,587
print("hola me llamo juan") a = 'ofi' b = 'chilea' c = 'Mmm' d = 'me da igual' bandera = True carac = input() if carac.endswith('?'): print(a) elif carac.isupper(): print (b) elif carac.isalnum(): print(d) else: print(c)
erick84/uip-iiiq2016-prog3
laboratorio3/Juanelcallado/Juan.py
Python
mit
284
import pygame import os from buffalo import utils from item import Item # User interface for trading with NPCs # Similar to the crafting UI, with some minor differences # The biggest thing is that it only appears when you "talk to" (read click on) # A trader NPC and disappears when you leave that window, and only cont...
benjamincongdon/adept
tradingUI.py
Python
mit
3,586
#!/usr/bin/env python """Robobonobo setup script. Usage: ./get_ready.py [options] Options: -h, --help Show this help screen --version Show the version. """ from docopt import docopt from glob import glob import os GPIOS = [30, 31, 112, 113, 65, 27] GPIO_BASE = "/sys/class/gpio" SLOTS_GLOB = "/s...
dunmatt/robobonobo
scripts/get_ready.py
Python
mit
979
import PySeis as ps import numpy as np import pylab #import dataset input = ps.io.su.SU("./data/sample.su") input.read("./data/raw.npy") #initialise dataset #~ data, params = toolbox.initialise("geometries.su") #trim data #~ params['ns'] = 1500 #~ data = toolbox.slice(data, None, **params) #~ data.tofile("geom_short...
stuliveshere/PySeis
examples/01.0_import_su.py
Python
mit
787
#!/usr/bin/env python """Parse GCC-XML output files and produce a list of class names.""" # import system modules. import multiprocessing import xml.dom.minidom import sys import os # Import application modules. import mpipe import util # Configure and parse the command line. NAME = os.path.basename(sys.argv[0]) AR...
vmlaker/pythonwildmagic
tool/parse-xml.py
Python
mit
1,870
from __future__ import print_function, division import numpy as np import pytest import sys import chronostar.likelihood sys.path.insert(0,'..') from chronostar import expectmax as em from chronostar.synthdata import SynthData from chronostar.component import SphereComponent from chronostar import tabletool from ch...
mikeireland/chronostar
unit_tests/test_unit_expectmax.py
Python
mit
6,240
def python_evaluate(text): return eval(str(text)) def python_print(*values, sep=' '): joined = sep.join((str(v) for v in values)) print(joined) def python_list(*args): return args def error(text=''): raise RuntimeError(text)
osspeak/osspeak
osspeak/recognition/actions/library/general.py
Python
mit
247
#!/usr/bin/env python ''' utils.py: part of som package Copyright (c) 2017 Vanessa Sochat 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 ri...
radinformatics/som-tools
som/utils.py
Python
mit
8,265
#!/usr/bin/python import argparse from board_manager import BoardManager from constants import * def main(): parser = argparse.ArgumentParser(description='Board client settings') parser.add_argument('-sp', '--PORT', help='server port', type=int, default=80, required=False) parser....
TeamProxima/predictive-fault-tracker
board/board_client.py
Python
mit
909
""" @brief test log(time=8s) @author Xavier Dupre """ import sys import os import unittest import shutil from contextlib import redirect_stdout from io import StringIO from pyquickhelper.pycode import ExtTestCase from pyquickhelper.pycode import process_standard_options_for_setup_help, get_temp_folder from pyq...
sdpython/pyquickhelper
_unittests/ut_pycode/test_missing_function_pycode.py
Python
mit
3,947
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py
Python
mit
167,573
# binary tag: refers to tags that have open and close element # eg: [a]some content[/a] # standalone tag: refers to tags that are self contained # eg: [b some content] # Assuming that the text input is well formatted # open input and output file with open('textin.txt', 'r') as f1, open('textout.txt', 'w') as f2: ...
julio73/scratchbook
code/work/alu/indenter.py
Python
mit
1,460
from django.conf.urls import patterns # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('staticblog.views', (r'^$', 'archive'), (r'^([\-\w]+)$', 'render_post'), (r'^git/receive', 'handle_hook'), )
cgrice/django-staticblog
staticblog/urls.py
Python
mit
294
# -*- coding: utf-8 -*- """ Copyright (c) 2014 l8orre 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, pub...
l8orre/nxtPwt
nxtPwt/nxtWin5Control1.py
Python
mit
2,721
"""tictactoe URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-bas...
jsonbrazeal/tictactoe
tictactoe/urls.py
Python
mit
1,037
from flask import request, abort, jsonify, render_template from flask.ext.sqlalchemy import BaseQuery import math class PaginatedQuery(object): def __init__(self, query_or_model, paginate_by, page_var='page', check_bounds=False): self.paginate_by = paginate_by self.page_var = page...
pbecotte/devblog
backend/blog/utils.py
Python
mit
2,165
# -*- coding: utf-8 -*- from __future__ import print_function import logging import os import re import socket import sys import time import django from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, CommandError from django.cor...
haakenlid/django-extensions
django_extensions/management/commands/runserver_plus.py
Python
mit
22,214
import pygame, sys from pygame.locals import * import re import json import imp import copy #chessboard = json.load(open("./common/initial_state.json")) chessboard1 = json.load(open("./common/initial_state.json")) chessboard2 = json.load(open("./common/initial_state.json")) chessboard3 = json.load(open("./common/i...
OpenC-IIIT/prosfair
gui/gui_basic.py
Python
mit
23,370
import chess chess.run()
renatopp/liac-chess
main.py
Python
mit
25
"""Auto-generated file, do not edit by hand. PG metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_PG = PhoneMetadata(id='PG', country_code=675, international_prefix='00', general_desc=PhoneNumberDesc(national_number_pattern='[1-9]\\d{6,7}', possible_length=(7, 8)),...
samdowd/drumm-farm
drumm_env/lib/python2.7/site-packages/phonenumbers/data/region_PG.py
Python
mit
1,122
# -*- coding: utf-8 -*- from ethereum.utils import sha3, encode_hex, denoms from raiden.utils import privatekey_to_address from raiden.tests.utils.blockchain import GENESIS_STUB CLUSTER_NAME = 'raiden' def generate_accounts(seeds): """Create private keys and addresses for all seeds. """ return { ...
tomaaron/raiden
tools/genesis_builder.py
Python
mit
1,166
import pyintersim.corelib as corelib import ctypes ### Load Library _core = corelib.LoadCoreLibrary() ### State wrapper class to be used in 'with' statement class State: """Wrapper Class for the State""" def __init__(self): self.p_state = setup() def __enter__(self): return self.p_state ...
GPMueller/intersim
core/pyintersim/state.py
Python
mit
743
import importlib def import_string(import_name: str): """ Import an object based on the import string. Separate module name from the object name with ":". For example, "linuguee_api.downloaders:HTTPXDownloader" """ if ":" not in import_name: raise RuntimeError( f'{import_n...
imankulov/linguee-api
linguee_api/utils.py
Python
mit
592
import numpy as np import pandas as pd import pickle # Return 0 or 1 based on whether Course fulfills a General Education Requirement def lookupGenEd(cNum, college): fileName = "data/Dietrich Gen Eds.csv" picklepath = "data\\dietrich_gen_eds.p" try: with open(picklepath,'rb') as file: ...
calvinhklui/Schedulize
GenEdLookup.py
Python
mit
931
import numpy as np, time, itertools from collections import OrderedDict from .misc_utils import * from . import distributions concat = np.concatenate import theano.tensor as T, theano from importlib import import_module import scipy.optimize from .keras_theano_setup import floatX, FNOPTS from keras.layers.core import L...
abhinavagarwalla/modular_rl
modular_rl/core.py
Python
mit
24,088
#!/usr/bin/python ################################################################################# # # The MIT License (MIT) # # Copyright (c) 2015 Dmitry Sovetov # # https://github.com/dmsovetov # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documen...
dmsovetov/pygling
Pygling/__main__.py
Python
mit
3,421
from captcha.fields import CaptchaField from django import forms from django.contrib.auth.models import User from django.http import HttpResponse try: from django.template import engines __is_18 = True except ImportError: from django.template import loader __is_18 = False TEST_TEMPLATE = r""" <!DOC...
mbi/django-simple-captcha
captcha/tests/views.py
Python
mit
3,752
from __future__ import unicode_literals import os from mopidy import ext, config __version__ = '1.0.1' __url__ = 'https://github.com/dz0ny/mopidy-api-explorer' class APIExplorerExtension(ext.Extension): dist_name = 'Mopidy-API-Explorer' ext_name = 'api_explorer' version = __version__ def get_defa...
dz0ny/mopidy-api-explorer
mopidy_explorer/__init__.py
Python
mit
762
import twe_lite import json import queue import sys import time import traceback import yaml from threading import Thread from datetime import datetime from pytz import timezone from iothub_client import IoTHubClient, IoTHubClientError, IoTHubTransportProvider, IoTHubClientResult, IoTHubClientStatus from iot...
locatw/Autonek
TweLiteGateway/twe_lite_gateway/gateway.py
Python
mit
4,912
# direct inputs # source to this solution and code: # http://stackoverflow.com/questions/14489013/simulate-python-keypresses-for-controlling-a-game # http://www.gamespp.com/directx/directInputKeyboardScanCodes.html import ctypes import time HELD = set() SendInput = ctypes.windll.user32.SendInput mouse_button_down_m...
osspeak/osspeak
osspeak/recognition/actions/library/directinput.py
Python
mit
4,326
# -*- test-case-name: twisted.test.test_factories,twisted.internet.test.test_protocol -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Standard implementations of Twisted protocol-related interfaces. Start here if you are looking to write a new protocol implementation for Twisted. The ...
amol9/mayloop
mayloop/imported/twisted/internet_protocol.py
Python
mit
7,110
# -*- coding:utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import django import patchy from django.db.models.deletion import get_candidate_relations_to_delete from django.db.models.query import QuerySet from django.db.models.query_utils import Q from django.db.models.sql....
moumoutte/django-perf-rec
django_perf_rec/orm.py
Python
mit
3,345
import time from aquests.athreads import socket_map from aquests.athreads import trigger from rs4.cbutil import tuple_cb from aquests.client.asynconnect import AsynSSLConnect, AsynConnect from aquests.dbapi.dbconnect import DBConnect import threading from aquests.protocols.http import request as http_request from aques...
hansroh/skitai
skitai/corequest/httpbase/task.py
Python
mit
22,202
# -*- coding: utf-8 -*- """Alternate versions of the splitting functions for testing.""" from __future__ import unicode_literals import unicodedata from natsort.compat.py23 import PY_VERSION if PY_VERSION >= 3.0: long = int def int_splitter(x, signed, safe, sep): """Alternate (slow) method to split a string...
agustinhenze/natsort.debian
test_natsort/slow_splitters.py
Python
mit
5,511
# Copyright (c) 2013 Matthieu Huguet # 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, dist...
madmatah/lapurge
lapurge/purge.py
Python
mit
3,000
import sys import multiprocessing import os.path as osp import gym from collections import defaultdict import tensorflow as tf import numpy as np from baselines.common.vec_env.vec_video_recorder import VecVideoRecorder from baselines.common.vec_env.vec_frame_stack import VecFrameStack from baselines.common.cmd_util im...
dsbrown1331/CoRL2019-DREX
drex-atari/baselines/baselines/run.py
Python
mit
8,217