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
import pytest from hangups import channel @pytest.mark.parametrize('input_,expected', [ (b'79\n[[0,["c","98803CAAD92268E8","",8]\n]\n,[1,[{"gsid":"7tCoFHumSL-IT6BHpCaxLA"}]]\n]\n', ('98803CAAD92268E8', '7tCoFHumSL-IT6BHpCaxLA') ), ]) def test_parse_sid_response(input_, expected): assert channel._par...
j16sdiz/hangups
hangups/test/test_channel.py
Python
mit
2,184
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Destaque', fields=[ ('id', models.AutoField(ver...
pydawan/protetores_bucais
protetores_bucais/apps/destaques/migrations/0001_initial.py
Python
mit
843
# -*- coding: utf8 -*- # Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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...
tzpBingo/github-trending
codespace/python/tencentcloud/sqlserver/v20180328/models.py
Python
mit
284,748
import csv from subprocess import call# from datetime import datetime#Importing various libraries call(["color","F9"], shell=True)# call(["cls"], shell = True)#Setting colour for shell import sys, time# import time#More libraries prog=True#creating variable prog and assigning it as true time.sleep(1)# def typi...
husky-prophet/personal-backup
PRETEND assessment/PRETEND assessment csv.py
Python
mit
4,661
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-12-02 05:08 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('tournament', '0001_initial'), ] operations = [ ...
AfricaChess/lichesshub
tournament/migrations/0002_auto_20171202_0508.py
Python
mit
550
# -*- coding: utf-8 -*- """ Created on Mon Jun 26 16:43:46 2017 @author: DWyatt """ import pandas as pd import seaborn as sns import os import matplotlib.pyplot as plt df_train = pd.read_csv('train.csv') target = 'SalePrice' variables = [str(column) for column in df_train.columns if column!=target] dir1 = os.getcwd(...
BenChehade/datasciences
chart - sales price vs variables/generate_charts.py
Python
mit
724
#!/usr/bin/env python from itertools import count import doctest def delete_range(lines, r=None): """ >>> a = list(range(10)) >>> delete_range(a, (1, 3)) [0, 4, 5, 6, 7, 8, 9] """ r = r or (0, len(lines)) return replace_range(lines, [], (r[0], r[1] + 1)) def insert_range(lines, new_lines...
hughdbrown/sed
sed/engine/sed_util.py
Python
mit
3,112
from datetime import datetime from html.parser import HTMLParser from django.core.management.base import BaseCommand, CommandError from django.db.utils import IntegrityError from django.utils import timezone from bookmarks.models import Bookmark def unixtime2datetime(t): dt = datetime.fromtimestamp(int(t)) re...
hnakamur/django-bootstrap-table-example
project/bookmarks/management/commands/import_bookmarks.py
Python
mit
1,584
""" Core ==== AudioSignals ------------ .. autoclass:: nussl.core.AudioSignal :members: :autosummary: Masks ----- .. automodule:: nussl.core.masks :members: :autosummary: Constants ------------ .. automodule:: nussl.core.constants :members: :autosummary: External File Zoo ----------------- ....
interactiveaudiolab/nussl
nussl/core/__init__.py
Python
mit
1,293
from django.test import TestCase from api.helpers import user_service from api.factories import UserFactory, PostFactory class UserServiceTest(TestCase): POSTS_PER_USER = 10 def setUp(self): self.main_user = UserFactory() self.follower = UserFactory() self.test_user = UserFactory() ...
frostblooded/kanq
api/tests/test_user_service.py
Python
mit
1,237
#!/usr/bin/env python # encoding: utf-8 from __future__ import unicode_literals from pprint import pformat from marrow.server.http import HTTPServer from marrow.wsgi.objects.decorator import wsgify @wsgify def hello(request): resp = request.response resp.mime = "text/plain" resp.body = "%r\n\n%s\n\n%s"...
marrow/wsgi.objects
examples/wsgify.py
Python
mit
521
from ebooklib import epub from bs4 import BeautifulSoup from nltk.tokenize import RegexpTokenizer from langtools.translator.TextTranslation import TextTranslation class EPUB(object): """docstring for EPUB""" def __init__(self, book_location): book = epub.read_epub(book_location) # Filter out...
peterFran/LanguageListCreator
langtools/translator/EPUBTranslation.py
Python
mit
1,136
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy "sample spider" class DmozItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() title = scrapy.Field() ...
Jetpie/web-scraper
commercial_web_navigation/commercial_web_navigation/items.py
Python
mit
429
from flask import jsonify, request from common.config import read_pre_flight from common.models.client import Client from common.models.command import Command from common.models.output import Output from web.api import api ALL_GOOD = 200 CLIENT_NOT_FOUND = 402 BAD_COMMAND_ID = 403 NO_COMMANDS_FOR_YOU = 404 COMMAND_IS...
Den1al/JSShell
web/api/routes.py
Python
mit
1,982
import py from rpython.rtyper.lltypesystem import lltype, llmemory, llarena from rpython.memory.gc.incminimark import IncrementalMiniMarkGC, WORD from test_direct import BaseDirectGCTest T = lltype.GcForwardReference() T.become(lltype.GcStruct('pinning_test_struct2', ('someInt', lltype.Signed)...
jptomo/rpython-lang-scheme
rpython/memory/gc/test/test_object_pinning.py
Python
mit
38,271
from django.db import models from credit_computing_machine.models import TimestampModel from privateurl.models import PrivateUrl from django.db.models.signals import pre_save from django.dispatch import receiver # Create your models here. class CreditManager(models.Manager): def get_credit_all_user(self, credit_g...
duahimanshu100/credit_computing_machine
credit_computing_machine/app/models.py
Python
mit
3,284
#!/usr/bin/env python3 # Copyright (c) 2014-2015 The Bitcoin Core developers # Copyright (c) 2015-2016 The Bitcoin Unlimited developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Base class for RPC testing # Add python-bit...
marlengit/BitcoinUnlimited
qa/rpc-tests/test_framework/test_framework.py
Python
mit
9,681
#!/usr/bin/python2 # -*- coding: utf-8 -*- import time import datetime import inspect import simplejson as json def outnode(data): """Outnode""" a = int(data[2]) b = int(data[3]) c = int(data[4]) d = int(data[5]) e = int(data[6]) f = int(data[7]) g = int(data[8]) ...
artekw/sensmon
sensnode/decoders/outnode.py
Python
mit
761
import os maindir = os.path.join(os.path.dirname(__file__), os.pardir,"models") duckMODEL = os.path.join(maindir, "duck", "duck.3DS") dwarfMODEL = os.path.join(maindir, 'dwarf', "dwarf.x") tubeMODEL = os.path.join(maindir, 'cil', 'cil.x') triangleMODEL = os.path.join(maindir, 'triangle', 'triangle.x')
jr-garcia/Engendro3D
Demos/_base/_model_paths.py
Python
mit
305
""" So we gonna need a way to check quest progress. This might be as simple as checking if Admiral has a Ship or we might have to check if he completed 1-1 4 times while jumping in one leg I have no idea. At first I intended to write a simple function for each Quest, but the Admiral can activate and deactivate stuff a...
KanColleTool/kcsrv
kancolle/__init__.py
Python
mit
564
SECRET_KEY = 'fake-key' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', "testfixtures.tests.test_django", ] DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}} DEFAULT_AUTO_FIELD='django.db.models.AutoField'
Simplistix/testfixtures
testfixtures/tests/test_django/settings.py
Python
mit
261
from django.contrib import admin from challenges.models import * class WriteUpAdmin(admin.ModelAdmin): list_display = ('author', 'challenge', 'date_writeup') class ChallengeAdmin(admin.ModelAdmin): list_display = ('name', 'category', 'score', 'flag') admin.site.register(CategoryChallenge) admin.site.registe...
piratos/ctfbulletin
challenges/admin.py
Python
mit
423
# -*- coding: utf-8 -*- """ Created on Sun Apr 23 11:27:24 2017 @author: hd_mysky """ import pymongo as mongo import pandas as pd import os from transform import harmonize_data BASE_DIR = os.path.dirname(__file__) #获取当前文件的父目录绝对路径 file_path = os.path.join(BASE_DIR,'dataset','source_simple.csv') conn = mongo.MongoCl...
hdmy/LagouSpider
dataMining/train_data.py
Python
mit
756
#!/usr/bin/env python2 from __future__ import print_function from collections import defaultdict import uuid class Room(object): def __init__(self): self.name = None self.users = {} self.expansions = [0] # 0 -> Base class User(object): def __init__(self, handle, trip=None, first=False): self.uuid = uuid.u...
sysr-q/fah
fah/room.py
Python
mit
759
from __future__ import absolute_import, unicode_literals, print_function, division import tempfile import re import os import codecs import sublime import sublime_plugin from . import git_root, GitTextCommand def temp_file(view, key): if not view.settings().get('git_annotation_temp_%s' % key, False): fd...
kemayo/sublime-text-git
git/annotate.py
Python
mit
7,837
from Queue import Queue, Empty import contextlib from logging import getLogger import random import time from gevent.monkey import saved LOG = getLogger(__name__) if bool(saved): LOG.info('using zmq.green...') import zmq.green as zmq else: import zmq class ZMQConnection(object): def __init__(self...
Livefyre/protobuf-rpc
python/protobuf_rpc/connection.py
Python
mit
3,673
# -*- coding: utf-8 -*- import hashlib from lxml import etree from Crypto.Cipher import AES import base64 import time import traceback import re import sys import random reload(sys) sys.setdefaultencoding("utf8") if __name__ == '__main__': import sys sys.path.append('../..') sys.path.appe...
Svolcano/python_exercise
dianhua/worker/crawler/china_telecom/heilongjiang/main.py
Python
mit
16,977
""" This file is part of the TheLMA (THe Laboratory Management Application) project. See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information. Base classes, functions and constants for ISO processing (type-independent). AAB """ from thelma.tools.semiconstants import get_rack_position_from_label fro...
helixyte/TheLMA
thelma/tools/iso/base.py
Python
mit
19,027
# -*- coding: utf-8 -*- """ Default Controllers @author: Fran Boon """ module = "default" # Options Menu (available in all Functions) #response.menu_options = [ #[T("About Sahana"), False, URL(r=request, f="about")], #] def call(): "Call an XMLRPC, JSONRPC or RSS service" # If webservices don't...
sinsai/Sahana_eden
controllers/default.py
Python
mit
13,802
import basicTypes import struct class Literal: def __init__(self, x, h = False): self.value = x self.type = basicTypes.word self.isHex = h def __or__(self,other): return Literal(self.value | other.value, self.isHex or other.isHex) def __add__(self,other): return Li...
PFedak/DAKompiler
algebra.py
Python
mit
7,661
"""Controller for the reports module Author: Logan Gore This file is responsible for loading all site pages under /reports. """ from datetime import datetime from datetime import timedelta from flask import Blueprint from flask import flash from flask import jsonify from flask import redirect from flask import rende...
gorel/dli-reports
dli_app/mod_reports/controllers.py
Python
mit
21,847
# -*- coding: utf-8 -*- """ hyper/http20/connection ~~~~~~~~~~~~~~~~~~~~~~~ Objects that build hyper's connection-level HTTP/2 abstraction. """ from ..tls import wrap_socket, H2_NPN_PROTOCOLS, H2C_PROTOCOL from ..common.exceptions import ConnectionResetError from ..common.bufsocket import BufferedSocket from ..common....
masaori335/hyper
hyper/http20/connection.py
Python
mit
27,500
#!/usr/bin/env python from raspledstrip.ledstrip import * from raspledstrip.animation import * from raspledstrip.color import Color import requests import json import time import sys import traceback # Things that should be configurable ledCount = 32 * 5 api = 'http://lumiere.lighting/' waitTime = 6 class Lumiere: ...
lumiere-lighting/lumiere-node-raspberry-pi
lumiere.old.py
Python
mit
2,222
import coordinates import math import random class GraphNode(object): """Defines graph nodes. Author: Aleksandar Mitrevski """ def __init__(self, label=-1, coordinates=None): """Creates a graph node. Keyword arguments: label -- A node label which is expected to be an integer ...
aleksandar-mitrevski/ai
Hill-Climbing-A-Star/A-Star/graph.py
Python
mit
5,444
from __future__ import absolute_import import os import h5py from keras.models import Sequential from keras.optimizers import Adadelta from keras.layers.core import Dense, Activation from . import kerashack __all__ = [ 'TrainingRun', ] class TrainingRun(object): def __init__(self, filename, model, epochs...
maxpumperla/betago
betago/training/checkpoint.py
Python
mit
2,572
from datetime import datetime import ujson from pydantic import BaseModel class User(BaseModel): id: int name = 'John Doe' signup_ts: datetime = None class Config: json_loads = ujson.loads user = User.parse_raw('{"id": 123,"signup_ts":1234567890,"name":"John Doe"}') print(user)
samuelcolvin/pydantic
docs/examples/exporting_models_ujson.py
Python
mit
308
#!/usr/bin/python ############################################## ###Python template ###Author: Elizabeth Lee ###Date: 4/26/14 ###Function: Incidence per 100,000 vs. week number for flu weeks (wks 40-20). Incidence is per 100,000 for the US population in the second calendar year of the flu season. ###Import data: SQL_...
eclee25/flu-SDI-exploratory-age
scripts/create_fluseverity_figs/F2_incid_time.py
Python
mit
2,579
from abc import ABCMeta, abstractmethod class BaseCommand(metaclass=ABCMeta): @abstractmethod def parse_arguments(self, subparsers): return @abstractmethod def handle_command(self, args): return
bfvanrooyen/vcontrol
cli_commands/command_base.py
Python
mit
228
#!/usr/bin/env python import numpy as np from kmodes.kmodes import KModes # reproduce results on small soybean data set x = np.genfromtxt('soybean.csv', dtype=int, delimiter=',')[:, :-1] y = np.genfromtxt('soybean.csv', dtype=str, delimiter=',', usecols=(35, )) kmodes_huang = KModes(n_clusters=4, init='Huang', verbo...
nicodv/kmodes
examples/soybean.py
Python
mit
1,461
"""create_services Revision ID: d6ebfd0a1b Revises: 37440ef063 Create Date: 2015-04-04 16:57:34.406021 """ # revision identifiers, used by Alembic. revision = 'd6ebfd0a1b' down_revision = '37440ef063' from alembic import op import sqlalchemy as sa def upgrade(): sql_now = sa.text("timezone('utc'::text, now())...
tiredpixel/pikka-bird-server-py
pikka_bird_server/migrations/versions/d6ebfd0a1b_create_services.py
Python
mit
653
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_browserstep ---------------------------------- Tests for `browserstep` module. """ import sys import unittest from browserstep import browserstep class TestBrowserstep(unittest.TestCase): def setUp(self): pass def tearDown(self): p...
threeaims/browserstep
tests/test_browserstep.py
Python
mit
432
# -*- coding: utf-8 -*- from django.contrib import admin from metadata.models import Metadata from django.http import HttpResponseRedirect class MetadataAdmin(admin.ModelAdmin): def response_change(self, request, obj): return HttpResponseRedirect("/") ## redirect til frontpage efter add def respon...
rastermanden/metadata_example
meta/metadata/admin.py
Python
mit
1,394
from distutils.core import setup setup( name='jenkins_cli_tool', version='3.1', packages=['cli', 'cli.startjob', 'cli.startAndMonitor', 'tests'], url='https://github.com/hermco/jenkins_cli_tool', license='MIT', author='chermet', author_email='chermet@axway.com', description='CLI tool fo...
hermco/jenkins_cli_tool
setup.py
Python
mit
521
from pycket.test.testhelper import * from pycket.values import * import pytest skip = pytest.mark.skipif("True") # Creating Structure Types def test_make_struct_type(doctest): """ > (define-values (struct:a make-a a? a-ref a-set!) (make-struct-type 'a #f 2 1 'uninitialized)) > (define an-a (make...
vishesh/pycket
pycket/test/test_struct.py
Python
mit
17,186
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-17 14:10 from __future__ import unicode_literals import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('campaign', '0009_transaction_status'), ...
toast38coza/FlashGiving
campaign/migrations/0010_auto_20160717_1410.py
Python
mit
892
def generate_documentation(): print("generate_documentation Stub") return True
rorychatt/GPCook
gpcook/modules/documentation.py
Python
mit
88
#!/usr/bin/env python import os, sys SCRIPTDIR = os.path.dirname(__file__) ENGINDIR = os.path.join(SCRIPTDIR, '..', '..', 'engines') sys.path.append(os.path.abspath(ENGINDIR)) from fpsl_cvxpy import map_inference PROBLEMDIR = os.path.join(SCRIPTDIR, '..', '..', 'problems', 'paper_review') sys.path.append(os.path.abs...
gfarnadi/FairPSL
debug/compare_map/run_fpsl_cvxpy.py
Python
mit
1,367
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """\ Eulerian cycle jill-jênn vie et christoph dürr - 2015-2020 """ import random from tryalgo.graph import write_graph # snip{ eulerian_tour_undirected def eulerian_tour_undirected(graph): """Eulerian tour on an undirected graph :param graph: directed graph...
jilljenn/tryalgo
tryalgo/eulerian_tour.py
Python
mit
4,665
# By starting at the top of the triangle below and moving to adjacent numbers on the # row below, the maximum total from top to bottom is 23. # 3 # 7 4 # 2 4 6 # 8 5 9 3 # That is, 3 + 7 + 4 + 9 = 23. # Find the maximum total from top to bottom of the triangle below: # 75 # 95 64 # 17 47 82 # 18 35 87 10 # 20 04 8...
cloudzfy/euler
src/18.py
Python
mit
1,684
from tornado.options import options, logging from itertools import product import json import tornado.web import pymongo import csv class MongoDbLookupHandler(tornado.web.RequestHandler): def get(self, identity): logging.info("uri=%s [%s] [%s]" % (self.request.uri, identity, self.request.arguments)) ...
cancerregulome/GeneSpot_1.0
websvcs/endpoints/storage/mongodb_lookups.py
Python
mit
10,153
# -*- coding: utf-8 -*- """ Created on Mon Mar 20 00:30:34 2017 @author: Marllon Soares @site: www.marllonsoares.com.br @linguagem: Python 3 @assunto: Estrutura sequencial @problema: Faça um Programa que peça um número e então mostre a mensagem O número informado foi [número]. """ numero = int(input()) print("O...
MarllonSoares/PYTHON-ESTUDO
lista-de-atividades/01-estrutura-sequencial/02-atividade/algoritmo-atv2.py
Python
mit
360
# coding: utf-8 # Standard Libraries import logging import re # Third Party Libraries from cfgtree import LOGGER_NAME log = logging.getLogger(LOGGER_NAME) # tells flake8 to ignore complexity check for this file # flake8: noqa def get_node_by_xpath(mapping, xpath, default=None, ignore_errors=False, ...
Stibbons/dopplerr
cfgtree/dictxpath.py
Python
mit
5,244
from django.utils import timezone t = timezone.get_current_timezone() for s in Sleep.objects.all(): if timezone.is_aware(s.start_time): s.start_time = timezone.make_naive(s.start_time, t) if timezone.is_aware(s.end_time): s.end_time = timezone.make_naive(s.end_time,t) s.save()
sleepers-anonymous/zscore
useful_scripts/timezones.py
Python
mit
292
from django.apps import AppConfig class UsersConfig(AppConfig): name = 'to_do_list.users' verbose_name = "Users" def ready(self): """Override this to put in: Users system checks Users signal registration """ pass
arnaudblois/to_do_list
to_do_list/users/apps.py
Python
mit
276
from storage import *
agniveshadhikari/edx-agea
agea/storage/__init__.py
Python
mit
22
import sys from cyvcf2 import VCF from collections import defaultdict def parse_caller_vcfs(sample_dict, caller_list): caller_vcf_records = defaultdict(lambda: dict()) for caller in caller_list: parse_vcf(sample_dict[caller], caller, caller_vcf_records) return caller_vcf_records def parse_vcf(v...
GastonLab/ddb-mongodb
vcf_parsing.py
Python
mit
11,779
from setuptools import setup, find_packages from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='qchess', version='1.0.0.dev1', description='A simple quantum ch...
useanalias/qchess
setup.py
Python
mit
1,276
#!/usr/bin/python import sys from library import factorial number = int(sys.argv[1]) factorial = factorial(number) print('{0}! = {1}'.format(number, factorial))
vivanov1410/pickled-brain
new/beginner/factorial/python/factorial.py
Python
mit
164
# 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 ...
lmazuel/azure-sdk-for-python
azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/account/models/add_data_lake_store_parameters.py
Python
mit
943
from setuptools import setup def readme(): with open("README.rst") as file: return file.read() setup(name="grade_mc", version='1.1', description=("Process multiple choice grades."), long_description=readme(), author="Scott Hartley", author_email="scott.hartley@miamioh.edu",...
scotthartley/grade_mc
setup.py
Python
mit
604
#Author: Maple0 #Github:https://github.com/Maple0 #4th Sep 2016 #Given a collection of intervals, merge all overlapping intervals. #For example, #Given [1,3],[2,6],[8,10],[15,18], #return [1,6],[8,10],[15,18]. class Interval(object): def __init__(self, s=0, e=0): self.start = s self.end = e class Merge_Resu...
Maple0/Algorithm
leetcode/merge-overlapping-intervals.py
Python
mit
1,961
import json import random #from sklearn.manifold import TSNE from tsne import bh_sne from numpy.random import rand from sklearn.preprocessing import MinMaxScaler from time import time import numpy as np start_time = time() n_samples = 20000 #wordlist = ["word-%d" % i for i in range(n_samples)] #print "creating random ...
anthonygarvan/wordgalaxy
processing/main.py
Python
mit
1,256
#!/usr/bin/env python3 import sys if __name__ == '__main__': a_str = sys.argv[1] b_str = sys.argv[2] a = int(sys.argv[1]) b = int(sys.argv[2]) while (a <= b): print("a =" + str(a) + str(b) + ")") a = a+1
isobelsv/nyu-python
while_loop.py
Python
mit
249
import tflearn from tflearn.data_utils import to_categorical, pad_sequences from tflearn.datasets import imdb # IMDB Dataset loading train, test, _ = imdb.load_data(path='imdb.pkl', n_words=10000, valid_portion=0.1) trainX, trainY = train testX, testY = test # Data preprocessing # Sequ...
sethuiyer/mlhub
Deep Sentiment Analysis/build_sentiment_model.py
Python
mit
1,105
""" WSGI config for puuch project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` se...
ricrdo/puuch
puuch/wsgi.py
Python
mit
1,416
from __future__ import absolute_import from agms.exception.not_found_exception import NotFoundException try: import requests except ImportError as e: raise NotFoundException(e) class RequestsClient(object): def http_do(self, http_verb, url, headers, request_body): response = requests.request...
agmscode/agms_python
agms/util/requests_client.py
Python
mit
509
#!/usr/bin/env python # coding=utf-8 x = {} y = x x['key'] = 'value' print y x = {} print y print x print '-'*50 a = {} b = a a['key'] = 'value' print b a.clear() print b
rainysia/dotfiles
doc/python/test/dict_clear.py
Python
mit
172
import supriya.commands import supriya.realtime from supriya.system.SupriyaValueObject import SupriyaValueObject class NodeTransition(SupriyaValueObject): """ A non-realtime state transition. """ ### CLASS VARIABLES ### __documentation_section__ = "Session Internals" __slots__ = ("_source",...
Pulgama/supriya
supriya/nonrealtime/NodeTransition.py
Python
mit
4,163
import copy from collections import defaultdict from typing import ( Any, cast, DefaultDict, Dict, List, Mapping, NamedTuple, Optional, TypedDict, ) from pyre_extensions import none_throws from backend.common.consts.alliance_color import AllianceColor, OPPONENT, TMatchWinner from b...
the-blue-alliance/the-blue-alliance
src/backend/common/helpers/playoff_advancement_helper.py
Python
mit
34,130
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-11-10 08:19 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('reporte', '0001_initial'), ] operations = [ migrations.AlterField( ...
vpadillar/pventa
reporte/migrations/0002_auto_20161110_0819.py
Python
mit
504
""" Palantir tasks """ import itertools from datetime import datetime import copy from collections import defaultdict from steward_salt.tasks import salt_match, salt, salt_key from steward_tasks.tasks import pub from .models import CheckDisabled, MinionDisabled, CheckResult, Alert from steward_tasks import celery, St...
mathcamp/steward_palantir
steward_palantir/tasks.py
Python
mit
7,289
import brickpi3 ZZ
nextdude/robogator-controller
src/test-motor.py
Python
mit
19
#!/usr/bin/python from time import sleep from signal import SIGINT from mininet.net import Mininet from mininet.node import Controller, OVSKernelAP from mininet.link import TCLink from mininet.cli import CLI from mininet.log import setLogLevel def topology(): "Create a network." net = Mininet(controller=Cont...
bahadley/mgc
scripts/ex-3/heartBeat.py
Python
mit
2,789
#!/usr/bin/env python3 import sys import rnnlm import txt import pickle from keras.models import load_model if __name__ == "__main__": modelInFile = sys.argv[1] dictInFile = sys.argv[2] try: catSpec = sys.argv[3] except IndexError: catSpec = None numToSample = 1 (mdl, params) = rnnlm.loadModels(modelIn...
fishel/yarnnlm
sample.py
Python
mit
644
from django import forms class CommentForm(forms.Form): content_type = forms.CharField(widget=forms.HiddenInput) object_id = forms.CharField(widget=forms.HiddenInput) parent_id = forms.IntegerField(widget=forms.HiddenInput, required=False) content = forms.CharField(label='',widget=forms.Textarea)
tyagow/AdvancingTheBlog
src/comments/forms.py
Python
mit
304
#!/usr/bin/env python import os import sys import shutil from setuptools import setup, find_packages from setuptools.command.install import install with open('requirements.txt', 'r') as fh: dependencies = [l.strip().split("#")[0] for l in fh] extras = {} with open('requirements-extras.txt', 'r') as fh: ext...
okin/nikola
setup.py
Python
mit
5,175
#!/usr/bin/env python import sys import os import numpy as np import matplotlib.pyplot as plt from clawpack.pyclaw.solution import Solution import clawpack.visclaw.data as data rho = [1025.0,1045.0] eta_init = [0.0,-300.0] def plot_contour(data_dir="./_output",out_dir='./',num_layers=2,num_frames=1000,ref_lines=[-1...
mandli/multilayer-examples
1d/plot_shelf_contour.py
Python
mit
3,904
''' Example of a spike receptor (only receives spikes) In this example spikes are received and processed creating a raster plot at the end of the simulation. ''' from brian import * import numpy from brian_multiprocess_udp import BrianConnectUDP # The main function with the NeuronGroup(s) and Synapse(s) must be na...
ricardodeazambuja/BrianConnectUDP
examples/OutputNeuronGroup_multiple_inputs.py
Python
cc0-1.0
2,862
#!/usr/bin/env python3 # forked from spline1986's versions import os, sys, sqlite3 from ii_functions import * args=sys.argv[1:] if len(args)==0: print("Usage: sqlite-export.py <db_file>") sys.exit(1) check_dirs() conn = sqlite3.connect(args[0]) c = conn.cursor() c.execute("""CREATE TABLE IF NOT EXISTS msg( id I...
vit1-irk/ii-db-utils
sqlite-export.py
Python
cc0-1.0
1,050
from datetime import datetime from decimal import Decimal from aspen.utils import utcnow from mock import patch from nose.tools import assert_equals from gittip import wireup from gittip.billing.payday import Payday from gittip.models import Tip from gittip.participant import Participant from gittip.testing import Ha...
bountysource/www.gittip.com
tests/test_stats.py
Python
cc0-1.0
4,788
# -*- coding: utf-8 -*- # Signāli un sistēmas. 3. Laboratorijas darbs # == Taisnstūra loga ietekme uz signāla spektru == import sys import numpy as np import matplotlib.pyplot as plt from PyQt4 import QtGui, QtCore from scipy.fftpack import fft from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureC...
0x4C4A/SS-2014
LD3/ld3_script_unified.py
Python
cc0-1.0
7,931
# coding=utf-8 from django.test import TestCase, Client from django.core.urlresolvers import reverse from django.core import mail class IndexViewTestCase(TestCase): def setUp(self): self.client = Client() self.url = reverse('index') def tearDown(self): pass def test_status_code...
marcionreis/djangoecommerce
core/tests/test_views.py
Python
cc0-1.0
1,619
if dest.lower()=='footballbot': dest=origin par=' '.join(params).lower() if len(par) < 10 and par.count('is') == 0 and par.count('?') == 0 and par.count('will') == 0 and par.count('should') == 0 and par.count('could') == 0 and par.count('do') == 0 and par.count('has') == 0 and par.count('does') == 0 and par.count('when...
epmatsw/FootballBot
fxns/8ball.py
Python
cc0-1.0
986
import os path = os.path.dirname(os.path.realpath(__file__)) sbmlFilePath = os.path.join(path, 'MODEL1006230072.xml') with open(sbmlFilePath,'r') as f: sbmlString = f.read() def module_exists(module_name): try: __import__(module_name) except ImportError: return False else: ret...
biomodels/MODEL1006230072
MODEL1006230072/model.py
Python
cc0-1.0
427
from instal.firstprinciples.TestEngine import InstalSingleShotTestRunner, InstalTestCase from instal.instalexceptions import InstalParserError class InitiateNormsPerms(InstalTestCase): def test_initiate_perms_institutional(self): runner = InstalSingleShotTestRunner(input_files=["fluentchange/perminitiate...
cblop/tropic
instal-linux/instal/firstprinciples/fluentchange/TestInitiateNormsPerms.py
Python
epl-1.0
1,549
""" Query DB using Django models test Intended purpose is to catch obvious omissions in DB state or the Django models themselves. """ import os from django.db import connection try: # Django >= 1.8 import django.apps get_models = django.apps.apps.get_models del django.apps except ImportError: # D...
UNINETT/nav
tests/integration/models/model_test.py
Python
gpl-2.0
855
from datetime import datetime from Acquisition import aq_inner #from zope.component import getMultiAdapter #from Products.CMFCore.utils import getToolByName from plone import api from five import grok from plone.directives import dexterity, form from plone.dexterity.content import Container from plone.supermodel ...
bostrick/totav.stripe
totav/stripe/domain.py
Python
gpl-2.0
9,924
import logging from abc import abstractmethod, ABCMeta from urllib import request class UrlShortener(metaclass=ABCMeta): @abstractmethod def shorten(self, url: str) -> str: pass def log(self, url): logging.info("Short URL: {}".format(url)) class Off(UrlShortener): def shorten(self, ...
instantshare/instantshare
src/tools/shorturl.py
Python
gpl-2.0
726
#!/bin/python import suds from suds.client import Client u = 'http://owsx:owsx_user@localhost:8080/orawsv/OWSX/OWSX_UTL/PAY_RAISE' h = {'User-Agent':'Mozilla/4.0'} client = Client(u) print(client)
devnull5475/SI_ORAWSV_POC
src/test/py/test.py
Python
gpl-2.0
206
__author__ = 'tonycastronova' import xml.etree.ElementTree as et from xml.dom import minidom def prettify(elem): """ Return a pretty-printed XML string for the Element. """ rough_string = et.tostring(elem, 'utf-8') reparsed = minidom.parseString(rough_string) return reparsed.toprettyxml(inde...
Castronova/EMIT
gui/examples/xml.py
Python
gpl-2.0
877
''' This file is part of the lenstractor project. Copyright 2012 David W. Hogg (NYU) and Phil Marshall (Oxford). Description ----------- Model class, to package up srcs and enable initialization. To-do ----- - debug, test ''' import numpy as np import pylab as plt import tractor import lenstractor deg2rad = 0.01...
davidwhogg/LensTractor
lenstractor/model.py
Python
gpl-2.0
28,818
from pycse.lisp import * def test_symbol(): assert Symbol('setf').lisp == 'setf' def test_quote(): assert Quote('setf').lisp == "'setf" def test_sharpquote(): assert SharpQuote('setf').lisp == "#'setf" def test_cons(): assert Cons('a', 3).lisp == '("a" . 3)' def test_Alist(): assert Alist(["a",...
jkitchin/pycse
pycse/tests/test_lisp.py
Python
gpl-2.0
720
from liblightbase import lbutils from liblightbase.lbutils.conv import dict2document class OrderBy(object): """ The ORDER BY keyword sorts the records in ascending order by default. To sort the records in a descending order, you can use the DESC keyword. To sort the records in a ascending order, you c...
antonygc/liblightbase
liblightbase/lbsearch/search.py
Python
gpl-2.0
5,160
# ######################################################################## # # SweetHome3D HTML5 to Blender importer # # ######################################################################## # # Copyright (c) : 2018 Luis Claudio Gambôa Lopes # # This program is free software; you can redistribute it and/or ...
lcgamboa/sh3dtoblender
old/sh3d_html5_to_blender.py
Python
gpl-2.0
16,266
from Screen import Screen from Components.ActionMap import ActionMap from Components.ActionMap import NumberActionMap from Components.Label import Label from Components.config import config, ConfigSubsection, ConfigSelection, ConfigSubList, getConfigListEntry, KEY_LEFT, KEY_RIGHT, KEY_0, ConfigNothing, ConfigPIN from ...
popazerty/dvbapp2-gui
lib/python/Screens/Ci.py
Python
gpl-2.0
11,228
import db import db.exceptions import sqlalchemy import string import random KEY_LENGTH = 40 def generate(owner_id): """Generate new key for a specified user. Doesn't check if user exists. Args: owner_id: ID of a user that will be associated with a key. Returns: Value of the new ke...
metabrainz/acousticbrainz-server
db/api_key.py
Python
gpl-2.0
2,579
import argparse import importlib import inspect import logging import os import shelve import time import matplotlib.pyplot import numpy as np import nengo def find_offset(a, b): assert len(a) == len(b) corr = np.correlate(a, b, 'full') index = np.argmax(corr[len(a):]) return index class Benchmark(...
tcstewar/2015-Embodied_Benchmarks
code/benchmark.py
Python
gpl-2.0
5,094
''' Created on Oct 12, 2013 @author: pglauner ''' import random from my_decorators import memo from uncertainty import best_action goal = 40 other = {1:0, 0:1} def roll(state, d): """Apply the roll action to a state (and a die roll d) to yield a new state: If d is 1, get 1 point (losing any accumulated 'pe...
pglauner/misc
src/cs212/pig_game.py
Python
gpl-2.0
3,539
#!/usr/bin/env python # ## # Copyright 2009-2015 Ghent University # # This file is part of hanythingondemand # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),...
ehiggs/hanythingondemand
hod/utils.py
Python
gpl-2.0
2,111
# Importe la biblioteque pygame import pygame # La syntaxe from x import y permet de ne pas devoir ecrire x.y mais juste y # L'etoile indique que l'on importe tout from constantes import * from Sauvegarde import * from jouer import * from options import * pygame.init() sauvegarde = Sauvegarde() try: sauvegarde = ...
Elyjax/Snake
main.py
Python
gpl-2.0
2,389