code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
# Django settings for gazetteer project. import os from os.path import join DEBUG = True TEMPLATE_DEBUG = DEBUG JSON_DEBUG = DEBUG # DATA_DIR = '/home/sanj/c/gazetteer/data' ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) INTERNAL_IPS = ('127.0.0.1',) MANAGERS = ADMINS LOCAL_DEVELOPMENT = True PROJECT_RO...
LibraryOfCongress/gazetteer
prototype/settings.py
Python
mit
6,102
# -*- coding: utf-8 -*- import shutil import locm, routem, mapm, dropboxm, gmaps, tools, bokehm, tspm import logging.config, os, yaml, inspect import time, math, random, sys, copy import numpy as np import anneal_optimizer import haversine # haversine((45.7597, 4.8422),(48.8567, 2.3508),miles = True)243.71209416020253 ...
sergeimoiseev/othodi_code
old2/thread_optimizer.py
Python
mit
13,716
import itertools import uuid from django.db import connection, models from busshaming.enums import ScheduleRelationship UPSERT_ENTRY = ''' INSERT INTO busshaming_realtimeentry (id, trip_date_id, stop_id, sequence, arrival_time, arrival_delay, departure_time, departure_delay, schedule_relationship) VALUES (uuid_gene...
katharosada/bus-shaming
busshaming/models/realtime_entry.py
Python
mit
2,639
#!/usr/bin/env python # Jonas Schnelli, 2013 # make sure the ScarceCoin-Qt.app contains the right plist (including the right version) # fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267) from string import Template from datetime import date bitcoinDir = "./"; ...
scarcecoin/scarcecoin
share/qt/clean_mac_info_plist.py
Python
mit
901
""" Support for Wink lights. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.wink/ """ import logging from homeassistant.components.light import ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, \ Light, ATTR_RGB_COLOR from homeassistant.components.wink import...
Julian/home-assistant
homeassistant/components/light/wink.py
Python
mit
2,816
import _plotly_utils.basevalidators class TicksuffixValidator(_plotly_utils.basevalidators.StringValidator): def __init__( self, plotly_name="ticksuffix", parent_name="histogram2d.colorbar", **kwargs ): super(TicksuffixValidator, self).__init__( plotly_name=plotly_name, ...
plotly/plotly.py
packages/python/plotly/plotly/validators/histogram2d/colorbar/_ticksuffix.py
Python
mit
437
import _plotly_utils.basevalidators class TokenValidator(_plotly_utils.basevalidators.StringValidator): def __init__(self, plotly_name="token", parent_name="bar.stream", **kwargs): super(TokenValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, e...
plotly/plotly.py
packages/python/plotly/plotly/validators/bar/stream/_token.py
Python
mit
491
# -*- coding: utf-8 -*- """ This module provides the backend Flask server used by psiTurk. """ import os import sys import datetime import logging from random import choice import user_agents import string import requests import re import json try: from collections import Counter except ImportError: from coun...
suchow/psiTurk
psiturk/experiment.py
Python
mit
23,882
# Copyright 2012-2015 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file ac...
mnahm5/django-estore
Lib/site-packages/awscli/customizations/cloudformation/artifact_exporter.py
Python
mit
14,032
''' Created For Mega Projects Repository Problem: Find PI to the Nth Digit Enter a number and have the program generate PI up to that many decimal places. Keep a limit to how far the program will go. @author: Sambit ''' #Imports from decimal import * #Functions #Function to calculate the value of PI using Bellard...
SambitAcharya/Projects
My Solutions/Numbers/pi.py
Python
mit
1,383
from unittest import mock from yawn import manage @mock.patch.object(manage, 'execute_from_command_line') def test_manage(mock_execute): manage.main() assert mock_execute.called
aclowes/yawn
yawn/management/tests/test_manage.py
Python
mit
189
from datetime import date from mock import patch, Mock from nose.tools import raises, assert_equals, assert_true from twilio.rest.resources import Recordings from tools import create_mock_json BASE_URI = "https://api.twilio.com/2010-04-01/Accounts/AC123" ACCOUNT_SID = "AC123" AUTH = (ACCOUNT_SID, "token") RE_SID = "R...
kyleconroy/python-twilio2
tests/test_recordings.py
Python
mit
1,741
import json, logging, os, pprint from dashboard_app import models, settings_app from dashboard_app.lib import misc from dashboard_app.lib.shib_auth import shib_login # decorator from dashboard_app.lib.widget_helper import WidgetPrepper from dashboard_app.models import Tag, Widget from django.conf import settings as p...
birkin/dashboard
dashboard_app/views.py
Python
mit
7,211
## Minimal 3-node example of PyPSA linear optimal power flow # #Available as a Jupyter notebook at <https://pypsa.readthedocs.io/en/latest/examples/minimal_example_lopf.ipynb>. import pypsa import numpy as np network = pypsa.Network() #add three buses for i in range(3): network.add("Bus","My bus {}".format(i)) ...
PyPSA/PyPSA
examples/minimal_example_lopf.py
Python
mit
1,960
""" Plugin for Pyramid apps to submit errors to Rollbar """ __version__ = '0.9.14' import copy import inspect import json import logging import math import numbers import os import socket import sys import threading import time import traceback import types import urllib import uuid import wsgiref.util import request...
tmlee/pyrollbar
rollbar/__init__.py
Python
mit
42,148
from django.contrib import admin from .models import WorkCenter list_display = ('workcenter_id') admin.site.register(WorkCenter)
wltribble/frost
frost/workcenters/admin.py
Python
mit
132
""" Unit tests for format checking """ from __future__ import print_function import os import subprocess import cleverhans from cleverhans.devtools.list_files import list_files from cleverhans.utils import shell_call # Enter a manual list of files that are allowed to violate PEP8 here whitelist_pep8 = [ # This...
carlini/cleverhans
cleverhans/devtools/tests/test_format.py
Python
mit
4,247
# -*- coding: utf-8 -*- from flask import Blueprint from .views import CommonView front = Blueprint('front', __name__) front.add_url_rule('/', view_func=CommonView.as_view('root')) front.add_url_rule('/index', view_func=CommonView.as_view('index')) front.add_url_rule('/edite/<id>', view_func=CommonView.as_view('edi...
iceihehe/easy-note
app/front/__init__.py
Python
mit
559
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys import requests # import yajl as json import json import progressbar as pb from termcolor import colored as color from scraper.utilities.item import item as I def CreateDatasets(dataset_dict, hdx_site, apikey, verbose=True, update_all_datasets=False): ...
luiscape/hdxscraper-ifpri-dataverse
hdx_register/create.py
Python
mit
10,041
default_app_config = 'rule.apps.RuleConfig'
volzotan/django-howl
howl/rule/__init__.py
Python
mit
43
from django.conf.urls import url from . import views app_name = "coffee" urlpatterns = [ # ../ url(r"^$", views.IndexView.as_view(), name="index"), # # Registration # # ../profile url(r"^profile/$", views.profile, name="profile"), # ../login # url(r"^login/$", login, {"template_na...
greg-ruane/coffee-catalog
src/coffee/urls.py
Python
mit
1,635
import struct packet_len_pack_pattern = 'Q' sizeBytes = 8 def sendPacket(sock, bstr): sock.send(struct.pack(packet_len_pack_pattern, len(bstr))) sock.sendall(bstr) def recvPacket(sock): packet_len_bstr = recvBytes(sock, sizeBytes) packet_len = struct.unpack(packet_len_pack_pattern, packet_len_bstr)[0] bstr = re...
misterlihao/network-programming-project
myPacket.py
Python
mit
484
#!/usr/bin/python """ .. module:: kalman :platform: Mac :synopsis: A collection of useful filtering and smoothing tools all derived from Kalman filtering techniques. .. moduleauthor:: Rowland O'Flaherty <rowlandoflaherty.com> """ import numpy as np def filter(x, P, Phi, H, W, V, z): """This function retur...
rowoflo/Python_EstimationPackage
kalman.py
Python
mit
2,902
import sys from http.server import CGIHTTPRequestHandler, HTTPServer port = 8000 if len(sys.argv) > 1: port = int(sys.argv[1]) handler = CGIHTTPRequestHandler handler.cgi_directories = ["/py"] server = HTTPServer(("", port), handler) print("Server running on port " + str(port)) server.serve_forever()
z-------------/newsstand
server.py
Python
mit
311
import zipfile import os import shutil import pytest from devml import mkdata @pytest.fixture def data(): checkout_folder = "temp_checkout" zip_ref = zipfile.ZipFile(path_to_zip_file, 'r') os.mkdir(checkout_folder) zip_ref.extractall(directory_to_extract_to) abs_path = os.path.abspath(checkout_fo...
noahgift/devml
tests/test_mkdata.py
Python
mit
381
from sympy import symbols, trigsimp, sin, cos, pi, diff, sqrt a1, K, L, gv, ga = symbols("a1 K L g_a g_v") a = pi / 2 + K * (L / 2 - a1) r1 = (1 / K + ga * cos(gv * a)) * cos(a) r2 = (1 / K + ga * cos(gv * a)) * sin(a) dr1 = diff(r1, a1) dr2 = diff(r2, a1) n1 = -dr2 / sqrt(dr1**2 + dr2**2) n2 = dr1 / sqrt(dr1**2 + ...
tarashor/vibrations
py/main4.py
Python
mit
389
"""Unit tests for environment.py.""" # standard library import unittest # py3tester coverage target __test_target__ = 'delphi.operations.environment' class FunctionTests(unittest.TestCase): """Tests each function individually.""" def test_is_prod(self): # the value doesn't matter as long as it's a boolean ...
cmu-delphi/operations
tests/test_environment.py
Python
mit
381
INTEGER, PLUS, MINUS, MUL, DIV, LPAREN, RPAREN, EOF = ( 'INTEGER', 'PLUS', 'MINUS', 'MUL', 'DIV', '(', ')', 'EOF' )
Zephyrrus/ubb
YEAR 3/SEM 2/DP/Lab2/Constants.py
Python
mit
120
""" Solution by: Ahmed Dhanani github: ahmeddhanani SO: http://stackoverflow.com/users/5538805/mrpycharm """ import datetime days = { 0 : "Monday", 1 : "Tuesday", 2 : "Wednesday", 3 : "Thursday", 4 : "Friday", 5 : "Saturday", 6 : "Sunday" } def GetSPDay(year): ...
FreddieV4/DailyProgrammerChallenges
Intermediate Challenges/Challenge 0027 Intermediate/solutions/solution.py
Python
mit
938
__version__ = '0.9.0' import time TICK = None TOCK = None MOMENTS = [] def start(): global TICK global TOCK global MOMENTS MOMENTS = [] TOCK = None TICK = time.clock() def tick(label=""): global TICK global TOCK global MOMENTS TOCK = time.clock() MOMENTS.append((label, (T...
built/swisstime
swisstime/__init__.py
Python
mit
632
# -*- coding: UTF-8 -*- ############################################# ## (C)opyright by Dirk Holtwick, 2008 ## ## All rights reserved ## ############################################# import logging import os.path import sys import shutil # import pyxer.gae.monkey.boot as boot import pyxer.util...
tml/pyxer
src/pyxer/create.py
Python
mit
5,873
# Test availability of all UI Elements # import sys,os import numpy as np # # Import the module with the I/O scaffolding of the External Attribute # sys.path.insert(0, os.path.join(sys.path[0], '..')) import extattrib as xa # # These are the attribute parametersas xa # xa.params = { 'Inputs': ['Input_1','Input_2','In...
waynegm/OpendTect-External-Attributes
Python_3/tests/ex_ui_test_all.py
Python
mit
1,182
# 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/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py
Python
mit
84,187
import importlib def install_package(package): if not importlib.find_loader(package): import pip pip.main(["install", package]) # reload site paths so we can later import the package import site importlib.reload(site) def install(): install_package("requests") install_package("psutil") ...
zorbathut/vespid
vespiddeps.py
Python
mit
417
from bertopic._bertopic import BERTopic __version__ = "0.9.4" __all__ = [ "BERTopic", ]
MaartenGr/BERTopic
bertopic/__init__.py
Python
mit
94
#!/usr/bin/env python3 import logging_util # instantiate at module level, not class level # https://stackoverflow.com/questions/22807972/python-best-practice-in-terms-of-logging logger = logging_util.get_logger(__name__) class Fibonacci: """ https://en.wikipedia.org/wiki/Fibonacci_number Uses memoizatio...
beepscore/fibonacci
fibonacci.py
Python
mit
2,879
import os import unittest from nose.tools import assert_true, assert_equal from mock import patch, Mock, MagicMock, call from tests import tmp_repo_path class TestRepo(unittest.TestCase): @patch('dvm.add.shutil') @patch('dvm.repo.git.Repo') def test_init_no_origin(self, MockRepo, MockShutil): wi...
boldfield/dvm
tests/test_repo.py
Python
mit
3,180
from ..AbstractTree import AbstractTree from .Node import Node __author__ = "Luka Avbreht" class AvlTree(AbstractTree): """ Clas that implements Avl tree on top of abstract tree class """ def __init__(self, data=None): self.root = None if data is not None: for i in data: ...
jO-Osko/PSA2
naloge/dn1/tree/LukaAvbreht/AvlTree.py
Python
mit
11,436
# tests/test_tgf.py from io import StringIO import logging import sys import unittest from unittest.mock import patch from nfl.tgf import TeamGameFinder class Pgf_test(unittest.TestCase): ''' Test methods based on https://stackoverflow.com/questions/34500249/ writing-unittest-for-p...
sansbacon/nfl
tests/test_tgf.py
Python
mit
902
# coding=utf-8 import config from vanellope.handlers import pages from vanellope.handlers import apiv1 from vanellope.handlers import admin from vanellope.handlers import feeds routers = [ (r"/welcome", pages.WelcomePage), # Index page (r"/", pages.IndexPage), (r"/snippets", pages.SnippetsPage), ...
qar/vanellope
vanellope/urls.py
Python
mit
1,623
#!/usr/bin/env python # Part of tikplay try: import enum except ImportError: import future.enum as enum import logging from threading import Thread # Because PyCharm does not like the functional enum syntax: # noinspection PyArgumentList TaskState = enum.Enum('TaskState', 'new running ready done exception') ...
tietokilta-saato/tikplay
tikplay/provider/task.py
Python
mit
1,470
from collections import OrderedDict import json from django.conf import settings from django.db import models from django.contrib.auth.models import User from jsonfield import JSONField class ImageVersionDefinition(models.Model): user = models.ForeignKey(User, blank=True, null=True, related_name='image_version_d...
philippbosch/muto-client
muto/models.py
Python
mit
724
""" OrderedDict.py Drop-in for collections.OrderedDict, available in 2.7+ Taken from http://code.activestate.com/recipes/576693/ (r6); license added. Copyright (c) 2009 Raymond Hettinger Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (t...
mickypaganini/SSI2016-jet-clustering
spartyjet-4.0.2_mac/python/spartyjet/gui/OrderedDict.py
Python
mit
4,148
#!/usr/bin/python import commands, time DEBUG = False class SmartDisk(): """ A class to access information on S.M.A.R.T. disks. Usage: (under construction) """ def __init__(self,diskid,sudo): self.sudo="" if (sudo == 1):self.sudo="sudo " self.diskid = diskid self.vars = "-" self.he...
Mausy5043/synodiagd
libsmart.py
Python
mit
2,455
import cherrypy from python_utility.spreadsheet.spreadsheet_service import SpreadsheetService class SpreadsheetWebServer: @staticmethod def main(): SpreadsheetWebServer().run() @staticmethod def run(): cherrypy.config.update({'server.socket_host': '0.0.0.0'}) cherrypy.quickst...
FunTimeCoding/python-utility
python_utility/spreadsheet/spreadsheet_web_server.py
Python
mit
370
#! /usr/bin/env python3 import sys import matplotlib.pyplot as plt import numpy as np import re from mpl_toolkits.axes_grid1 import make_axes_locatable input_file = sys.argv[1] f = open(input_file, 'rb') content = f.read() f.close() numbers = re.findall("\d+", input_file) time = int(numbers[-2])/24 file_info = {}...
schreiberx/sweet
benchmarks_sphere/paper_jrn_jfm_ppeixoto/pp_plot_output_field_bin.py
Python
mit
5,928
# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-10-06 17:45 from __future__ import unicode_literals from django.conf import settings import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependen...
Code4SA/municipal-data
municipal_finance/migrations/0011_auto_20201006_1745.py
Python
mit
2,356
from email.parser import FeedParser import os import pkg_resources import re import sys import shutil import tempfile import zipfile from pip.locations import bin_py, running_under_virtualenv from pip.exceptions import (InstallationError, UninstallationError, BestVersionAlreadyInstalled, ...
domenkozar/pip
pip/req.py
Python
mit
67,732
from distutils.core import setup setup( name='AlertLogic_event_api', version='2.0.1', packages=['alapi'], package_dir={'': 'alapi'}, url='https://github.com/brokensound77/AlertLogic-event-api', license='MIT', author='brokensound77', author_email='justin.s.ibarra@gmail.com', descrip...
brokensound77/AlertLogic-event-api
setup.py
Python
mit
368
# -*- coding: utf-8 -*- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code from ccxt.base.exchange import Exchange from ccxt.base.errors import ExchangeError from ccxt.base.errors import AuthenticationError from cc...
ccxt/ccxt
python/ccxt/btcalpha.py
Python
mit
19,799
# 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/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_managed_clusters_operations.py
Python
mit
63,649
from __future__ import division, print_function, unicode_literals import cv2 import numpy as np NORM_SIZE = (1100, 800) MERGE_SIZE = (700, 530) # ID number field NUM_FIELD = np.array([[450, 210], [920, 270]], dtype='int') NUM_TITLE = np.array([[0, 0], [70, 60]], dtype='int') # Name field NAME_FIELD = np.array([[340, ...
trangnm58/idrec
IdRecDemo/idocr/models.py
Python
mit
4,936
from tests.plugins import PluginTestCase class QlredditPluginTest(PluginTestCase): def create_plugin(self): from plugins.qlreddit import QlredditPlugin return QlredditPlugin(self.bot, self.channel) def test_opa_opa(self): ret = self.reply("askdlj opa opa kajsdl") self.assertE...
anlutro/botologist
tests/plugins/qlreddit_test.py
Python
mit
543
#!/usr/bin/python # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS ...
Vovkasquid/compassApp
alljoyn/build_core/tools/scons/widl.py
Python
mit
4,421
# -*- coding: utf-8 -*- # # complexity documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 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 # autogenerated file. # # ...
lielongxingkong/ics_demo
docs/conf.py
Python
mit
8,107
from django.conf.urls import patterns, url from leaflets.views import (ImageView, LatestLeaflets, LeafletView, LeafletUploadWizzard, skip_inside_allowed, skip_back_allowed, ImageCropView, AllImageView, ImageRotateView, LegacyImageView) from .forms import (FrontPageImageForm, BackPageImageForm, Inside...
JustinWingChungHui/electionleaflets
electionleaflets/apps/leaflets/urls.py
Python
mit
1,476
# # Copyright 2016 Google Inc. # # 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 agreed to in writing...
laffra/simple-serverless
main.py
Python
mit
3,974
# -*- coding: utf-8 -*- import scrapy import json import re from locations.items import GeojsonPointItem WEEKDAYS = { 'po' : 'Mo', 'to' : 'Tu', 'sr' : 'We', 'če' : 'Th', 'pe' : 'Fr', 'so' : 'Sa', 'ne' : 'Su' } class AldiSISpider(scrapy.Spider): name = 'aldi_si' allowed_domains = ['...
iandees/all-the-places
locations/spiders/aldi_si.py
Python
mit
4,071
# # This file is part of Bakefile (http://bakefile.org) # # Copyright (C) 2008-2013 Vaclav Slavik # # 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...
vslavik/bakefile
src/bkl/error.py
Python
mit
7,168
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-08-30 12:45 from __future__ import unicode_literals import datetime from django.conf import settings import django.core.validators from django.db import migrations, models import django.db.models.deletion import mezzanine.core.fields import re class Migratio...
frmwrk123/rpo-website
src/rpocore/migrations/0001_initial.py
Python
mit
9,731
#!/usr/bin/python import sys class Node: def __init__(self, data): self.left = None self.right = None self.data = data def insert_node(self, data): if self.data: if data < self.data: if self.left == None: self.left = Node(data) ...
Rahul91/HT_Binary
binary_tree.py
Python
mit
5,688
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document from frappe.utils.background_jobs import enqueue from frappe.utils import get_url, get_datetime from frappe.desk.form.util...
adityahase/frappe
frappe/workflow/doctype/workflow_action/workflow_action.py
Python
mit
10,357
# -*- coding: utf-8 -*- from dp_tornado.engine.controller import Controller class HttpController(Controller): def post(self): print(self.get_argument('foo')) def get(self): get_url = 'https://httpbin.org/get' post_url = 'https://httpbin.org/post' patch_url = 'https://httpbin...
why2pac/dp-tornado
example/controller/tests/helper/web/http.py
Python
mit
3,596
import random import numpy as np from numba import njit from solving import tech from util import constants as cs SEED = 1234 NWORKERS = 300000 np.random.seed(SEED % 3) def simulate_data(params, val_fn_list): np.random.seed(SEED - 1) (offer_yesno_emp, offer_yesno_unemp, fired, offered_...
mishpat/human-capital-search
simulation/simulate.py
Python
mit
12,914
# 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/network/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/_routes_operations.py
Python
mit
21,274
from __future__ import generators from parserutils import generateLogicalLines, maskStringsAndComments, maskStringsAndRemoveComments import re import os import compiler from bike.transformer.save import resetOutputQueue TABWIDTH = 4 classNameRE = re.compile("^\s*class\s+(\w+)") fnNameRE = re.compile("^\s*def\s+(\w+)"...
srusskih/SublimeBicycleRepair
bike/parsing/fastparserast.py
Python
mit
9,697
# -*- coding: utf-8 -*- from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.sql.expression import func from pwnurl.common.extensions import db class CreatedMixin(object): @declared_attr def created(cls): return db.Column(db.DateTime(timezone=True), default=func.now())
donovan-duplessis/pwnurl
pwnurl/models/mixin/created.py
Python
mit
307
from threading import Thread, Lock import cv2 import socket import numpy as np import pygame import os # alternate video: write raw frames as binary data w/o conversion class VideoReceiver(Thread): """Receives and processes raw video stream from RPi""" def __init__(self, host, fps, screen_size, port = 5001): ...
csauer42/rover
controller/videoreceiver.py
Python
mit
4,195
#!/usr/bin/env python """Conway's Game of Life, drawn to the terminal care of the Blessings lib A board is represented like this:: {(x, y): state, ...} ...where ``state`` is an int from 0..2 representing a color. """ from contextlib import nested from itertools import chain from random import randint from ...
erikrose/conway
bin/conway.py
Python
mit
5,810
# -*- coding: utf-8 -*- from __future__ import unicode_literals from suds.client import Client as SOAPClient from ..vendors import suds_requests from ..vendors.inflection import camelize from ..utils import underscore_keys from ..transactions import accept_txn from .transactions import PxFusionGetTransaction, PxFus...
jthi3rry/dps-pxpy
dps/pxfusion/client.py
Python
mit
5,667
#initial code from https://github.com/confluentinc/confluent-kafka-python from kafka import KafkaConsumer import os consumer= KafkaConsumer('sampletopic', bootstrap_servers=os.environ['KAFKA_ADVERTISED_SERVERS']) for message in consumer: print(message)
boontadata/boontadata-streams
code/pyclient/consume.py
Python
mit
259
""" Safely deal with unicode (utf-8) in csv files removing nasty BOM surprises Based on: http://stackoverflow.com/a/6187936/1084488 Modifications by Matthias Stevens, post here: http://stackoverflow.com/a/34257200/1084488 """ import csv import codecs class UnicodeCsvReader(object): def __init__(self, csv_file, ...
ExCiteS/geokey-sapelli
geokey_sapelli/helper/csv_helpers.py
Python
mit
1,346
import pygame from rinde.data import Resources from rinde.script import rounded_rect class Font: __CACHE = {} @staticmethod def remove_from_cache(resource): del Font.__CACHE[Resources.get_path(resource)] def __init__(self, resource, size): try: self.__pygame_font = self.__load(resource, size) except...
r0jsik/rinde
rinde/stage/node/util/__init__.py
Python
mit
4,332
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'filer_addons.tests.settings') from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
rouxcode/django-filer-addons
manage.py
Python
mit
287
UP = 'w'.encode() DOWN = 's'.encode() LEFT = 'a'.encode() RIGHT = 'd'.encode() ESC = chr(27).encode()
kernelmode/Snake
core/input_constants.py
Python
mit
101
# -*- coding: utf-8; -*- # # @file comment.py # @brief entity comment management # @author Frédéric SCHERMA (INRA UMR1095) # @date 2018-07-06 # @copyright Copyright (c) 2018 INRA/CIRAD # @license MIT (see LICENSE file) # @details import uuid from django.core.exceptions import SuspiciousOperation from django.utils.tra...
coll-gate/collgate
server/descriptor/comment.py
Python
mit
2,600
class Foo1(): pass
github/codeql
python/ql/test/query-tests/Imports/PyCheckerTests/pkg_ok/foo1.py
Python
mit
23
from io_utilities.base_importData import base_importData from io_utilities.base_exportData import base_exportData from sequencing_utilities import gdparse from .genome_annotations import genome_annotations class genome_diff(): def __init__(self,metadata_I=None,mutations_I=None,validation_I=None,evidence_I=None, ...
dmccloskey/sequencing_analysis
sequencing_analysis/genome_diff.py
Python
mit
21,128
from __future__ import unicode_literals import os import textwrap import sys import subprocess from pip_run import scripts def test_pkg_imported(tmpdir): """ Create a script that loads cython and ensure it runs. """ body = textwrap.dedent(""" import path print("Successfully imported path.py") """).lstrip(...
jaraco/rwt
pip_run/tests/test_scripts.py
Python
mit
3,728
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions class User(object): """User class Represents a GPXPlus User Account and the User's browser session.. Ini...
aonbyte/gpxplusbot
src/user.py
Python
mit
2,150
#!/usr/bin/env python """ Summarize ultimate fantasy scores and results. """ from __future__ import print_function import argparse import numpy as np import pandas as pd from usau import markdown, reports def compute_fantasy_picks(captain_multiplier=2, from_csv=False, fantasy_input=None): """Con...
azjps/usau-py
usau/fantasy.py
Python
mit
11,294
from decimal import Decimal from sqlalchemy import exc from sqlalchemy import ForeignKey from sqlalchemy import func from sqlalchemy import inspect from sqlalchemy import Integer from sqlalchemy import LABEL_STYLE_TABLENAME_PLUS_COL from sqlalchemy import literal_column from sqlalchemy import Numeric from sqlalchemy i...
monetate/sqlalchemy
test/ext/test_hybrid.py
Python
mit
37,871
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-16 17:47 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('nnsave_app', '0002_detectedlocation'), ] operations = [ migrations.AlterFiel...
legonigel/nnsave_backend
nnsave_app/migrations/0003_auto_20160416_1747.py
Python
mit
452
''' Application Suite ================= Explore how applications start. Starts applications one after another, waiting for each to be closed first. ''' from __future__ import print_function import sys import re from random import choice import kivy kivy.require('1.8.0') # Minimum API as 1.8 is when kv_directory be...
JohnHowland/kivy
examples/application/app_suite.py
Python
mit
4,491
cases = input() for x in range(cases): n = input() if n%2 or n==0: print n else: print int(bin(n).replace('0b', '')[::-1],2) # Solved 28 July 2015. Easy peasy.. Knowing the python builtins # helps a lot.
geekpradd/Sphere-Online-Judge-Solutions
ec_conb.py
Python
mit
215
#!/usr/bin/env python # Station status constants. DISABLED = 0 ENABLED = 1 class ActiveStationLimit(Exception): """Exception class to throw when active stations > max concurrent stations """ def __init__(self, value): self.value = value def __str__(self): return repr(self.value) cl...
3dinfluence/opensprinklerlib
opensprinklerlib/station.py
Python
mit
4,371
from Expression import * from Utils import * class TupleList(Expression): """ Class representing a list of values in the AST of the MLP """ def __init__(self, values): """ Set the values :param values : [Identifier|NumericExpression|SymbolicExpression] """ ...
rafaellc28/Latex2MiniZinc
latex2minizinc/TupleList.py
Python
mit
2,137
""" URLs for tag related things URLs are: - home - suggest/(query) - delete - rename/(tag) - htmlBlock/(tag) - tag - untag - ~(tag) (named "filter") """ from django.conf.urls import url import tags.views as views urlpatterns = [ url(r'^$', views.home, name="home"), url(r'^suggest/(?P<value>.*)$', view...
RossBrunton/BMAT
tags/urls.py
Python
mit
849
import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.md')).read() requires = [ 'pyramid>=1.0.2', # wsgiref server entry point ] setup(name='pyramid_cachebust', version='0.1.1', description='Nascent cache bust...
maisano/pyramid_cachebust
setup.py
Python
mit
1,175
print "I will now count my chickens:" #napise besedilo print "Hens", 25.0 + 30.0 / 6.0 #napise hens in zracuna koliko jih je print "Roosters", 100 - 25 * 3 % 4 #napise roosters in izracuna koliko jih je print "Now I will count the eggs:" #napise besedilo print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 #izracuna print "Is it tr...
CodeCatz/litterbox
Pija/LearnPythontheHardWay/ex3.py
Python
mit
860
XCKD_COLOR = '#91A2C4' def xkcdify(plt): """ Makes the given graph literally one XKCD :param plt: plot to xkcdify :return: None """ ax = plt.gca() ax.spines['bottom'].set_color(XCKD_COLOR) ax.spines['top'].set_color(XCKD_COLOR) ax.spines['left'].set_color(XCKD_COLOR) ax.spines['...
will-cromar/needy
xkcd.py
Python
mit
482
from .masteryPage import MasteryPage from .mastery import Mastery from .runePage import RunePage from .rune import Rune from .bannedChampion import BannedChampion from .currentGameParticipant import CurrentGameParticipant
TBPixel/RiotApiDevServer
RiotApiDevServer/models/__init__.py
Python
mit
221
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- # nimvelo/stream/__init__.py # Python 2.7 client library for the Nimvelo/Sipcentric API # Copyright (c) 2015 Sipcentric Ltd. Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php import multiprocessing import requests import time import log...
Nimvelo/python-client
nimvelo/stream/__init__.py
Python
mit
2,795
from io import BytesIO import mock from twisted.internet.defer import Deferred, succeed, CancelledError from twisted.internet.protocol import Protocol from twisted.python.failure import Failure from twisted.web.client import Agent from twisted.web.http_headers import Headers from treq.test.util import TestCase, wi...
glyph/treq
treq/test/test_client.py
Python
mit
15,771
import tensorflow as tf import numpy as np import glob from core.Util import calculate_ious from datasets import DataKeys from datasets.Dataset import FileListDataset from datasets.Loader import register_dataset from datasets.util.TrackingGT import load_tracking_gt_mot NAME = "MOT_crop" DEFAULT_PATH = "/globalwork/vo...
VisualComputingInstitute/TrackR-CNN
datasets/MOT/MOT_crop.py
Python
mit
2,858
import itertools import logging import asyncpg import discord from discord.ext import commands from ..utils import db, formats from ..utils.examples import _get_static_example from ..utils.paginator import Paginator class Tag(db.Table, table_name='tags'): name = db.Column(db.Text) content = db.Column(db.Tex...
Ikusaba-san/Chiaki-Nanami
cogs/utility/tags.py
Python
mit
11,869
# coding: utf-8 from tw.api import WidgetsList #from repoze.what.predicates import not_anonymous, in_group, has_permission from tribal.model import * from tribal.model.tag import * from tribal.widgets.components import * __all__ = ['lemmi_search_form'] class LemmiSearchForm(RPACNoForm): fields = [RPACText("or...
LamCiuLoeng/internal
tribal/widgets/lemmi.py
Python
mit
857
# https://oj.leetcode.com/problems/longest-consecutive-sequence/ O(n) class Solution: # @param num, a list of integer # @return an integer def longestConsecutive(self, num): counts = {} longest = 0 for i in num: # ignore duplicate integer if i not in counts: counts[i] = 1 ...
yaoxuanw007/forfun
leetcode/python/longestConsecutiveSequence.py
Python
mit
928
import testGearVid,visionServer from threading import Thread import time if __name__ == '__main__': p1 = Thread(target= testGearVid.realmain,args=()) p1.start() print('blah') p2 = Thread(target= visionServer.realmain,args=()) p2.start() print('hello') p1.join() p2.join()
SachinKonan/Windows-RPI-Vision-Framework
Combined/main.py
Python
mit
307
def ternarySearch(f, left, right, absolutePrecision): #left and right are the current bounds; the maximum is between them if (right - left) < absolutePrecision: return (left + right)/2 leftThird = (2*left + right)/3 rightThird = (left + 2*right)/3 if f(leftThird) > f(rightThird): ...
metabrain/cheatsheet
ternary.py
Python
mit
461