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
#! /usr/bin/python # -*- coding: utf-8 -*- # import funkcí z jiného adresáře import os.path path_to_script = os.path.dirname(os.path.abspath(__file__)) # sys.path.append(os.path.join(path_to_script, "../extern/pyseg_base/src/")) import unittest import numpy as np import os from imtools import qmisc from imtools i...
mjirik/imtools
tests/qmisc_test.py
Python
mit
3,908
from django.contrib import admin from django import forms from django.contrib.auth.models import User from sample.models import (Doctor, Worker, Patient, SpecialtyType, TimeSlot, Case, Comment, CommentGroup, Scan) class searchDoctor(admin.ModelAdmin): list_display = ['user_first_name', 'user_last_name', '...
CSC301H-Fall2013/Ultra-Remote-Medicine
sample/admin.py
Python
mit
1,569
import _plotly_utils.basevalidators class WidthValidator(_plotly_utils.basevalidators.NumberValidator): def __init__(self, plotly_name="width", parent_name="violin", **kwargs): super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_...
plotly/python-api
packages/python/plotly/plotly/validators/violin/_width.py
Python
mit
472
from classifier import Classifier from itertools import combinations from datetime import datetime import sys import os open_path = "PatternDumps/open" closed_path = "PatternDumps/closed" monitored_sites = ["cbsnews.com", "google.com", "nrk.no", "vimeo.com", "wikipedia.org", "youtube.com"] per_burst_weight = 1 total_...
chhans/tor-automation
patternexperiment.py
Python
mit
8,474
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Alloy', fields=[ ('id', models.AutoField(verbos...
thiagolcmelo/segregation
segregation/muraki/migrations/0001_initial.py
Python
mit
3,708
from django import forms from django.conf import settings from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ import urllib2, urllib VERIFY_SERVER="http://api-verify.recaptcha.net/verify" class RecaptchaWidget(forms.Widget): def render(self, name, value, attrs=None): ...
theju/django-comments-apps
recaptcha_comments/fields.py
Python
mit
3,024
#!/usr/bin/python from typing import List """ 31. Next Permutation https://leetcode.com/problems/next-permutation/ """ class Solution: def nextPermutation(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ best = None for i in r...
pisskidney/leetcode
medium/31.py
Python
mit
1,015
from __future__ import print_function import linecache import sys import numpy from six import iteritems from theano import config from theano.compat import OrderedDict, PY3 def simple_extract_stack(f=None, limit=None, skips=[]): """This is traceback.extract_stack from python 2.7 with this change: - Commen...
rizar/attention-lvcsr
libs/Theano/theano/gof/utils.py
Python
mit
14,120
# 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/v2019_11_01/aio/operations/_vpn_link_connections_operations.py
Python
mit
5,986
''' TD_Sequence in class. ''' import numpy as np import pandas as pd import json import pandas.io.data as web from datetime import date, datetime, timedelta from collections import defaultdict class TDSequence(object): def __init__(self, data): self.data = data def sequence(self): setup = s...
kennethcc2005/yahoo_finance_stocks
td_sequence.py
Python
mit
3,188
import sys from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship from sqlalchemy import create_engine Base = declarative_base() class User(Base): """docstring for User""" __tablename__ = 'users' id = Column(I...
Morenito88/full_stack_p5
full_stack_p3/db/setup.py
Python
mit
1,516
from ..base import ShopifyResource class GiftCardAdjustment(ShopifyResource): _prefix_source = "/admin/gift_cards/$gift_card_id/" _plural = "adjustments" _singular = "adjustment"
Shopify/shopify_python_api
shopify/resources/gift_card_adjustment.py
Python
mit
193
#!/usr/bin/python #Master-Thesis dot parsing framework (PING MODULE) #Date: 14.01.2014 #Author: Bruno-Johannes Schuetze #uses python 2.7.6 #uses the djikstra algorithm implemented by David Eppstein #Module does calculations to behave similar to ping, uses delay label defined in the dot file from libraries.dijkstra im...
bschutze/ALTO-framework-sim
Views/ping_.py
Python
mit
611
import _plotly_utils.basevalidators class SmoothingValidator(_plotly_utils.basevalidators.NumberValidator): def __init__( self, plotly_name="smoothing", parent_name="contourcarpet.line", **kwargs ): super(SmoothingValidator, self).__init__( plotly_name=plotly_name, pare...
plotly/plotly.py
packages/python/plotly/plotly/validators/contourcarpet/line/_smoothing.py
Python
mit
505
import sys class outPip(object): def __init__(self, fileDir): self.fileDir = fileDir self.console = sys.stdout def write(self, s): self.console.write(s) with open(self.fileDir, 'a') as f: f.write(s) def flush(self): self.console.flush() new_input = input...
littlecodersh/EasierLife
Scripts/LogInput&Output/py3.py
Python
mit
642
__all__ = ["wordlists", "roles", "bnc", "processes", "verbs", "uktous", "tagtoclass", "queries", "mergetags"] from corpkit.dictionaries.bnc import _get_bnc from corpkit.dictionaries.process_types import processes from corpkit.dictionaries.process_types import verbs from corpkit.dictionaries.roles import ro...
interrogator/corpkit
corpkit/dictionaries/__init__.py
Python
mit
774
class SpellPickerController: def render(self): pass _controller_class = SpellPickerController
battlemidget/conjure-up
conjureup/controllers/spellpicker/tui.py
Python
mit
108
#!/usr/bin/env python # -*- coding: utf-8 -*- """Template""" from os import path import jinja2 from jinja2 import FileSystemLoader, ChoiceLoader from jinja2.exceptions import TemplateNotFound import peanut from peanut.utils import get_resource class SmartLoader(FileSystemLoader): """A smart template loader"""...
zqqf16/Peanut
peanut/template.py
Python
mit
1,770
from optparse import OptionParser import simplejson as json import spotify_client import datatype import datetime import time import calendar import wiki import omni_redis def migrate_v1(path_in, path_out): client = spotify_client.Client() uris = [] with open(path_in, 'rb') as f: for line in f: ...
smershon/omnisonica
omnisonica/clients/migrate.py
Python
mit
2,160
import json from PIL import Image import collections with open('../config/nodes.json') as data_file: nodes = json.load(data_file) # empty fucker ordered_nodes = [None] * len(nodes) # populate fucker for i, pos in nodes.items(): ordered_nodes[int(i)] = [pos['x'], pos['y']] filename = "04_rgb_vertical_lines" i...
Ibuprofen/gizehmoviepy
gif_parsers/read_rgb.py
Python
mit
1,281
# -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class GoogleAppSetup(Document): pass
saurabh6790/google_integration
google_integration/google_connect/doctype/google_app_setup/google_app_setup.py
Python
mit
280
from node import Node from fern.ast.tools import simplify, ItemStream from fern.primitives import Undefined class List(Node): def __init__(self): Node.__init__(self) self.children = [] self.value = None def put(self, thingy): if isinstance(thingy, ItemStream): for it...
andrewf/fern
fern/ast/list.py
Python
mit
1,034
# -*- coding: utf-8 -*- # from __future__ import print_function import warnings import numpy import pytest import sympy from dolfin import ( MPI, Constant, DirichletBC, Expression, FunctionSpace, UnitSquareMesh, errornorm, pi, triangle, ) import helpers import matplotlib.pyplot as...
nschloe/maelstrom
test/test_poisson_order.py
Python
mit
4,993
class Solution(object): def combinationSum(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] """ def recurhelper(nums,res,path,target,start): if target==0: res.append(path) ...
Tanych/CodeTracking
39-Combination-Sum/solution.py
Python
mit
677
#!/usr/bin/env python """Converts the .ics/.ical file into a FullCalendar compatiable JSON file FullCalendar uses a specific JSON format similar to iCalendar format. This script creates a JSON file containing renamed event components. Only the title, description, start/end time, and url data are used. Does not support...
ForTheYin/ical2fullcalendar
ics-convert.py
Python
mit
1,883
from __future__ import absolute_import, unicode_literals from django.core.paginator import Paginator from django.core import urlresolvers from django.utils.html import mark_safe, escape import django_tables2 as tables from django_tables2.tables import Table from django_tables2.utils import Accessor as A, AttributeDic...
naphthalene/hubcave
hubcave/core/mixins/tables.py
Python
mit
4,047
# -*- coding: utf-8 -*- import copy from ruamel.yaml import YAML from six import iteritems _required = ['server'] class Config(object): def __init__(self, configFile): self.configFile = configFile self._configData = {} self.yaml = YAML() self._inBaseConfig = [] def loadConf...
MatthewCox/PyMoronBot
pymoronbot/config.py
Python
mit
4,668
"""Requirements specific to SQLAlchemy's own unit tests. """ from sqlalchemy import util import sys from sqlalchemy.testing.requirements import SuiteRequirements from sqlalchemy.testing import exclusions from sqlalchemy.testing.exclusions import \ skip, \ skip_if,\ only_if,\ only_on,\ fails_...
dstufft/sqlalchemy
test/requirements.py
Python
mit
28,475
from io import StringIO class TOKEN_TYPE: OPERATOR = 0 STRING = 1 NUMBER = 2 BOOLEAN = 3 NULL = 4 class __TOKENIZER_STATE: WHITESPACE = 0 INTEGER_0 = 1 INTEGER_SIGN = 2 INTEGER = 3 INTEGER_EXP = 4 INTEGER_EXP_0 = 5 FLOATING_POINT_0 = 6 FLOATING_POINT = 8 STRIN...
danielyule/naya
naya/json.py
Python
mit
24,396
# ============================================================================ # FILE: member.py # AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com> # License: MIT license # ============================================================================ from .base import Base import re from deoplete.util import ( ...
killuazhu/vimrc
sources_non_forked/deoplete.nvim/rplugin/python3/deoplete/source/member.py
Python
mit
2,077
# -*- coding: utf-8 -*- from __future__ import print_function import sys import time import numpy as np from pyqtgraph import PlotWindow from six.moves import zip sys.path.append('../../util') sys.path.append('../..') from .nidaq import NiDAQ from pyqtgraph.functions import mkPen, mkColor pw = PlotWindow() time....
acq4/acq4
acq4/devices/NiDAQ/resample_test.py
Python
mit
4,804
__author__ = 'Exter, 0xBADDCAFE' import wx class FTDropTarget(wx.DropTarget): """ Implements drop target functionality to receive files and text receiver - any WX class that can bind to events evt - class that comes from wx.lib.newevent.NewCommandEvent call class variable ID_DROP_FILE class...
exter/pycover
droptarget.py
Python
mit
1,525
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'test', } } ROOT_URLCONF = 'urls' SITE_ID = 1 INSTALLED_APPS = ( 'django.contrib.contenttypes', 'django.contrib.auth', 'django.contrib.sess...
GermanoGuerrini/django-featurette
tests/settings.py
Python
mit
597
"""Test energy_profiler module.""" import unittest from physalia.energy_profiler import AndroidUseCase # pylint: disable=missing-docstring class TestEnergyProfiler(unittest.TestCase): def test_empty_android_use_case(self): # pylint: disable=no-self-use use_case = AndroidUseCase( nam...
TQRG/physalia
physalia/tests/test_energy_profiler.py
Python
mit
534
def fib(): a, b = 1, 1 while True: yield b a, b = b, a + b def pares(seq): for n in seq: if n % 2 == 0: yield n def menores_4M(seq): for n in seq: if n > 4000000: break yield n print (sum(pares(menores_4M(fib()))))
renebentes/Python4Zumbis
Materiais/Ultima Semana/euler 02.py
Python
mit
285
from core.rule_core import * from core import yapi from core.config_loader import cur_conf class YunoModule: name = "ores" cfg_ver = None ores_api = yapi.ORES config = [ { "models": { "damaging": {"max_false": 0.15, "min_true": 0.8}, "goodfaith": ...
4shadoww/stabilizerbot
core/rules/ores.py
Python
mit
2,595
#!/usr/bin/env python3 #!coding=utf-8 from .record import Record,RecordSet,QueryValue from .heysqlware import *
mu2019/heysqlware
heysqlware/__init__.py
Python
mit
113
import pytz from pendulum import _safe_timezone from pendulum.tz.timezone import Timezone def test_safe_timezone_with_tzinfo_objects(): tz = _safe_timezone(pytz.timezone("Europe/Paris")) assert isinstance(tz, Timezone) assert "Europe/Paris" == tz.name
sdispater/pendulum
tests/test_main.py
Python
mit
268
sandwich_orders = ['Bacon','Bacon, egg and cheese','Bagel toast','pastrami','pastrami','pastrami'] print ('pastrami sandwich was sold out') finished_sandwiches = [] while 'pastrami' in sandwich_orders: sandwich_orders.remove('pastrami') print(sandwich_orders)
lluxury/pcc_exercise
07/pastrami.py
Python
mit
265
# -*- coding: utf-8 -*- import pytest from parglare import Parser, Grammar from parglare.exceptions import GrammarError, ParseError, RRConflicts def test_repeatable_zero_or_more(): """ Tests zero or more repeatable operator. """ grammar = """ S: "2" b* "3"; terminals b: "1"; """ ...
igordejanovic/parglare
tests/func/grammar/test_repeatable.py
Python
mit
4,615
# -*- coding: utf-8 -*- """CMS view for static pages""" from django.contrib import messages from django.contrib.auth.decorators import login_required from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ from boski.mixins impor...
Alkemic/webpage
module/static_page/cms/views.py
Python
mit
5,262
import random from authorize import Customer, Transaction from authorize import AuthorizeResponseError from datetime import date from nose.plugins.attrib import attr from unittest import TestCase FULL_CUSTOMER = { 'email': 'vincent@vincentcatalano.com', 'description': 'Cool web developer guy', 'customer...
vcatalano/py-authorize
tests/test_live_customer.py
Python
mit
3,018
try: from collections import defaultdict except: class defaultdict(dict): def __init__(self, default_factory=None, *a, **kw): if (default_factory is not None and not hasattr(default_factory, '__call__')): raise TypeError('first argument must be callable') ...
ActiveState/code
recipes/Python/523034_emulate_collectionsdefaultdict/recipe-523034.py
Python
mit
1,492
# -*- coding: utf-8 -*- ############################################################# # 1. Imports ############################################################# import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit ############################################################# # 2. ...
nyuphys/DataMaster
example/lab.py
Python
mit
2,511
from bson import ObjectId from . import repeating_schedule from state_change import StateChange class StateChangeRepeating(StateChange): def __init__(self, seconds_into_week, AC_target, heater_target, fan, id=None): self.id = id self.seconds_into_week = seconds_into_week self.AC_target =...
IAPark/PITherm
src/shared/models/Mongo/state_change_repeating.py
Python
mit
2,592
import os, sys import datetime from glob import glob import json import numpy as np import pandas from skimage.morphology import binary_erosion from nitime.timeseries import TimeSeries from nitime.analysis import SpectralAnalyzer, FilterAnalyzer import nibabel import nipype.interfaces.spm as spm from nipype.interfac...
klarnemann/jagust_rsfmri
rsfmri/utils.py
Python
mit
19,059
from .resnet_preact import resnet18_preact from .resnet_preact_bin import resnet18_preact_bin import torch, torch.nn as nn _model_factory = { "resnet18_preact":resnet18_preact, "resnet18_preact_bin":resnet18_preact_bin } class Classifier(torch.nn.Module): def __init__(self, feat_extractor,num_classes=None)...
sankit1/cv-tricks.com
xnornet_plusplus/models/__init__.py
Python
mit
774
from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * from OpenGL.GLUT.freeglut import * import GlutWrapper import math ESCAPE = b'\033' class GlutViewController(GlutWrapper.GlutWrapper): """docstring for GlutViewController""" def __init__(self): super(GlutViewController, self)._...
kosystem/PythonGlutWrapper
GlutViewController.py
Python
mit
2,389
#!/usr/bin/env python3 # process.py # This script consists of all core functions. # Author: Orhan Odabasi (0rh.odabasi[at]gmail.com) import locale import csv import os from PIL import Image import re from collections import Counter def scanDir(path): # scan the path and collect media data for copy process wh...
OrhanOdabasi/PixPack
pixpack/process.py
Python
mit
3,262
''' Wrap some important functions in sqlite3 so we can instrument them. ''' from xrayvision.monkeypatch import mark_patched, is_patched _old_connect = sqlite3.connect def patch(module): module
mathom/xrayvision
xrayvision/patches/sqlite3/__init__.py
Python
mit
202
from lxml import etree import os from BeautifulSoup import BeautifulSoup from itertools import chain def replacements(text): text = text.replace('&gt;', '\\textgreater ') text = text.replace('&lt;', '\\textless ') text = text.replace('&', '\&') text = text.replace('_', '\_') text = text.replace('%'...
vijeshm/eezyReport
eezyReport.py
Python
mit
16,797
import pytest from mock import Mock from sigopt.orchestrate.services.aws_provider_bag import AwsProviderServiceBag class TestOrchestrateServiceBag(object): @pytest.fixture def orchestrate_services(self): return Mock() def test_orchestrate_service_bag(self, orchestrate_services): services = AwsProvider...
sigopt/sigopt-python
test/orchestrate/services/aws_provider_bag_test.py
Python
mit
1,060
fa_icons = { 'fa-glass': u"\uf000", 'fa-music': u"\uf001", 'fa-search': u"\uf002", 'fa-envelope-o': u"\uf003", 'fa-heart': u"\uf004", 'fa-star': u"\uf005", 'fa-star-o': u"\uf006", 'fa-user': u"\uf007", 'fa-film': u"\uf008", 'fa-th-large': u"\uf009", 'fa-th': u"\uf00a", 'f...
Kovak/KivyNBT
flat_kivy/fa_icon_definitions.py
Python
mit
15,461
#!/usr/bin/env python3 """*.h5 の値の最小・最大などを確認するスクリプト。""" import argparse import pathlib import sys import h5py import numpy as np try: import pytoolkit as tk except ImportError: sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent.parent)) import pytoolkit as tk logger = tk.log.get(__name...
ak110/pytoolkit
pytoolkit/bin/h5ls.py
Python
mit
1,745
# -*- coding: utf-8 -*- from __future__ import absolute_import import theano import theano.tensor as T from theano.tensor.signal import downsample from .. import activations, initializations from ..utils.theano_utils import shared_zeros from ..layers.core import Layer class Convolution1D(Layer): def __init__(se...
stonebig/keras
keras/layers/convolutional.py
Python
mit
5,924
import os import sys import time import subprocess import yaml import pathlib class ClusterLauncher: def __init__(self, config_yaml): self.Config = config_yaml def Launch(self): #read config with open(self.Config, 'r') as yf: config = yaml.safe_load(yf) #launch...
livingenvironmentslab/UniCAVE
Python-Cluster-Launcher/ClusterLauncher.py
Python
mit
1,680
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from django import forms from django.conf import settings from django.forms.utils import ValidationError from os import chmod import hashlib from io import BytesIO try: import pyclamd except Exception: pass class yatsFileField(form...
mediafactory/yats
modules/yats/fields.py
Python
mit
2,574
import click import os import penguin.pdf as pdf import penguin.utils as utils def check_src(src): if not all((map(utils.is_valid_source, src))): raise click.BadParameter("src arguments must be either a valid directory" " or pdf file.") @click.group() def penguin(): ...
zrluety/penguin
penguin/scripts/penguin_cli.py
Python
mit
1,738
import math def even_numbers_only(thelist): ''' Returns a list of even numbers in thelist ''' return [x for x in thelist if x%2 == 0] def is_perfect_square(x): ''' Returns True if x is a perfect square, False otherwise ''' thesqrt = int(math.sqrt(x)) return thesqrt * thesqrt == x
joequery/joequery.me
joequery/blog/posts/code/python-builtin-functions/simple_functions.py
Python
mit
319
from __future__ import print_function import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.contrib import rnn import time from datetime import timedelta # Import MNIST data import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/t...
torn2537/AnimationJava
LSTM2.py
Python
mit
3,840
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # References: # [1] Jean-Luc Starck, Fionn Murtagh & Jalal M. Fadili # Sparse Image and Signal Processing: Wavelets, Curvelets, Morphological Diversity # Section 3.5, 6.6 # # Credits: # [1] https://github.com/abrazhe/image-funcut/blob/master/imfun/atrous.py # # A...
liweitianux/atoolbox
python/msvst_starlet.py
Python
mit
23,422
def subtrees_equal(expected_schema_node, actual_node): if expected_schema_node[0] != actual_node.get_name(): return False if expected_schema_node[1] != actual_node.get_state(): return False expected_children = expected_schema_node[2] actual_children = actual_node.get_children() actual_children_names = [child.g...
mkobos/tree_crawler
concurrent_tree_crawler/test/subtrees_comparer.py
Python
mit
650
# -*- coding: utf-8 -*- import sys import string from datetime import datetime,timedelta import calendar import csv import re # ファイルオープン(fpは引数でログファイル,wfpは書き出すcsvファイルを指定) fp = open(sys.argv[1],'r') # logがローテートするタイミングが1日の間にある場合,/var/log/kern.logと/var/log/kern.log.1の両方を読み込む必要があるかもしれない wfp = open('/path/to/program/csv_dat...
High-Hill/bachelor_dap_gw
program/log_formatting.py
Python
mit
2,502
''' Precondition successfully pass a users test. ''' from datetime import datetime, timedelta import time import pytest import requests from kii import AccountType, exceptions as exc, results as rs from kii.data import BucketType, clauses as cl from tests.conf import ( get_env, get_api_with_test_user, ...
ta2xeo/python3-kii
tests/test_data/application/test_application_scope_data.py
Python
mit
13,511
import inspect from functools import total_ordering def yield_once(iterator): """ Decorator to make an iterator yield each result only once. :param iterator: Any iterator :return: An iterator that yields every result only once at most. """ def yield_once_generator(*args, **kwargs): ...
Adrianzatreanu/coala-decorators
coala_decorators/decorators.py
Python
mit
11,053
def count_inversion(sequence): flag, answer, sequence = True, 0, list(sequence) while flag: flag = False for i in xrange(1, len(sequence)): if sequence[i-1] > sequence[i]: sequence[i], sequence[i-1] = sequence[i-1], sequence[i] answer += 1 ...
denisbalyko/checkio-solution
count-inversions.py
Python
mit
619
from datetime import datetime from .base import BaseModel class Comment(BaseModel): def __init__(self, **kwargs): # Add created and updated attrs by default. self.created = self.updated = datetime.now() super().__init__(**kwargs) def update(self): """ Extends update method to...
oldani/nanodegree-blog
app/models/comment.py
Python
mit
422
# -*- coding: utf-8 -*- import json import httplib2 import sys import codecs sys.stdout = codecs.getwriter('utf8')(sys.stdout) sys.stderr = codecs.getwriter('utf8')(sys.stderr) foursquare_client_id = 'SMQNYZFVCIOYIRAIXND2D5SYBLQUOPDB4HZTV13TT22AGACD' foursquare_client_secret = 'IHBS4VBHYWJL53NLIY2HSVI5A1144GJ3MDTYYY1...
tuanvu216/udacity-course
designing-restful-apis/Lesson_3/06_Adding Features to your Mashup/Starter Code/findARestaurant.py
Python
mit
3,690
# coding=utf-8 """ This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import Li...
angadpc/Alexa-Project-
twilio/rest/api/v2010/account/usage/record/all_time.py
Python
mit
15,320
from flask.ext.wtf import Form from wtforms import IntegerField, StringField, FieldList from wtforms.validators import DataRequired, Email, ValidationError def word_length(limit=None, message=None): message = message or 'Must not be more than %d words' message = message % limit def _length(form, field): ...
mtekel/digitalmarketplace-supplier-frontend
app/main/forms/suppliers.py
Python
mit
1,562
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="icicle.outsidetextfont", **kwargs ): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=p...
plotly/plotly.py
packages/python/plotly/plotly/validators/icicle/outsidetextfont/_color.py
Python
mit
469
from . import tree class Node: def __init__(self, container, parent, value=None): self._node = tree.Node(container, parent, value) @property def _container(self): return self._node._container @property def id(self): return self._node.id @property def value(self):...
alviproject/alvi
alvi/client/containers/binary_tree.py
Python
mit
2,017
# imports import h2o import numpy as np import pandas as pd from h2o.estimators.gbm import H2OGradientBoostingEstimator from h2o.estimators.random_forest import H2ORandomForestEstimator from h2o.grid.grid_search import H2OGridSearch import sys from operator import add from pyspark import SparkContext from pyspark.sql...
kcrandall/Kaggle_Mercedes_Manufacturing
spark/experiements/reza/random_forest.py
Python
mit
5,051
import sys import ctypes def popcount(N): if sys.platform.startswith('linux'): libc = ctypes.cdll.LoadLibrary('libc.so.6') return libc.__sched_cpucount(ctypes.sizeof(ctypes.c_long), (ctypes.c_long * 1)(N)) elif sys.platform == 'darwin': libc = ctypes.cdll.LoadLibrary('libSystem.dylib')...
knuu/competitive-programming
atcoder/dp/edu_dp_o.py
Python
mit
818
class Solution(object): def letterCombinations(self, digits): """ :type digits: str :rtype: List[str] """ def fill(n): if n == l: result.append(''.join(combination)) return for cs in ds[digits[n]]: for c ...
grehujt/leetcode
17. Letter Combinations of a Phone Number/solution.py
Python
mit
707
import unittest from numpy import arange, linspace from numpy.random import seed from src.bases.root import Root from src.examples.example_setups import setup_stat_scm from src.utils.sem_utils.toy_sems import StationaryDependentSEM as StatSEM from src.utils.sequential_intervention_functions import get_interventional_g...
neildhir/DCBO
tests/test_root.py
Python
mit
5,136
# Copyright (c) 2016 Niklas Rosenstein # # 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, ...
NiklasRosenstein/flux
flux/utils.py
Python
mit
16,462
import hmac import json import urllib.parse import subprocess from .main import ( PullReqState, parse_commands, db_query, INTERRUPTED_BY_HOMU_RE, synchronize, ) from . import utils from . import gitlab from .utils import lazy_debug import jinja2 import requests import pkg_resources from bottle impor...
coldnight/homu
homu/server.py
Python
mit
27,593
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_python_2d_ns ---------------------------------- Tests for `python_2d_ns` module. """ import sys import unittest from python_2d_ns.python_2d_ns import * class TestPython_2d_ns(unittest.TestCase): #test x, y coordinates generated by function IC_coor ...
xinbian/2dns
tests/test_python_2d_ns.py
Python
mit
2,191
#!/usr/bin/python # -*- coding: utf-8 -*- # см. также http://habrahabr.ru/post/135863/ # "Как написать дополнение для GIMP на языке Python" # Импортируем необходимые модули from gimpfu import * ## fix def bdfix(image, drawable, w0, c0, w1, c1): # for Undo pdb.gimp_context_push() pdb.gimp_image_undo_group_start(...
werkzeuge/gimp-plugins-simplest
bdfix.py
Python
mit
2,693
# coding:utf-8 """ Django settings for turbo project. Generated by 'django-admin startproject' using Django 1.11.1. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ "...
giliam/turbo-songwriter
backend/turbosettings/settings.py
Python
mit
4,924
from distutils.core import Extension from collections import defaultdict def get_extensions(): import numpy as np exts = [] # malloc mac_incl_path = "/usr/include/malloc" cfg = defaultdict(list) cfg['include_dirs'].append(np.get_include()) cfg['include_dirs'].append(mac_incl_path) c...
adrn/gala
gala/integrate/setup_package.py
Python
mit
1,672
# -*- coding: utf-8 -*- # Copyright (c) 2021, Frappe Technologies and contributors # For license information, please see license.txt # import frappe from frappe.model.document import Document class WorkspaceShortcut(Document): pass
mhbu50/frappe
frappe/desk/doctype/workspace_shortcut/workspace_shortcut.py
Python
mit
235
N = int(input()) ans = [0] * N for i in range(0, N, 5): q = [0] * N for j in range(i, min(N, i + 5)): q[j] = 10 ** (j - i) print('? {}'.format(' '.join(map(str, q))), flush=True) S = str(int(input().strip()) - sum(q) * 7)[::-1] for j in range(i, min(N, i + 5)): ans[j] = (int(S[j - i]...
knuu/competitive-programming
atcoder/corp/codethanksfes2017_e.py
Python
mit
389
import glob import json from os.path import basename, dirname, realpath from BeautifulSoup import BeautifulSoup from flask import Response, request, render_template, send_from_directory from annotaria import app from store import Store app.config.from_object(__name__) # Load default config and override config from an...
ciromattia/annotaria
annotaria/views.py
Python
mit
5,625
import curses from cursesmenu import clear_terminal from cursesmenu.items import MenuItem class ExternalItem(MenuItem): """ A base class for items that need to do stuff on the console outside of curses mode. Sets the terminal back to standard mode until the action is done. Should probably be subclass...
mholgatem/GPIOnext
cursesmenu/items/external_item.py
Python
mit
1,040
from .voxel_dir import task_dir, storage_dir, image_dir
andyneff/voxel-globe
voxel_globe/tools/__init__.py
Python
mit
55
""" Contains a few template tags relating to autotags Specifically, the autotag tag itself, and the filters epoch and cstag. """ from django import template from django.core.urlresolvers import reverse from django.utils.safestring import mark_safe from tags.models import Tag import datetime import calendar import t...
RossBrunton/BMAT
autotags/templatetags/autotag.py
Python
mit
1,478
# -*- coding: utf-8 -*- import os from .. import OratorTestCase from . import IntegrationTestCase class MySQLIntegrationTestCase(IntegrationTestCase, OratorTestCase): @classmethod def get_manager_config(cls): ci = os.environ.get("CI", False) if ci: database = "orator_test" ...
sdispater/orator
tests/integrations/test_mysql.py
Python
mit
764
#!/Users/Drake/dev/LouderDev/louderdev/bin/python3 # # The Python Imaging Library # $Id$ # # split an animation into a number of frame files # from __future__ import print_function from PIL import Image import os import sys class Interval(object): def __init__(self, interval="0"): self.setinterval(int...
drakeloud/louderdev
louderdev/bin/explode.py
Python
mit
2,470
import json, random, time, sys """ Creating a random JSON object based on lists of info and random numbers to assign the index """ ##Directory input_file = "test.json" ###Success message takes the file_name and operation type (ie. written, closed) def process_message(outcome, file_name, operation_type): print "**...
bdeangelis/call_man_bat
static/frontend/jsonmaking.py
Python
mit
6,080
#!/usr/bin/python3 import tkinter import PIL.Image import PIL.ImageTk from tkinter.ttk import Progressbar as pbar from PyFont import Font, SVG class TkFont(): CHARY = 200 CHARX = 50 LINEY = CHARY / 2 MAIN_COLOR = '#FFFFFF' def set_label(self): tmp = self.words[-1].export_png_to_str() ...
chichaj/PyFont
PyFont/FontRuntime.py
Python
mit
5,128
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('computing', '0004_auto_20141127_1425'), ] operations = [ migrations.CreateModel( name='Subnet', fiel...
tamasgal/rlogbook
rlogbook/computing/migrations/0005_auto_20141127_1436.py
Python
mit
1,018
# https://www.w3resource.com/python-exercises/ # 1. Write a Python program to print the following string in a specific format (see the output). # Sample String : "Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond # in the sky. Twinkle, twinkle, little star, How I wonde...
dadavidson/Python_Lab
Python-w3resource/Python_Basic/ex01.py
Python
mit
715
"""Test the print-to-python-file module This just uses the simpleparsegrammar declaration, which is parsed, then linearised, then loaded as a Python module. """ import os, unittest import test_grammarparser testModuleFile = 'test_printers_garbage.py' class PrintersTests(test_grammarparser.SimpleParseGrammarTests): ...
alexus37/AugmentedRealityChess
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/simpleparse/tests/test_printers.py
Python
mit
1,186
import numpy as np import pytest from nilabels.tools.image_colors_manipulations.relabeller import relabeller, permute_labels, erase_labels, \ assign_all_other_labels_the_same_value, keep_only_one_label, relabel_half_side_one_label def test_relabeller_basic(): data = np.array(range(10)).reshape(2, 5) rela...
SebastianoF/LabelsManager
tests/tools/test_image_colors_manip_relabeller.py
Python
mit
6,757
# Problem: Search for a Range # # Given a sorted array of integers, find the starting and ending position of a given target value. # # Your algorithm's runtime complexity must be in the order of O(log n). # # If the target is not found in the array, return [-1, -1]. # # For example, # # Given [5, 7, 7, 8, 8, 10] and ta...
samlaudev/LeetCode
Python/Search for a Range/Solution.py
Python
mit
1,176
#!/usr/bin/env python # -*- coding: UTF-8 -*- ''' plot the results from the files igraph_degree_assort_study and degree_assortativity ''' from igraph import * import os import numpy as np import matplotlib.pyplot as plt ######################### IN_DIR = '/home/sscepano/Projects7s/Twitter-workspace/ALL_SR' img_out_pl...
sanja7s/SR_Twitter
src_graph/plot_degree_assortativity.py
Python
mit
1,447
import shelve """ Currently unused. All mysql queries are now done via IomDataModels. May be resurrected to help with shelve and pickles """ from USCProjectDAOs import IOMProjectDAO class IOMService(IOMProjectDAO): """ This handles interactions with the IOM data database and storage files. All user appl...
PainNarrativesLab/IOMNarratives
IOMDataService.py
Python
mit
5,350
# TODO: direction list operator? from direction import Direction, Pivot from charcoaltoken import CharcoalToken as CT from unicodegrammars import UnicodeGrammars from wolfram import ( String, Rule, DelayedRule, Span, Repeated, RepeatedNull, PatternTest, Number, Expression ) import re from math import floor, ce...
somebody1234/Charcoal
interpreterprocessor.py
Python
mit
34,121