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 |
|---|---|---|---|---|---|
from direct.directnotify import DirectNotifyGlobal
from toontown.parties.DistributedPartyActivityAI import DistributedPartyActivityAI
from direct.task import Task
import PartyGlobals
class DistributedPartyJukeboxActivityBaseAI(DistributedPartyActivityAI):
notify = DirectNotifyGlobal.directNotify.newCategory("Distr... | ToonTownInfiniteRepo/ToontownInfinite | toontown/parties/DistributedPartyJukeboxActivityBaseAI.py | Python | mit | 4,954 |
import sys, unittest, os
sys.path.append(os.path.realpath(os.path.dirname(__file__))+'/lib')
tests_folder = os.path.realpath(os.path.dirname(__file__))+'/tests'
from tests import ConsoleTestRunner
def load_tests(loader, tests, pattern):
suite = unittest.TestSuite()
pattern='test_*.py'
for dirname, dirnames, f... | creative-workflow/pi-setup | test.py | Python | mit | 748 |
"""
WSGI config for bball_intel 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bball_intel.settings.base")
from ... | ltiao/basketball-intelligence | bball_intel/bball_intel/wsgi.py | Python | mit | 437 |
import re
import sys
import requests
from django.conf import settings
from django.core.management import BaseCommand
from requests.exceptions import InvalidJSONError, RequestException
from .import_measures import BadRequest
from .import_measures import Command as ImportMeasuresCommand
from .import_measures import Imp... | ebmdatalab/openprescribing | openprescribing/frontend/management/commands/preview_measure.py | Python | mit | 4,017 |
import unittest
from fire_risk.models import DIST
class TestDISTModel(unittest.TestCase):
def test_dist_import(self):
floor_extent = False
results = {'floor_of_origin': 126896L,
'beyond': 108959L,
'object_of_origin': 383787L,
'room_of_orig... | garnertb/fire-risk | tests/models/tests.py | Python | mit | 559 |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.ndimage import gaussian_filter
from srxraylib.plot.gol import plot
from oasys.util.oasys_util import write_surface_file
from srxraylib.metrology.profiles_simulation import slopes
# def transform_data(file_name):
#
# """... | srio/shadow3-scripts | METROLOGY/surface2d_to_hdf5.py | Python | mit | 6,588 |
from rest_framework.decorators import list_route
from rest_framework.permissions import IsAuthenticated
from rest_framework import viewsets
from .models import User
from .serializers import UserSerializer
class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all()
serializer_class = UserSerializer... | mnazim/django-rest-kickstart | users/views.py | Python | mit | 362 |
''' Wrapper around session access. Keep track of session madness as the app grows. '''
import logging
logger = logging.getLogger("pyfb")
FB_ACCESS_TOKEN = "fb_access_token"
FB_EXPIRES = "fb_expires"
FB_USER_ID = "fb_user_id"
def get_fb_access_token(request, warn=True):
token = request.session.get(FB_ACCESS_TOKE... | bdelliott/pyfb | pyfb_django/session.py | Python | mit | 1,100 |
#!/usr/bin/python
"""test_Read.py to test the Read class.
Requires:
python 2 (https://www.python.org/downloads/)
nose 1.3 (https://nose.readthedocs.org/en/latest/)
Joy-El R.B. Talbot Copyright (c) 2014
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this... | Joy-El/metagene_analysis | test_Read.py | Python | mit | 9,434 |
"""
@file
@brief This extension contains various functionalities to help unittesting.
"""
import os
import stat
import sys
import re
import warnings
import time
import importlib
from contextlib import redirect_stdout, redirect_stderr
from io import StringIO
def _get_PyLinterRunV():
# Separate function to speed up... | sdpython/pyquickhelper | src/pyquickhelper/pycode/utils_tests_helper.py | Python | mit | 20,810 |
import re
from LUIObject import LUIObject
from LUISprite import LUISprite
from LUILabel import LUILabel
from LUIInitialState import LUIInitialState
from LUILayouts import LUIHorizontalStretchedLayout
__all__ = ["LUIInputField"]
class LUIInputField(LUIObject):
""" Simple input field, accepting text input. This ... | tobspr/LUI | Builtin/LUIInputField.py | Python | mit | 8,056 |
# -----------
# User Instructions:
#
# Modify the the search function so that it returns
# a shortest path as follows:
#
# [['>', 'v', ' ', ' ', ' ', ' '],
# [' ', '>', '>', '>', '>', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', '*']]
#
# Where '>', '<', '^'... | jjaviergalvez/CarND-Term3-Quizzes | search/print-path.py | Python | mit | 2,943 |
# Mostly from http://peterdowns.com/posts/first-time-with-pypi.html
from distutils.core import setup
setup(
name = 'pmdp',
packages = ['pmdp'],
version = '0.3',
description = 'A poor man\'s data pipeline',
author = 'Dan Goldin',
author_email = 'dangoldin@gmail.com',
url = 'https://github.com/dangoldin/po... | dangoldin/poor-mans-data-pipeline | setup.py | Python | mit | 491 |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import pytest
from dataproperty import get_integer_digit, get_number_of_digit
nan = float("nan")
inf = float("inf")
class Test_get_integer_digit:
@pytest.mark.parametrize(
["value", "expected"],
[
[0, 1],
... | thombashi/DataProperty | test/test_function.py | Python | mit | 4,806 |
#We don't use sagenb.notebook.run_notebook because we want the server in the same python environment as our app so we have access to the Notebook and Worksheet objects.
#########
# Flask #
#########
import os, random
from guru.globals import GURU_PORT, GURU_NOTEBOOK_DIR
import sagenb.notebook.notebook as notebook
f... | rljacobson/Guru | guru/RunFlask.py | Python | mit | 2,460 |
"""
search.py
"""
from flask import Flask, request, redirect, abort, make_response
from flask import render_template, flash
import bibserver.dao
from bibserver import auth
import json, httplib
from bibserver.config import config
import bibserver.util as util
import logging
from logging.handlers import RotatingFileHand... | jasonzou/MyPapers | bibserver/search.py | Python | mit | 19,340 |
import json
import os
import avasdk
from zipfile import ZipFile, BadZipFile
from avasdk.plugins.manifest import validate_manifest
from avasdk.plugins.hasher import hash_plugin
from django import forms
from django.core.validators import ValidationError
from .validators import ZipArchiveValidator
class PluginArchive... | ava-project/ava-website | website/apps/plugins/forms.py | Python | mit | 2,440 |
from django.core.management.base import BaseCommand
from optparse import make_option
from django.utils import timezone
from orcamentos.proposal.models import Proposal
class Command(BaseCommand):
help = ''' Conclui orçamento. '''
option_list = BaseCommand.option_list + (
make_option('--num', help='núme... | rg3915/orcamentos | orcamentos/core/management/commands/conclude_proposal.py | Python | mit | 1,080 |
"""
Django settings for paulpruitt_net project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ... | ppruitt/site | site/paulpruitt_net/settings.py | Python | mit | 2,273 |
"""
HTTP handeler to serve specific endpoint request like
http://myserver:9004/endpoints/mymodel
For how generic endpoints requests is served look
at endpoints_handler.py
"""
import json
import logging
import shutil
from tabpy.tabpy_server.common.util import format_exception
from tabpy.tabpy_server.handlers import Ma... | tableau/TabPy | tabpy/tabpy_server/handlers/endpoint_handler.py | Python | mit | 4,926 |
# PPPPPPPP
# PP PP t hh
# PP - PP tt hh
# PP PP yy - yy tttttttt hh hhhh ooooooo nn nnnnn -----------... | SonyStone/pylib | Python_tutorial.py | Python | mit | 36,258 |
from boto3.dynamodb.conditions import Attr
def update_users_followers(username, follower_id, table, remove=False):
'''
Find all the users that %username% follows and
update their "followers" list and "followers_count" amount
'''
item = table.get_item(Key={'username': username}).get('Item', False)... | vz10/secretBot | db_actions.py | Python | mit | 3,577 |
# -*- coding: utf-8 -*-
# author: bambooom
'''
My Diary Web App - CLI for client
'''
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import requests
from bs4 import BeautifulSoup
import re
HELP = '''
Input h/help/? for help.
Input q/quit to quit the process.
Input s/sync to sync the diary log.
Input lt/List... | bambooom/OMOOC2py | _src/om2py5w/5wex0/client.py | Python | mit | 2,054 |
from pytest import fixture
from functional.core import (
builder,
PreparedImagesOutputChecker,
PDFDocumentChecker,
DjVuDocumentChecker)
@fixture()
def checker_classes():
""" Run all checkers in one test for optimization reason. """
return [
PreparedImagesOutputChecker,... | atrosinenko/lecture-notes-compiler | tests/functional/core_test.py | Python | mit | 5,334 |
import collections
import contextlib
import copy
import json
import warnings
import numpy
import six
from chainer.backends import cuda
from chainer import configuration
from chainer import serializer as serializer_module
from chainer import variable
def _copy_variable(value):
if isinstance(value, variable.Varia... | rezoo/chainer | chainer/reporter.py | Python | mit | 13,600 |
import scrapenhl_globals
import scrape_game
def scrape_games(season, games, force_overwrite = False, pause = 1, marker = 10):
"""
Scrapes the specified games.
Parameters
-----------
season : int
The season of the game. 2007-08 would be 2007.
games : iterable of ints (e.g. list)
... | muneebalam/scrapenhl | scrapenhl/scrape_season.py | Python | mit | 13,272 |
#!/usr/bin/env python
import os
import sys
sys.path.append('/var/www/vehicle-journal/vjournal')
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vjournal.settings.prod")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| cslansing/vehicle-journal | manage.py | Python | mit | 310 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""build query for doclistview and return results"""
import frappe, json
import frappe.permissions
from frappe.model.db_query import DatabaseQuery
from frappe import _
@frappe.w... | rohitwaghchaure/frappe | frappe/desk/reportview.py | Python | mit | 8,532 |
import datetime
import time
import calendar
from django.core.urlresolvers import reverse
from django.http import Http404
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import Http404
from django.shortcuts import render, redirect
from rolepermissi... | mcdermott-scholars/mcdermott | mccalendar/views.py | Python | mit | 4,577 |
'''
==================
RBF SVM parameters
==================
This example illustrates the effect of the parameters ``gamma`` and ``C`` of
the Radial Basis Function (RBF) kernel SVM.
Intuitively, the ``gamma`` parameter defines how far the influence of a single
training example reaches, with low values meaning 'far' a... | DailyActie/Surrogate-Model | 01-codes/scikit-learn-master/examples/svm/plot_rbf_parameters.py | Python | mit | 8,095 |
import pytest
from named_dates.named_dates import\
day_of_nth_weekday, NoNthWeekdayError
# For reference throughout these tests, October 1, 2015 is
# a Thursday (weekday = 3).
def test_weekday_equals_first_of_month():
# Tests that day_of_nth_weekday works when the requested weekday is the
# first weekday... | pschoenfelder/named-dates | tests/test_day_of_nth_weekday.py | Python | mit | 2,862 |
#!/usr/bin/env python3
# Copyright (c) 2013-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#
import re
import sys
import dns.resolver
import collect... | deeponion/deeponion | contrib/seeds/makeseeds.py | Python | mit | 8,058 |
class Node:
def __init__(self, value):
self.value = value
self.next = None
self.prev = None
class OldestUnique:
def __init__(self):
self.uniq = {}
self.seen = set()
self.head = None
self.tail = None
def feed(self, value):
if value in self.un... | frasertweedale/drill | py/oldest_unique.py | Python | mit | 1,106 |
"""
MIT License
Copyright (c) 2017 cgalleguillosm, AlessioNetti
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, ... | cgalleguillosm/accasim | accasim/base/scheduler_class.py | Python | mit | 26,009 |
# -*- coding: utf-8 -*-
u"""歌詞コーパスの取得
"""
import argparse
import requests
import logging
import urllib, urllib2
import re
import time
from BeautifulSoup import BeautifulSoup
verbose = False
logger = None
def init_logger():
global logger
logger = logging.getLogger('GetLyrics')
logger.setLevel(logging.DEB... | jntkym/rappers | getlyrics.py | Python | mit | 3,885 |
#!/usr/bin/env python3
class OutputParser(object):
def __init__(self, fmt, file_to_parse):
self.fmt = fmt.upper()
self.file_to_parse = file_to_parse
def parse(self):
""" Wrapper function in case I want to be able to parse other formats at some time """
if self.fmt == "GFF3":
... | hunter-cameron/Bioinformatics | python/interproscanner.py | Python | mit | 7,965 |
# This module file is for parsing the github project.
from AutoDoApp.parser.ParserCommunicator import ParserCommunicator
import os
import codecs
import git
import stat
from django.conf import settings
class Parser(ParserCommunicator):
def __init__(self):
self.git_dir = ""
self.dir_dict = {}
... | AutoDo/AutoDo | AutoDoApp/parser/Parser.py | Python | mit | 9,117 |
# -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
A Grouper establishes a group of parenting nodes for which
each level is setted in equivalent hdf5 structure.
"""
#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYour... | Ledoux/ShareYourSystem | Pythonlogy/draft/Noders/Grouper/Drafts/__init__ copy.py | Python | mit | 4,755 |
"""
问题描述:给定一个正数数组arr,其中所有的值都为整数,以下是最小不可组成和的概念:
1)把arr每个子集内的所有元素加起来会出现很多值,其中最小的记为min,最大的记为max.
2)在区间[min,max]上,如果有数不可以被arr某一个子集相加得到,那么其中最小的那个数是
arr的最小不可组成和.
3)在区间[min,max]上,如果所有的数都可以被arr的某一个子集相加得到,那么max+1是arr
的最小不可组成和.
请写函数返回正数数组arr的最小不可组成和.
举例:
arr=[3, 2, 5],子集{2}相加产生2为min,子集{3, 2, 5}相加产生10为max.在区间[2, 10]
上,4、6和9不能被任何... | ResolveWang/algrithm_qa | other/q14.py | Python | mit | 2,801 |
##
# Copyright 2009-2013 Ghent University
#
# This file is part of EasyBuild,
# 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),
# the Hercules foundation (htt... | ULHPC/modules | easybuild/easybuild-easyblocks/easybuild/easyblocks/f/fastqc.py | Python | mit | 1,735 |
# -*- coding: utf-8 -*-
"""
object file io is a Python object to single file I/O framework. The word
'framework' means you can use any serialization/deserialization algorithm here.
- dump: dump python object to a file.
- safe_dump: add atomic writing guarantee for ``dump``.
- load: load python object from a file.
Fe... | MacHu-GWU/single_file_module-project | sfm/obj_file_io.py | Python | mit | 6,059 |
# encoding: utf-8
'''Template filters
'''
def j(s):
"""Escape for JavaScript or encode as JSON"""
pass
try:
from cjson import encode as _json
except ImportError:
try:
from minjson import write as _json
except ImportError:
import re
_RE = re.compile(r'(["\'\\])')
def _json(s):
return re... | rsms/smisk | lib/smisk/mvc/template/filters.py | Python | mit | 375 |
#!/usr/bin/python3
#JMP:xkozub03
import sys
import re
import Config
from Config import exit_err
macro_list = {};
def init_list(redef_opt):
def_macro = Macro("@def");
set_macro = Macro("@set");
let_macro = Macro("@let");
null_macro = Macro("@null");
_def_macro = Macro("@__def__");
_set_macro = Macro("@__set__"... | mikeek/FIT | IPP/proj_2/Macro.py | Python | mit | 4,768 |
from staffjoy.resource import Resource
from staffjoy.resources.worker import Worker
from staffjoy.resources.schedule import Schedule
from staffjoy.resources.shift import Shift
from staffjoy.resources.shift_query import ShiftQuery
from staffjoy.resources.recurring_shift import RecurringShift
class Role(Resource):
... | Staffjoy/client_python | staffjoy/resources/role.py | Python | mit | 1,528 |
"""
WSGI config for eyrie 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWh... | ZeroCater/Eyrie | eyrie/wsgi.py | Python | mit | 478 |
import os
import dec
print 'Building HOG feature extractor...'
os.system('python setup_features.py build')
os.system('python setup_features.py install')
print 'Preparing stl data. This could take a while...'
dec.make_stl_data()
| piiswrong/dec | dec/make_stl_data.py | Python | mit | 229 |
import pygame
import rospy
import time
from std_msgs.msg import Float64
from std_msgs.msg import Float64MultiArray
#pygame setup
pygame.init()
pygame.display.set_mode([100,100])
delay = 100
interval = 50
pygame.key.set_repeat(delay, interval)
#really this should be passed in or something but for now if you want to ... | robotics-at-maryland/qubo | src/teleop/src/keyboard_controller.py | Python | mit | 2,473 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('catalogue', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='Cd',
new_name='Relea... | ThreeDRadio/playlists | backend/catalogue/migrations/0002_auto_20160628_1024.py | Python | mit | 342 |
# !/usr/bin/env python3
# _*_ coding:utf8 _*_
# Power by zuosc 2016-10-23
'subclass demo 继承和多态'
class Animal(object):
def run(self):
print('Animal is running......')
class Dog(Animal):
def run(self):
print('Dog is running.....')
def eat(self):
print('dog is eating......')
cla... | zuosc/PythonCode | OOP/subclass.py | Python | mit | 378 |
#!/usr/bin/env python3
"""Project Euler - Problem 27 Module"""
def problem27(ab_limit):
"""Problem 27 - Quadratic primes"""
# upper limit
nr_primes = 2 * ab_limit * ab_limit + ab_limit
primes = [1] * (nr_primes - 2)
result = 0
for x in range(2, nr_primes):
if primes[x - 2] == 1:
... | rado0x54/project-euler | python/problem0027.py | Python | mit | 1,182 |
from myhdl import *
from UK101AddressDecode import UK101AddressDecode
def bench():
AL = Signal(intbv(0)[16:])
MonitorRom = Signal(bool(0))
ACIA = Signal(bool(0))
KeyBoardPort = Signal(bool(0))
VideoMem = Signal(bool(0))
BasicRom = Signal(bool(0))
Ram = Signal(bool(0))
dut = UK101Addr... | jandecaluwe/myhdl-examples | crusty_UK101/UK101AddressDecode/bench.py | Python | mit | 691 |
import copy
import json
from psycopg2.extensions import AsIs
from psycopg2.extras import RealDictCursor
from pg4nosql import DEFAULT_JSON_COLUMN_NAME, DEFAULT_ROW_IDENTIFIER
from pg4nosql.PostgresNoSQLQueryStructure import PostgresNoSQLQueryStructure
from pg4nosql.PostgresNoSQLResultItem import PostgresNoSQLResultItem
... | cansik/pg4nosql | pg4nosql/PostgresNoSQLTable.py | Python | mit | 4,608 |
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
from flexget.manager import Session
try:
from flexget.plugins.api_trakt import ApiTrakt
lookup_series = ApiTrakt.lookup_series
lookup_episode = ApiTrakt.lookup_episo... | patsissons/Flexget | flexget/plugins/metainfo/trakt_lookup.py | Python | mit | 5,155 |
import re
def snake_to_camel(snake, upper_first=False):
# title-cased words
words = [word.title() for word in snake.split('_')]
if words and not upper_first:
words[0] = words[0].lower()
return ''.join(words)
def camel_to_snake(camel):
# first upper-cased camel
camel = camel[0].uppe... | jfcherng/sublime-TypeShort | functions.py | Python | mit | 401 |
class Optimizer:
def __init__(self, model, params=None):
self.model = model
if params:
self.model.set_params(**params)
self.params = self.model.get_params()
self.__chain = list()
def step(self, name, values, skipped=False):
if not skipped:
self._... | danielwpz/soybean | src/util/optimizer.py | Python | mit | 1,090 |
#!/usr/bin/env python
import sys
import os
import re
try:
path = sys.argv[1]
length = int(sys.argv[2])
except:
print >>sys.stderr, "Usage: $0 <path> <length>"
sys.exit(1)
path = re.sub(os.getenv('HOME'), '~', path)
while len(path) > length:
dirs = path.split("/");
# Find the longest directo... | werebus/dotfiles | bin/shorten_path.py | Python | mit | 772 |
from rapt.treebrd.attributes import AttributeList
from ...treebrd.node import Operator
from ..base_translator import BaseTranslator
class SQLQuery:
"""
Structure defining the building blocks of a SQL query.
"""
def __init__(self, select_block, from_block, where_block=''):
self.prefix = ''
... | pyrapt/rapt | rapt/transformers/sql/sql_translator.py | Python | mit | 8,668 |
from .fft_tools import zoom
import numpy as np
import matplotlib.pyplot as pl
def iterative_zoom(image, mindiff=1., zoomshape=[10,10],
return_zoomed=False, zoomstep=2, verbose=False,
minmax=np.min, ploteach=False, return_center=True):
"""
Iteratively zoom in on the *minimum* position in an imag... | keflavich/image_registration | image_registration/iterative_zoom.py | Python | mit | 8,555 |
"""Tests for IPython.lib.display.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/IPython/lib/tests/test_display.py | Python | mit | 9,210 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import organizations
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
os.system('python setup.py bdist_wheel upload')
sy... | bennylope/django-site-broadcasts | test.py | Python | mit | 1,601 |
"""A set of AST classes with types and aliases filled in."""
import collections
import type_context
class Select(collections.namedtuple(
'Select', ['select_fields', 'table', 'where_expr', 'group_set',
'limit', 'type_ctx'])):
"""A compiled query.
Fields:
select_fields: A l... | burnhamup/tinyquery | tinyquery/typed_ast.py | Python | mit | 5,461 |
"""
Init
"""
from __future__ import unicode_literals
import datetime
import os
import subprocess
VERSION = (2, 2, 13, 'final', 0)
def get_version(version=None):
"""
Returns a PEP 386-compliant version number from VERSION.
"""
if not version:
version = VERSION
else:
assert len(ver... | RyanNoelk/ClanLadder | django_ajax/__init__.py | Python | mit | 1,900 |
# encoding: utf-8
import os
def emulator_rom_launch_command(emulator, rom):
"""Generates a command string that will launch `rom` with `emulator` (using
the format provided by the user). The return value of this function should
be suitable to use as the `Exe` field of a Steam shortcut"""
# Normalizing the stri... | scottrice/Ice | ice/emulators.py | Python | mit | 1,887 |
#!/usr/bin/env python
#
# This example shows the different aspects of user/team management.
#
import sys
from sdcclient import SdcClient
#
# Parse arguments
#
if len(sys.argv) != 4:
print(('usage: %s <sysdig-token> team-name user-name' % sys.argv[0]))
print('You can find your token at https://app.sysdigcloud... | draios/python-sdc-client | examples/user_team_mgmt.py | Python | mit | 2,675 |
class Solution(object):
def minDistance(self, word1, word2):
"""
:type word1: str
:type word2: str
:rtype: int
"""
row = len(word1) + 1
col = len(word2) + 1
dp = [[0] * col for _ in range(row)]
for i in range(col):
dp[0][i] = i
... | ChuanleiGuo/AlgorithmsPlayground | LeetCodeSolutions/python/72_Edit_Distance.py | Python | mit | 727 |
from linkedlist import SinglyLinkedListNode
def reverseList(head):
tail=None
last=None
tempNode = head
while tempNode is not None:
currentNode, tempNode = tempNode, tempNode.next
currentNode.next = tail
tail = currentNode
return tail
def reverseListKNode(head,k):
... | pankajanand18/python-tests | linkedlists/reverserlist.py | Python | mit | 1,457 |
# vim:ts=4 sw=4 expandtab softtabstop=4
import unittest
import warnings
from collections import OrderedDict
import jsonmerge
import jsonmerge.strategies
from jsonmerge.exceptions import (
HeadInstanceError,
BaseInstanceError,
SchemaError
)
from jsonmerge.jsonvalue import JSONValue
import jsonschema
try:
... | avian2/jsonmerge | tests/test_jsonmerge.py | Python | mit | 69,662 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from annotations.models import Corpus
from annotations.exports import export_fragments
from core.utils import CSV, XLSX
class Command(BaseCommand):
help = 'Exports existing Fragments for the given Corpus and Languages'
... | UUDigitalHumanitieslab/timealign | annotations/management/commands/export_fragments.py | Python | mit | 1,823 |
from pymongo import MongoClient
from pymongo.collection import Collection
from pymongo.errors import AutoReconnect
from django.conf import settings
from types import FunctionType
import functools
import time
__all__ = ("connection", "connections", "db", "get_db")
"""
Goals:
* To provide a clean universal handler fo... | lang-uk/lang.org.ua | languk/corpus/mongodb.py | Python | mit | 4,932 |
# coding:utf-8
import json
from django.http import HttpResponse
from django.shortcuts import render
from aircraft_config import AC_WQAR_CONFIG
from list2string_and_echarts_function import Echarts_option
from list2string_and_echarts_function import LIST_to_STR
from influxdb_function import influxDB_interface
from main... | waterwoodwind/influxDB_web | main_web/views_query.py | Python | mit | 12,937 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Run Regression Test Suite
This module calls down into individual test cases via subprocess. It will
... | ediston/energi | qa/pull-tester/rpc-tests.py | Python | mit | 8,724 |
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
import jsonfield
from .hooks import hookset
from .utils import load_path_attr
class UserState(models.Model):
"""
this stores the overall state of a particular user.
"""
user = models.OneToOneFi... | pinax/pinax-lms-activities | pinax/lms/activities/models.py | Python | mit | 4,304 |
import logging
from datetime import datetime
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
import requests
from companies.models import Company
logger = logging.getLogger('jobs.management.commands')
class Command(BaseCommand):
help = 'Update currently listed... | rodxavier/open-pse-initiative | django_project/jobs/management/commands/update_listed_companies.py | Python | mit | 1,437 |
# -*- coding: utf-8 -*-
# Copyright © 2013-2015 Damián Avila, Chris Warrick and others.
# 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
#... | masayuko/nikola | nikola/plugins/compile/ipynb.py | Python | mit | 6,349 |
SUCCESS = 0
FAILURE = 1 # NOTE: click.abort() uses this
# for when tests are already running
ALREADY_RUNNING = 2
| naphatkrit/easyci | easyci/exit_codes.py | Python | mit | 115 |
"""Support for Waterfurnaces."""
from datetime import timedelta
import logging
import threading
import time
import voluptuous as vol
from waterfurnace.waterfurnace import WaterFurnace, WFCredentialError, WFException
from homeassistant.components import persistent_notification
from homeassistant.const import (
CON... | rohitranjan1991/home-assistant | homeassistant/components/waterfurnace/__init__.py | Python | mit | 5,047 |
LONG_HORN = 750
LONG_HORN_SPACE = LONG_HORN/2
SHORT_HORN = 400
SHORT_HORN_SPACE = SHORT_HORN/2
sequences = {
'CreekFleet': {
# Three long horns immediately (three minutes to start)
0: 'LLL',
# Two long horns a minute later (two minutes to start)
60000: 'LL',
# One... | agmlego/Creekfleet_Timer | firmware/horn_sequence.py | Python | mit | 2,928 |
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from ...utils import update_sentry_404s
class Command(BaseCommand):
def handle(self, *args, **kwargs):
update_sentry_404s()
| DjangoAdminHackers/django-link-report | link_report/management/commands/update_sentry_404s.py | Python | mit | 232 |
import ReviewHelper
import pandas as pd
df = ReviewHelper.get_pandas_data_frame_created_from_bibtex_file()
# find problematic ones
df[df.metaDatasetsUsed.isnull()]
list1 = df.metaDatasetsUsed.str.split(",").tolist()
df1 = pd.DataFrame(list1)
for i in range(df1.columns.size):
df1[i] = df1[i].str.strip()
stac... | ati-ozgur/KDD99ReviewArticle | HelperCodes/create_table_metaDatasetsUsed.py | Python | mit | 1,724 |
import abjad
from abjad.tools import abctools
class TimespanSpecifier(abctools.AbjadValueObject):
### CLASS VARIABLES ###
__slots__ = (
'_forbid_fusing',
'_forbid_splitting',
'_minimum_duration',
)
### INITIALIZER ###
def __init__(
self,
forbid_fusin... | josiah-wolf-oberholtzer/consort | consort/tools/TimespanSpecifier.py | Python | mit | 1,111 |
import re
from collections import defaultdict, Counter
from ttlser import natsort
from pyontutils.core import LabelsBase, Collector, Source, resSource, ParcOnt
from pyontutils.core import makePrefixes
from pyontutils.config import auth
from pyontutils.namespaces import nsExact
from pyontutils.namespaces import NIFRID, ... | tgbugs/pyontutils | nifstd/nifstd_tools/parcellation/paxinos.py | Python | mit | 40,653 |
class WallsGate(object):
def dfs(self, rooms):
queue = [(i, j, 0) for i, rows in enumerate(rooms) for j, v in enumerate(rows) if not v]
while queue:
i, j, step = queue.pop()
if rooms[i][j] > step:
rooms[i][j] = step
for newi, newj in ((i + 1, j), ... | Tanych/CodeTracking | distance.py | Python | mit | 1,572 |
import logging
from django.db.models import DateTimeField, Model, Manager
from django.db.models.query import QuerySet
from django.db.models.fields.related import \
OneToOneField, ManyToManyField, ManyToManyRel
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now
from django... | pmuller/django-softdeletion | django_softdeletion/models.py | Python | mit | 5,119 |
from twisted.internet.protocol import Factory
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor
class NonAnonChat(LineReceiver):
def __init__(self, protocols):
self.users = {'john':'john', 'adastra':'adastra'}
self.userName = None
self.userLogged = False
self.protocols = pr... | coolhacks/python-hacks | examples/pyHacks/TwistedChat.py | Python | mit | 1,269 |
# test_sampleParser.py
import os
from ..sampleParser import SampleParser
class TestSampleParser:
def setup(self):
self.folderName = os.path.join('.', 'tests', 'Export')
self.parser = SampleParser(self.folderName)
def test_getDirectoryFiles(self):
files = self._obtainDirectory()
... | jmeline/wifi_signal_analysis | src/tests/test_sampleParser.py | Python | mit | 1,146 |
# PyAutoGUI: Cross-platform GUI automation for human beings.
# BSD license
# Al Sweigart al@inventwithpython.com (Send me feedback & suggestions!)
"""
IMPORTANT NOTE!
To use this module on Mac OS X, you need the PyObjC module installed.
For Python 3, run:
sudo pip3 install pyobjc-core
sudo pip3 install pyobjc... | osspeak/osspeak | osspeak/pyautogui/__init__.py | Python | mit | 36,647 |
# -*- coding: utf-8 -*-
'''
watdo.tests
~~~~~~~~~~~
This module contains tests for watdo.
This particular file contains tools for testing.
:copyright: (c) 2013 Markus Unterwaditzer
:license: MIT, see LICENSE for more details.
'''
| untitaker/watdo | tests/__init__.py | Python | mit | 256 |
from django.conf.urls import include, url
from ginger.views import utils
__all__ = ('include', 'url', 'scan', 'scan_to_include')
def scan(module, predicate=None):
view_classes = utils.find_views(module, predicate=predicate)
urls = []
for view in view_classes:
if hasattr(view, 'as_urls'):
... | vivsh/django-ginger | ginger/conf/urls.py | Python | mit | 580 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('agency', '0013_auto_20150726_0001'),
]
operations = [
migrations.AlterField(
model_name='feedinfo',
... | renanalencar/hermes | agency/migrations/0014_auto_20150726_1411.py | Python | mit | 468 |
'''
Problem 2
@author: Kevin Ji
'''
def sum_even_fibonacci( max_value ):
# Initial two elements
prev_term = 1
cur_term = 2
temp_sum = 2
while cur_term < max_value:
next_term = prev_term + cur_term
prev_term = cur_term
cur_term = next_term
if cur_term ... | mc10/project-euler | problem_2.py | Python | mit | 430 |
import urllib
import ast
import xchat
__module_name__ = "Define"
__module_author__ = "TingPing"
__module_version__ = "2"
__module_description__ = "Show word definitions"
# based on google dictionary script by Sridarshan Shetty - http://sridarshan.co.cc
def define(word, word_eol, userdata):
if len(word) >= 2:
_wor... | TingPing/plugins | XChat/define.py | Python | mit | 1,320 |
# 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/v2018_12_01/aio/operations/_load_balancer_network_interfaces_operations.py | Python | mit | 5,642 |
#
# This file is part of Gruvi. Gruvi is free software available under the
# terms of the MIT license. See the file "LICENSE" that was provided
# together with this source file for the licensing terms.
#
# Copyright (c) 2012-2017 the Gruvi authors. See the file "AUTHORS" for a
# complete list.
from __future__ import a... | geertj/gruvi | tests/test_jsonrpc.py | Python | mit | 27,989 |
'''
Simple pull of account info
'''
import requests
import datetime
import pickle
import json
import time
import sys
account_url = 'https://api.toodledo.com/3/account/get.php?access_token='
tasks_get_url = 'https://api.toodledo.com/3/tasks/get.php?access_token='
'''
Fields you can use to filter when you get tasks:
ht... | gadeleon/toodledo_cli_client | toodle_sync.py | Python | mit | 3,843 |
import sys
def genfib():
first, second = 0, 1
while True:
yield first
first, second = second, first + second
def fib(number):
fibs = genfib()
for i in xrange(number + 1):
retval = fibs.next()
return retval
if __name__ == '__main__':
inputfile = sys.argv[1]
with ... | MikeDelaney/CodeEval | easy/fibonacci/fib.py | Python | mit | 449 |
import time
import logging
def time_zone(t):
if t.tm_isdst == 1 and time.daylight == 1:
tz_sec = time.altzone
tz_name = time.tzname[1]
else:
tz_sec = time.timezone
tz_name = time.tzname[0]
if tz_sec > 0:
tz_sign = '-'
else:
tz_sign = '+'
tz_offset =... | jsubpy/jsub | jsub/log.py | Python | mit | 1,326 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# {{pkglts pysetup,
from os import walk
from os.path import abspath, normpath
from os.path import join as pj
from setuptools import setup, find_packages
short_descr = "Set of data structures used in openalea such as : graph, grid, topomesh"
readme = open('README.rst').re... | revesansparole/oacontainer | setup.py | Python | mit | 1,872 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
amtrak
Parse a trip itinerary of amtrak services copied into a text file.
Running the file will take a trip.txt file and output a .json with one record
for each amtrak service in the trip. You can also use the main method of the
module. Both cases, the first paramete... | abenassi/amtrak-trip | amtrak.py | Python | mit | 5,392 |
#!/bin/python3
import bisect
def is_palindrome(n):
return str(n) == str(n)[::-1]
def generate_palindromes():
return [i * j
for i in range(100, 1000)
for j in range(100, 1000)
if is_palindrome(i * j)]
def find_lt(a, x):
'Find rightmost value less than x'
i = bis... | rootulp/hackerrank | python/euler004.py | Python | mit | 570 |
# 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/v2021_02_01/aio/operations/_express_route_circuit_peerings_operations.py | Python | mit | 21,960 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.