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
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of astroid. # # astroid is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the F...
Shouqun/node-gn
tools/depot_tools/third_party/logilab/astroid/brain/pysix_moves.py
Python
mit
8,703
import cgi import errno import io import mimetypes import os import posixpath import re import shutil import stat import sys import tempfile from os import path import django from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.core.management.utils import hand...
mbayon/TFG-MachineLearning
venv/lib/python3.6/site-packages/django/core/management/templates.py
Python
mit
14,053
# $Id: 331_srtp_prefer_rtp_avp.py 2081 2008-06-27 21:59:15Z bennylp $ import inc_sip as sip import inc_sdp as sdp # When SRTP is NOT enabled in pjsua, it should prefer to use # RTP/AVP media line if there are multiple m=audio lines sdp = \ """ v=0 o=- 0 0 IN IP4 127.0.0.1 s=- c=IN IP4 127.0.0.1 t=0 0 m=audio 5000 RTP/...
lxki/pjsip
tests/pjsua/scripts-sendto/331_srtp_prefer_rtp_avp.py
Python
gpl-2.0
827
#!/usr/bin/env python # Copyright (c) 2011 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies simple rules when using an explicit build target of 'all'. """ import TestGyp import os import sys test = TestGyp.TestGyp(for...
sgraham/nope
tools/gyp/test/rules-dirname/gyptest-dirname.py
Python
bsd-3-clause
1,475
""" This module implements connections for MySQLdb. Presently there is only one class: Connection. Others are unlikely. However, you might want to make your own subclasses. In most cases, you will probably override Connection.default_cursor with a non-standard Cursor class. """ from MySQLdb import cursors fr...
skycucumber/Messaging-Gateway
webapp/venv/lib/python2.7/site-packages/MySQLdb/connections.py
Python
gpl-2.0
11,777
class A: def __init__(self, a:int, b:float, *args:tuple, c:complex, **kwargs:dict) -> None: pass class B(A): def <warning descr="Call to __init__ of super class is missed">__i<caret>nit__</warning>(self, d:str, *, e:bytes) -> list: pass
idea4bsd/idea4bsd
python/testData/inspections/AddCallSuperTypeAnnotationsPreserved.py
Python
apache-2.0
261
# Generated from 'Aliases.h' def FOUR_CHAR_CODE(x): return x true = True false = False rAliasType = FOUR_CHAR_CODE('alis') kARMMountVol = 0x00000001 kARMNoUI = 0x00000002 kARMMultVols = 0x00000008 kARMSearch = 0x00000100 kARMSearchMore = 0x00000200 kARMSearchRelFirst = 0x00000400 asiZoneName = -3 asiServerName = -2 as...
xbmc/atv2
xbmc/lib/libPython/Python/Lib/plat-mac/Carbon/Aliases.py
Python
gpl-2.0
407
class C(object): def f(self, name): return name __getattr__ = f c = C() print(c.foo) #pass
asedunov/intellij-community
python/testData/inspections/PyUnresolvedReferencesInspection/getattrAttribute.py
Python
apache-2.0
108
a = [1 2 3]
smmribeiro/intellij-community
python/testData/psi/MissingListSeparators.py
Python
apache-2.0
11
class A: def <weak_warning descr="Function name should be lowercase">fooBar</weak_warning>(self): pass class B(A): def fooBar(self): pass
kdwink/intellij-community
python/testData/inspections/PyPep8NamingInspection/overridden.py
Python
apache-2.0
142
def x(): print "bar" print "foo" print "xyzzy"
asedunov/intellij-community
python/testData/copyPaste/SingleLine.after.py
Python
apache-2.0
58
# Copyright (C) 2001-2006 Python Software Foundation # Author: Ben Gertzfield, Barry Warsaw # Contact: email-sig@python.org __all__ = [ 'Charset', 'add_alias', 'add_charset', 'add_codec', ] import email.base64mime import email.quoprimime from email import errors from email.encoders import encode_...
zephyrplugins/zephyr
zephyr.plugin.jython/jython2.5.2rc3/Lib/email/charset.py
Python
epl-1.0
15,684
# $Id: __init__.py 7646 2013-04-17 14:17:37Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ This package contains Docutils parser modules. """ __docformat__ = 'reStructuredText' import sys from docutils import Component if sys.version_info < (2...
JulienMcJay/eclock
windows/Python27/Lib/site-packages/docutils/parsers/__init__.py
Python
gpl-2.0
1,657
""" Generic relations Generic relations let an object have a foreign key to any object through a content-type/object-id field. A ``GenericForeignKey`` field can point to any object, be it animal, vegetable, or mineral. The canonical example is tags (although this example implementation is *far* from complete). """ f...
megaumi/django
tests/generic_relations/models.py
Python
bsd-3-clause
4,327
from contextlib import contextmanager from .termui import get_terminal_size from .parser import split_opt from ._compat import term_len # Can force a width. This is used by the test system FORCED_WIDTH = None def measure_table(rows): widths = {} for row in rows: for idx, col in enumerate(row): ...
wildchildyn/autism-website
yanni_env/lib/python3.6/site-packages/click/formatting.py
Python
gpl-3.0
8,889
#!/usr/bin/env python # # BBB-Network-Ammeter # # Copyright (c) 2016, Forest Crossman <cyrozap@gmail.com> # # 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 copi...
cyrozap/BBB-Network-Ammeter
server.py
Python
isc
5,648
# Django settings for test_project project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'test.db', } } TIME_ZONE = 'Etc/UTC' LANGUAGE_CODE = 'en-u...
yprez/django-useful
test_project/test_project_py2/settings.py
Python
isc
1,842
from flatten import * POS_SIZE = 2**23 - 1 NEG_SIZE = -2**23 OPTIMIZE = True OPTIMIZERS = { 'set': 'SET', 'setglobal': 'SET_GLOBAL', 'local': 'SET_LOCAL', 'get': 'GET', 'getglobal': 'GET_GLOBAL', 'return': 'RETURN', 'recurse': 'RECURSE', 'drop': 'DROP', 'dup': 'DUP', '[]': 'NEW_LIST', '{}': 'NEW_DICT', 's...
gvx/deja
convert.py
Python
isc
5,277
# Generated by Django 2.2.10 on 2020-04-29 12:31 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0020_auto_20200421_0851'), ] operations = [ migrations.AddField( model_name='localconfig', name='need_dovec...
modoboa/modoboa
modoboa/core/migrations/0021_localconfig_need_dovecot_update.py
Python
isc
403
from . import meta_selector # noqa from .pg import PatternGenerator from .selector import Selector PatternGenerator('') Selector('')
stack-of-tasks/sot-pattern-generator
src/dynamic_graph/sot/pattern_generator/__init__.py
Python
isc
136
# -*- coding: utf8 -*- import subprocess import os from pathlib import Path cwd = os.getcwd() try: print(os.getcwd()) subprocess.call(['make']) # res = subprocess.check_output('uname -a',shell=True) res = subprocess.check_output( r"./darknet detector test cfg/coco.data cfg/yolo.cfg yolo.weight...
umyuu/Sample
src/Python3/Q113190/exsample.py
Python
mit
512
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 from loguru import logger from pathlib import Path def check_meta_yaml_for_noarch(fn:Path, text=None): import re logger.debug("Checking for noarch") if text is None: with open(fn, "rt") as fl: text = fl.read() mo = re...
mjirik/discon
discon/discon_tools.py
Python
mit
600
# coding: utf-8 from __future__ import unicode_literals import re import os from django.shortcuts import render from django.conf import settings def index(request): p = re.compile(r'^app\d+_') apps = (a.split('_') for a in settings.INSTALLED_APPS if p.match(a)) return render(request, 'ignore_me/index....
sametmax/Django--an-app-at-a-time
ignore_this_directory/ignore_me/views.py
Python
mit
391
from __future__ import print_function, division, absolute_import from george import kernels, GP import numpy as np from kglib import fitters from scipy.integrate import quad from scipy.optimize import minimize class HistFitter(fitters.Bayesian_LS): def __init__(self, mcmc_samples, bin_edges): """ ...
kgullikson88/gullikson-scripts
kglib/fitters/histogram.py
Python
mit
5,838
# ------------------------------------------------------ # current.py # # Plot a current field at fixed depth # Modified from the spermplot example # # Bjørn Ådlandsvik <bjorn@imr.no> # 2020-03-27 # ------------------------------------------------------ # ------------- # Imports # ------------- import numpy as np imp...
bjornaa/roppy
examples/plot_current25.py
Python
mit
2,273
from __init__ import redis_db from werkzeug.security import generate_password_hash, check_password_hash from os import urandom from base64 import b64encode class User(object): def __init__(self): self.username = "" # required self.password_hash = "" # required self.phone_number = "" # req...
BrambleLLC/HackAZ-2016
server/webapp/models.py
Python
mit
1,957
import functions import heapq import vtbase ### Classic stream iterator registered = True class StreamExcept(vtbase.VT): def BestIndex(self, constraints, orderbys): return (None, 0, None, True, 1000) def VTiter(self, *parsedArgs, **envars): largs, dictargs = self.full_parse(parsedArgs) ...
madgik/exareme
Exareme-Docker/src/exareme/exareme-tools/madis/src/functions/vtable/streamexcept.py
Python
mit
3,449
import json, logging, os, re, subprocess, shlex from tools import get_category_by_status log = logging.getLogger() meta_files = ['Disassembly', 'Stacktrace', 'Registers', 'SegvAnalysis', 'ProcMaps', "BootLog" , "CoreDump", "BootDmesg", "syslog", "UbiquityDebug.gz", "Casper.gz", "UbiquityPar...
jfoote/vulture
vlib/analyzers/reproducibility.py
Python
mit
2,072
import hashlib import os import sys if len(sys.argv) < 3: #1 print("You need to specify two directories:") #1 print(sys.argv[0], "<directory 1> <directory 2>") #1 sys.exit() #1 directory1 = sys.argv[1] ...
AnthonyBriggs/Python-101
hello_python_source_py3/chapter 03/difference_engine_5_inorder.py
Python
mit
2,533
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 本测试模块用于测试与 :class:`sqlite4dummy.schema.MetaData` 有关的方法 class, method, func, exception ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ from sqlite4dummy import * from sqlite4dummy.tests.basetest import * from datetime import dateti...
MacHu-GWU/sqlite4dummy-project
sqlite4dummy/tests/functionality/test_MetaData.py
Python
mit
5,883
#!/usr/bin/env python # https://www.codeeval.com/open_challenges/1/ import sys def solve(X, Y, N): r = [] for i in range(1, N + 1): if i % X == 0 and i % Y == 0: r.append('FB') elif i % X == 0: r.append('F') elif i % Y == 0: r.append('B') el...
guozengxin/codeeval
easy/fizzBuzz.py
Python
mit
537
import ConfigParser import sys, traceback from slackclient import SlackClient from chatterbot import ChatBot import os from os import listdir from os.path import isfile, join from chatterbot.trainers import ChatterBotCorpusTrainer config = ConfigParser.SafeConfigParser({"host": "searchhub.lucidworks.com", "port":...
gsingers/rtfmbot
src/python/run.py
Python
mit
2,559
""" filename: controllers.py description: Controllers for committee notes. created by: Chris Lemelin (cxl8826@rit.edu) created on: 04/20/18 """ from flask_socketio import emit from app.decorators import ensure_dict from app import socketio, db from app.committee_notes.models import * from app.committees.models import ...
ritstudentgovernment/chargeflask
app/committee_notes/controllers.py
Python
mit
5,203
import uuid from typing import Optional, Union from mitmproxy import connection from mitmproxy import flow from mitmproxy import http from mitmproxy import tcp from mitmproxy import websocket from mitmproxy.test.tutils import treq, tresp from wsproto.frame_protocol import Opcode def ttcpflow(client_conn=True, server...
mitmproxy/mitmproxy
mitmproxy/test/tflow.py
Python
mit
5,859
from django.test import Client import mock as mock from image_converter.tests.base import ImageConversionBaseTestCase from image_converter.utils.convert_image import convert_image_to_jpeg __author__ = 'Dominic Dumrauf' class ViewsTestCase(ImageConversionBaseTestCase): """ Tests the 'views'. """ def ...
dumrauf/web_tools
image_converter/tests/test_views.py
Python
mit
3,078
#!/usr/bin/python3 # # Copyright © 2017 jared <jared@jared-devstation> # from pydub import AudioSegment, scipy_effects, effects import os import settings, util # combine two audio samples with a crossfade def combine_samples(acc, file2, CROSSFADE_DUR=100): util.debug_print('combining ' + file2) sample2 = Audi...
techlover10/StochasticSoundscape
src/audio.py
Python
mit
1,411
################################################################################ ######### MS11-080 - CVE-2011-2005 Afd.sys Privilege Escalation Exploit ######## ######### Author: ryujin@offsec.com - Matteo Memelli ######## ######### Spaghetti & Pwnsauce ##...
SecWiki/windows-kernel-exploits
MS11-080/CVE-2011-2005.py
Python
mit
12,217
from pathlib import Path class MarkdownParser(): def __init__(self, text): self.text = text self.lines = text.split('\n') def title(self): return self.lines[0].split(' ')[1] def header(self, name, level, include_header=False): start = False end = False co...
AnthonyCalandra/modern-cpp-features
auto-generate-readme.py
Python
mit
2,305
import functools from common.tornado_cookies import get_secure_cookie, generate_secure_cookie from core import cookies class Perms(object): NONE = None READ = 'r' WRITE = 'w' def _permission_level(user, room): """ `user`'s permission level on `room`, ignoring cookies """ if not user.is_au...
reverie/seddit.com
redditchat/core/permissions.py
Python
mit
2,122
from difflib import get_close_matches from thefuck.utils import sudo_support, get_all_executables, get_closest @sudo_support def match(command, settings): return 'not found' in command.stderr and \ bool(get_close_matches(command.script.split(' ')[0], get_all_executable...
mbbill/thefuck
thefuck/rules/no_command.py
Python
mit
580
#!/usr/bin/env python # File created on 09 Aug 2012 from __future__ import division __author__ = "Jon Sanders" __copyright__ = "Copyright 2014, Jon Sanders" __credits__ = ["Jon Sanders"] __license__ = "GPL" __version__ = "1.9.1" __maintainer__ = "Jon Sanders" __email__ = "jonsan@gmail.com" __status__ = "Development" ...
tanaes/decontaminate
decontaminate_unitary.py
Python
mit
40,011
""" Load the CCGOIS datasets into a CKAN instance """ import dc import json import slugify import ffs def make_name_from_title(title): # For some reason, we're finding duplicate names name = slugify.slugify(title).lower()[:99] if not name.startswith('ccgois-'): name = u"ccgois-{}".format(name) ...
nhsengland/publish-o-matic
datasets/ccgois/load.py
Python
mit
3,287
from selenium import webdriver from selenium.webdriver.common.keys import Keys from .base import FunctionalTest class RecipeEditTest(FunctionalTest): def test_can_add_a_recipe(self): # Ben goes to the recipe website homepage self.browser.get(self.server_url) # He notices the page title m...
benosment/recipes
functional_tests/test_edit_recipe.py
Python
mit
8,273
# 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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_operations.py
Python
mit
10,365
#!/usr/bin/python # -*- coding: utf-8 -*- from numpy import array, zeros, linspace, meshgrid, ndarray, diag from numpy import uint8, float64, int8, int0, float128, complex128 from numpy import exp, sqrt, cos, tan, arctan from numpy import minimum, maximum from numpy import ceil, floor from numpy import matrix as npmat...
shersonb/brokenray
brokenray/polar.py
Python
mit
11,050
import numpy arr = numpy.array(list(map(float, input().split()))) x = float(input()) value = numpy.polyval(arr, x) print(value)
avtomato/HackerRank
Python/_16_Numpy/_14_Polynomials/solution.py
Python
mit
130
""" WSGI config for photoboard project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_S...
photoboard/photoboard-django
photoboard/wsgi.py
Python
mit
398
import torch import torchvision.transforms as transforms import torch.utils.data as data import os import json import pickle import argparse from PIL import Image import numpy as np from utils import Vocabulary class CocoDataset(data.Dataset): def __init__(self, root, anns, vocab, mode='train',transform=None): ...
incredible-vision/show-and-tell
data_loader.py
Python
mit
3,497
from collections import namedtuple import select StreamEvent = namedtuple( 'StreamEvent', [ 'fd', 'stream', 'data', 'direction', 'num_bytes', 'eof' ] ) class StreamWatcher(object): def __init__( self ): if _best_backend is None: raise Exception( "No poll/queue backend could be found for your OS." ) self.backe...
theojulienne/pyio
pyio/io/StreamWatcher.py
Python
mit
3,517
try: from setuptools import setup except ImportError: from distutils.core import setup config = { 'description':'End to end solution for bitcoin data gathering, backtesting, and live trading', 'author': 'ross palmer', 'url':'http://rosspalmer.github.io/bitQuant/', 'license':'MIT', 'version': '0.2.10', 'install...
multidis/bitQuant02
setup.py
Python
mit
464
#! /usr/bin/env python """ Module with the MCMC (``emcee``) sampling for NEGFC parameter estimation. """ __author__ = 'O. Wertz, Carlos Alberto Gomez Gonzalez, V. Christiaens' __all__ = ['mcmc_negfc_sampling', 'chain_zero_truncated', 'show_corner_plot', 'show_walk_plot', '...
vortex-exoplanet/VIP
vip_hci/fm/negfc_mcmc.py
Python
mit
57,611
import pygame import math class Screen: ''' Se encarga de controlar lo que ve el jugador en la pantalla. Parameters ---------- size : List[int] Tamaño de la pantalla, ``[w, h]``. Notes ----- Primero se debe crear una instancia de este objeto, luego, en cada loop del juego ...
toboso-team/toledo
toledo/graphics/screen.py
Python
mit
7,808
import numpy as np class Site(object): """A class for general single site Use this class to create a single site object. The site comes with identity operator for a given dimension. To build specific site, additional operators need be add with add_operator method. """ def __init__(sel...
fhqgfss/MoHa
moha/modelsystem/sites.py
Python
mit
7,169
import datetime import json from brake.decorators import ratelimit from django.utils.decorators import method_decorator from django.utils.translation import get_language from django.conf import settings from django.core.urlresolvers import reverse_lazy from django.http import HttpResponseRedirect, HttpResponse from dj...
ministryofjustice/manchester_traffic_offences_pleas
apps/plea/views.py
Python
mit
8,700
class DatabaseRouter(object): ''' These functions are called when Django accesses the database. Returns the name of the database to use depending on the app and model. Returning None means use default. ''' def db_for_read(self, model, **hints): return self.__db_for_read_and_write(model...
geometalab/geoconverter
GeoConverter/database.py
Python
mit
4,858
SIMPLE_SETTINGS = { 'OVERRIDE_BY_ENV': True } MY_VAR = u'Some Value'
drgarcia1986/simple-settings
tests/samples/special.py
Python
mit
74
import _plotly_utils.basevalidators class SizeValidator(_plotly_utils.basevalidators.NumberValidator): def __init__( self, plotly_name="size", parent_name="histogram.marker.colorbar.tickfont", **kwargs ): super(SizeValidator, self).__init__( plotly_name=plot...
plotly/python-api
packages/python/plotly/plotly/validators/histogram/marker/colorbar/tickfont/_size.py
Python
mit
541
# This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made available under the MIT License from load import load_dataset import numpy as np from threshold import learn_model, apply_model, accura...
krahman/BuildingMachineLearningSystemsWithPython
ch02/seeds_threshold.py
Python
mit
921
# -*- coding: utf8 -*- import re from unidecode import unidecode import os, sys from hashlib import md5 as hasher import binascii import settings def gen_flattened_list(iterables): for item in iterables: if hasattr(item, '__iter__'): for i in item: yield i else: ...
jumoconnect/openjumo
jumodjango/etc/func.py
Python
mit
1,840
#!/usr/bin/python import urllib2 url = "http://localhost:8888/test/test.txt" html = urllib2.urlopen(url).read() print html send_headers = { 'range':'bytes=10-' } req = urllib2.Request(url, headers=send_headers) html = urllib2.urlopen(req).read() print html
misilences/incipe
var/www/test/crawler/rbt.py
Python
mit
266
N = int(input()) B = [int(x) for x in input().split()] A = [10**5] * N for i, b in enumerate(B): A[i] = min(A[i], b) A[i+1] = min(A[i+1], b) print(sum(A))
knuu/competitive-programming
atcoder/abc/abc140_c.py
Python
mit
163
#!/usr/bin/env python '''coffeehandlers.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - Jul 2014 This contains the URL handlers for the astroph-coffee web-server. ''' import os.path import logging import base64 import re LOGGER = logging.getLogger(__name__) from datetime import datetime, timedelta from pytz imp...
waqasbhatti/astroph-coffee
src/coffeehandlers.py
Python
mit
91,422
""" This file was generated with the customdashboard management command and contains the class for the main dashboard. To activate your index dashboard add the following to your settings.py:: GRAPPELLI_INDEX_DASHBOARD = 'version3.dashboard.CustomIndexDashboard' """ from django.utils.translation import ugettext_la...
bittssystem/version3
dashboard.py
Python
mit
4,121
"""Test event helpers.""" # pylint: disable=protected-access,too-many-public-methods # pylint: disable=too-few-public-methods import unittest from datetime import datetime, timedelta from astral import Astral from homeassistant.bootstrap import setup_component import homeassistant.core as ha from homeassistant.const ...
leoc/home-assistant
tests/helpers/test_event.py
Python
mit
13,995
""" .. moduleauthor:: Chris Dusold <DriveLink@chrisdusold.com> A module containing general purpose, cross instance hashing. This module intends to make storage and cache checking stable accross instances. """ from drivelink.hash._hasher import hash from drivelink.hash._hasher import frozen_hash from drivelink.hash._...
cdusold/DriveLink
drivelink/hash/__init__.py
Python
mit
357
from unittest import TestCase import pandas as pd import pandas.util.testing as tm import numpy as np import trtools.core.topper as topper import imp imp.reload(topper) arr = np.random.randn(10000) s = pd.Series(arr) df = tm.makeDataFrame() class TestTopper(TestCase): def __init__(self, *args, **kwargs): ...
dalejung/trtools
trtools/core/tests/test_topper.py
Python
mit
8,499
import sys def main(): with open(sys.argv[1]) as input_file: for line in input_file.readlines(): input_list = list(reversed(line.strip().split(' '))) index = int(input_list[0]) del input_list[0] print(input_list[index - 1]) if __name__ == '__main__': ma...
leaen/Codeeval-solutions
mth-to-last-element.py
Python
mit
325
""" Summary: Container and main interface for accessing the Tuflow model and a class for containing the main tuflow model files (Tcf, Tgc, etc). There are several other classes in here that are used to determine the order of the files in the model and key words for reading in the files. ...
duncan-r/SHIP
ship/tuflow/tuflowmodel.py
Python
mit
22,689
from math import floor, log10 def round_(x, n): """Round a float, x, to n significant figures. Caution should be applied when performing this operation. Significant figures are an implication of precision; arbitrarily truncating floats mid-calculation is probably not Good Practice in almost all cases. Rounding...
corriander/python-sigfig
sigfig/sigfig.py
Python
mit
2,902
#!/usr/bin/env python3 # Copyright (c) 2009-2019 The Bitcoin Core developers # Copyright (c) 2014-2019 The DigiByte Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test fee estimation code.""" from decimal import...
digibyte/digibyte
test/functional/feature_fee_estimation.py
Python
mit
11,548
#!/usr/bin/env python # -*- coding: utf-8 -*- import SocketServer import time HOST = '' PORT = 1234 ADDR = (HOST, PORT) class MyRequestHandler(SocketServer.StreamRequestHandler): def handle(self): print('...connected from: {}'.format(self.client_address)) self.wfile.write('[{}] {}'.format(time....
Furzoom/learnpython
app/test/TsTservSS.py
Python
mit
553
# 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_09_01/operations/_virtual_router_peerings_operations.py
Python
mit
22,524
from helper_sql import sqlExecute def insert(t): sqlExecute('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)
bmng-dev/PyBitmessage
src/helper_sent.py
Python
mit
132
from . import adaptVor_driver from .adaptVor_driver import AdaptiveVoronoiDriver
westpa/westpa
src/westext/adaptvoronoi/__init__.py
Python
mit
82
import os import sys def main(): if len(sys.argv) != 2: print("Usage: Pass the file name for the source transcript txt file.") sys.exit(-1) file = sys.argv[1] out_file = os.path.expanduser( os.path.join( '~/Desktop', os.path.basename(file) ) ) ...
mikeckennedy/python_bytes_show_notes
tools/otter_ai_to_our_format.py
Python
mit
1,657
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import json import os from typing import Any, Dict, Iterator, List from dataflow.core.utterance_tokenizer import UtteranceTokenizer from dataflow.multiwoz.create_programs import create_programs_for_trade_dialogue from dataflow.multiwoz.salience...
microsoft/task_oriented_dialogue_as_dataflow_synthesis
tests/test_dataflow/multiwoz/test_create_programs.py
Python
mit
10,600
""" The MIT License Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel 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 ...
jasonrubenstein/python_oauth2
oauth2/__init__.py
Python
mit
29,031
# We slice the array in two parts at index d, then print them # in reverse order. n, d = map(int, input().split()) A = list(map(int, input().split())) print(*(A[d:] + A[:d]))
yznpku/HackerRank
solution/practice/data-structures/arrays/array-left-rotation/solution.py
Python
mit
177
from django import template from django.utils.encoding import smart_str from django.core.urlresolvers import reverse, NoReverseMatch from django.db.models import get_model from django.db.models.query import QuerySet register = template.Library() class GroupURLNode(template.Node): def __init__(self, view_name, g...
ericholscher/pinax
pinax/apps/groups/templatetags/group_tags.py
Python
mit
3,311
import unittest import unittest.mock as mock import dice import dice_config as dcfg import dice_exceptions as dexc class DiceInputVerificationTest(unittest.TestCase): def test_dice_roll_input_wod(self): examples = {'!r 5':[5, 10, None, 10, 8, 'wod', None], '!r 2000':[2000, 10, None, 10,...
brmedeiros/dicey9000
tests.py
Python
mit
7,240
import tensorflow as tf import numpy as np from baselines.ppo2.model import Model class MicrobatchedModel(Model): """ Model that does training one microbatch at a time - when gradient computation on the entire minibatch causes some overflow """ def __init__(self, *, policy, ob_space, ac_space, nbat...
openai/baselines
baselines/ppo2/microbatched_model.py
Python
mit
3,241
import django # Django 1.5 add support for custom auth user model from django.conf import settings if django.VERSION >= (1, 5): AUTH_USER_MODEL = settings.AUTH_USER_MODEL else: try: from django.contrib.auth.models import User AUTH_USER_MODEL = 'auth.User' except ImportError: raise...
maroux/django-relationships
relationships/compat.py
Python
mit
563
from PyQt4.QtGui import * import pypipe.formats import pypipe.basefile from pypipe.core import pipeline from widgets.combobox import ComboBox class AddFileDialog(QDialog): def __init__(self, parent=None): super(AddFileDialog, self).__init__(parent) self.formats_combo = ComboBox() self.fi...
ctlab/pypipe
pypipe-gui/windows/addfiledialog.py
Python
mit
2,392
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bitcamp.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
jerrrytan/bitcamp
bitcamp/manage.py
Python
mit
250
from .lattice import default_optics_mode from .lattice import energy from .accelerator import default_vchamber_on from .accelerator import default_radiation_on from .accelerator import accelerator_data from .accelerator import create_accelerator from .families import get_family_data from .families import family_mapp...
lnls-fac/sirius
pymodels/TS_V03_03/__init__.py
Python
mit
474
# This file is part of Scapy # See http://www.secdev.org/projects/scapy for more informations # Copyright (C) Santiago Hernandez Ramos <shramos@protonmail.com> # This program is published under GPLv2 license from scapy.packet import Packet, bind_layers from scapy.fields import FieldLenField, BitEnumField, StrLenField...
CodeNameGhost/shiva
thirdparty/scapy/contrib/mqtt.py
Python
mit
8,943
#!/usr/bin/env python from setuptools import setup, find_packages setup( description='RESTful Nagios/Icinga Livestatus API', author='Christoph Oelmueller', url='https://github.com/zwopiR/lsapi', download_url='https://github.com/zwopiR/lsapi', author_email='christoph@oelmueller.info', version='0...
zwopiR/lsapi
setup.py
Python
mit
511
from __future__ import unicode_literals from __future__ import absolute_import import json import logging import logging.config import os class AlpineObject(object): """ Base Class of Alpine API objects """ # # alpine alpine version string # _alpine_api_version = "v1" _min_alpine_ver...
AlpineNow/python-alpine-api
alpine/alpineobject.py
Python
mit
2,190
# #calibrate.py # #calibrate fits images using darks, flats, and bias frames #corrected image = (image - bias - k(dark-bias))/flat #for k=1, i.e. image exp = dark exp, corrected image = (image - dark)/flat import os import glob import math import subprocess import re import sys import datetime import shutil from decim...
mcnowinski/various-and-sundry
lightcurve/super.calibrate.py
Python
mit
10,853
import time def check_vertical(matrix): max_product = 0 for row in xrange(0, len(matrix)-3): for col in xrange(0, len(matrix)): product = matrix[row][col] * matrix[row+1][col] * matrix[row+2][col] * matrix[row+3][col] max_product = max(product, max_product) return max_product def check_horizontal(matrix)...
CianciuStyles/project-euler
011.py
Python
mit
1,763
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.Create...
nyrocron/tracking-server
tracker/migrations/0001_initial.py
Python
mit
2,159
# -*- coding: utf-8 -*- from django.conf.urls import url from dictionaries.items.views import DicItemsListView, DicItemsCreateView, \ DicItemsDetailView, DicItemsUpdateView, DicItemsDeleteView urlpatterns = [ url(r'^$', DicItemsListView.as_view(), name='items-list'), url(r'^add/$', DicItemsCreateView.as_v...
mitrofun/kids2
src/apps/dictionaries/items/urls.py
Python
mit
637
from flask.ext.sqlalchemy import SQLAlchemy from . import db class Role(db.Model): __tablename__='roles' id=db.Column(db.Integer,primary_key=True) name=db.Column(db.String(64),unique=True) users=db.relationship('User',backref='role') def __repr__(self): return '<Role>{}</Role>'.format(self....
zhangmingkai4315/Flask-Web-App
app/models.py
Python
mit
628
SCHEDULE_NONE = None SCHEDULE_HOURLY = '0 * * * *' SCHEDULE_DAILY = '0 0 * * *' SCHEDULE_WEEKLY = '0 0 * * 0' SCHEDULE_MONTHLY = '0 0 1 * *' SCHEDULE_YEARLY = '0 0 1 1 *'
frictionlessdata/datapackage-pipelines
datapackage_pipelines/generators/schedules.py
Python
mit
171
from django.conf.urls import patterns, include, url from django.contrib import admin import urls from apps.blog import views urlpatterns = patterns('', # Examples: # url(r'^$', 'gigsblog.views.home', name='home'), # url(r'^blog/', include('blog.urls')), # url(r'^admin/', include(admin.site.urls)), ...
gusaul/gigsblog
urls/main.py
Python
mit
683
#!/usr/bin/python # -*- coding: utf8 -*- from bs4 import BeautifulSoup as Soup import urls import re import proxy from datetime import * import time from time import mktime import functions def materials ( config ): url = "https://www.lectio.dk/lectio/%s/MaterialOverview.aspx?holdelement_id=%s" % ( str(config["schoo...
boh1996/LectioAPI
scrapers/materials.py
Python
mit
2,102
#!/usr/bin/env python # Copyright (c) 2011-2015 SEOmoz, Moz # # 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, mod...
seomoz/SEOmozAPISamples
python/setup.py
Python
mit
1,723
import json import datetime import threading from base_plugin import * import base_plugin #=============================================Messaging=================================== def send_message(recipient, message, mtype='chat'): ''' Send a message to recipient. :param recipient: The To field of your messa...
Gehn/JustAChatBot
plugin_utils.py
Python
mit
5,651
def cheese_and_crackers(cheese_count,boxes_of_crackers): print "You have %d cheeses!" % cheese_count print "You have %d boxes of crackers!" % boxes_of_crackers print "Man that's enough for a party!" print "Get a blanket.\n" print "We can just give the function numbers directly:" cheese_and_crackers(20,...
BeeBubble/SnakeRace
LPTHW/ex019.py
Python
mit
673
from babymaker import BabyMaker, EnumType, IntType, StringType, UUIDType, FieldType, DatetimeType, FloatType, EmbedType import unittest import string import sys from datetime import datetime, timedelta class TestMakeSomeBabies(unittest.TestCase): def test_make_one(self): fields = { "id": UUID...
bvalerius/py-babymaker
tests/test_babymaker.py
Python
mit
9,457