repo_name
stringlengths
5
92
path
stringlengths
4
232
copies
stringclasses
19 values
size
stringlengths
4
7
content
stringlengths
721
1.04M
license
stringclasses
15 values
hash
int64
-9,223,277,421,539,062,000
9,223,102,107B
line_mean
float64
6.51
99.9
line_max
int64
15
997
alpha_frac
float64
0.25
0.97
autogenerated
bool
1 class
cad-lab/blog
pelicanconf.py
1
2136
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals AUTHOR = 'kmol' SITENAME = 'CADLab (虎尾科大MDE)' #SITEURL = 'http://cad-lab.github.io/blog/' # 不要用文章所在目錄作為類別 USE_FOLDER_AS_CATEGORY = False #PATH = 'content' #OUTPUT_PATH = 'output' TIMEZONE = 'Asia/Taipei' DEFAULT_LANG = 'en' #...
agpl-3.0
-7,971,731,043,801,654,000
25.92
88
0.659564
false
OSSystems/lava-server
dashboard_app/migrations/0003_add_index_HardwareDevice_device_type.py
1
13377
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding index on 'HardwareDevice', fields ['device_type', 'id'] db.create_index('dashboard_app_hardwaredevice', ...
agpl-3.0
7,930,515,979,658,715,000
78.153846
200
0.556627
false
zvoase/twactor
twactor/cache.py
1
17379
# -*- coding:utf-8 -*- # twactor.cache - Cache framework for twactor. import operator import time try: import threading except: import dummy_threading as threading from twactor import connection, function_sync, propertyfix class CachedMetaclass(type): """Metaclass for subclasses of ``CachedObject``...
mit
8,317,385,243,071,781,000
38.410431
80
0.565165
false
botswana-harvard/bhp065_project
bhp065/apps/hnscc_subject/admin/enrollment_admin.py
1
1104
from django.contrib import admin from edc.base.modeladmin.admin import BaseModelAdmin from ..forms import EnrollmentForm from ..models import Enrollment class EnrollmentAdmin(BaseModelAdmin): dashboard_type = 'subject' form = EnrollmentForm def __init__(self, *args, **kwargs): super(Enrollment...
gpl-2.0
-6,335,565,765,146,285,000
33.5
83
0.557065
false
Algomorph/gpxanalyzer
gpxanalyzer/filters/color_structure_pythonic.py
1
10874
''' Created on Apr 25, 2014 @author: Gregory Kramida @copyright: (c) Gregory Kramida 2014 @license: GNU v3 ''' import gpxanalyzer.gpxanalyzer_internals as gi import numpy as np import sys import math import timeit amplitude_thresholds = np.array([0.0, 0.000000000001, 0.037, 0.08, 0.195, 0.32],dtype=np.float64) n_ampl...
gpl-3.0
-3,584,973,421,014,598,000
35.009934
106
0.529704
false
jszymon/pacal
pacal/vartransforms.py
1
10727
"""Variable transforms. Used for mapping to infinite intervals etc.""" from __future__ import print_function from numpy import Inf from numpy import hypot, sqrt, sign from numpy import array, asfarray, empty_like, isscalar, all, equal class VarTransform(object): """Base class for variable transforms.""" de...
gpl-3.0
6,725,443,334,583,879,000
35.362712
101
0.552624
false
mrworf/multiremote
drivers/base.py
1
9963
# This file is part of multiRemote. # # multiRemote is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # multiRemote is distributed in t...
gpl-2.0
-6,278,120,524,581,041,000
33.003413
115
0.618488
false
educloudalliance/eca-auth-data
authdata/tests/test_datasources.py
1
21342
# -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2014-2015 Haltu Oy, http://haltu.fi # # 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 withou...
mit
78,538,037,284,393,550
29.512894
94
0.59785
false
kotton21/PotteryOnline
server.py
1
2940
#!/usr/bin/env python import SimpleHTTPServer import SocketServer import PotGenerator import os import logging import logging.handlers import sys import time import rotate3D2 from urlparse import urlparse, parse_qs try: os.chdir('/home/pi/PotteryOnline/') except: print 'executing from current direcory' PORT = 80...
mit
3,274,926,346,818,852,400
27.269231
125
0.708163
false
yv84/pyph
src/tests/integrate_tests/tcp_echo.py
1
5366
#!/usr/bin/env python3 """TCP echo server example.""" import argparse import asyncio import sys import os try: import signal except ImportError: signal = None from msg_log import Message from game_log import log ARGS = argparse.ArgumentParser(description="PyPh test fixtures.") ARGS.add_argument( '--se...
mit
-1,852,951,330,190,602,200
30.197674
100
0.591875
false
yeming233/rally
tests/unit/plugins/openstack/scenarios/ironic/test_utils.py
1
2990
# Copyright 2015: Mirantis Inc. # 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/LICENSE-2.0 # # Unless required b...
apache-2.0
-4,327,295,516,294,357,500
41.714286
78
0.637458
false
c-goosen/ctpug_11_july
flask/__init__.py
1
4174
from flask import Flask from flask_bootstrap import Bootstrap from flask import render_template import bootstrap import xmlrpclib from io import BytesIO import base64 app = Flask(__name__) import xmlrpclib username = 'username' #the user pwd = 'password' #the password of the user dbname = 'ctpug' #the databa...
cc0-1.0
-3,810,377,012,034,217,500
35.938053
344
0.674653
false
infrared5/massroute-pi
features/steps/bus_approaching_blink_steps.py
1
1614
from time import sleep from app.component.modifier.blinker import Blinker PINS = [0,1,2,3] DELAY = 0.2 @given('A new Blinker instance provided with a Shifter reference') def blinker_setup_with_shifter(context): shifter = context.shifter blinker = Blinker(shifter) blinker.set_pins(PINS) shifter.set_pins = Mag...
mit
2,140,165,882,895,384,600
27.333333
66
0.740397
false
ENCODE-DCC/encoded
src/encoded/tests/test_types_analysis.py
1
1533
import pytest def test_types_analysis_title( testapp, analysis_released, encode4_award, ENCODE3_award, encode_lab, file_bam_1_1, file_bam_2_1, analysis_step_run_chip_encode4, analysis_step_run_dnase_encode4, pipeline_dnase_encode4, pipeline_chip_encode4, ): testapp.pat...
mit
906,936,217,059,213,000
33.840909
103
0.590998
false
FedoraScientific/salome-hexablock
src/TEST_PY/test_unit/test_cuve.py
1
2161
# -*- coding: latin-1 -*- # Copyright (C) 2009-2014 CEA/DEN, EDF R&D # # This library 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 Free Software Foundation; either # version 2.1 of the License, or (at your option) any later...
lgpl-2.1
6,068,368,036,037,627,000
28.704225
95
0.643221
false
Groupe24/CodeInSpace
tournoi/37/game_1.py
1
62455
# -*- coding: utf-8 -*- import random import shutil import time import socket def game_preparation(file): """ Prepare the data structures need to play the game based on a .mv file. Return ------ - field: list of lists containing the characters contained in each cases of the board (list). ...
mit
6,189,446,927,990,470,000
30.716457
177
0.546866
false
allen-fdes/python_demo
cookbook/settings.py
1
2691
""" Django settings for cookbook project. Generated by 'django-admin startproject' using Django 1.8.3. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build pat...
mit
7,863,861,419,043,461,000
25.126214
71
0.691564
false
Aderemi/Artificial-Intelligence
search_algo.py
1
8943
from collections import deque from math import sqrt import sys import copy import bisect class Problem: def __init__(self, initial_board, goal_board): self.initial_board = Board(initial_board) self.goal_board = Board(goal_board) def actions(self, board): #UDLR possible_moves =...
mit
-4,797,609,425,741,345,000
28.010067
118
0.58761
false
rechner/Taxidi
dblib/postgres.py
1
40884
#!/usr/bin/env python #-*- coding:utf-8 -*- # dblib/postgres.py (spaces, not tabs) # PostgreSQL database driver for Taxídí. # Zac Sturgeon <admin@jkltech.net> # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Softwa...
gpl-3.0
-6,374,917,536,914,731,000
40.754852
129
0.538554
false
pcubillos/MCcubed
examples/demo02/preamble.py
1
1385
#! /usr/bin/env python # This script generates input files used to run MCMC from the shell prompt. # Preamble # -------- # To correctly execute this script, one needs to set the correct paths # to the source code. The paths are given as if the Python session # runs from a 'run/' folder at the same level than the rep...
mit
-8,446,834,606,013,386,000
32.780488
75
0.67509
false
mtwestra/akvo-wandelenvoorwater
wvw/W4W/models.py
1
6568
from django.db import models class school(models.Model): class Meta: verbose_name = "School" verbose_name_plural="Scholen" BRIN_NUMMER = models.CharField('BRIN code',max_length=15,blank=True, null=True) NAAM_VOLLEDIG = models.CharField('Naam school',max_length=100,blank=True, null=True) NAAM_STRAAT_VE...
agpl-3.0
8,242,833,113,469,371,000
51.544
101
0.759592
false
kaday/cylc
lib/cylc/run.py
1
3790
#!/usr/bin/env python # THIS FILE IS PART OF THE CYLC SUITE ENGINE. # Copyright (C) 2008-2015 NIWA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at yo...
gpl-3.0
8,647,605,763,508,552,000
29.32
79
0.587335
false
dchud/sentinel
canary/cmdline.py
1
2175
# $Id$ import optparse import os class CommandLine: """A helper class for canary command line tools. When you use CommandLine you will get a --config option for free, and a handy method for instantiating a Context() object. cmdline = CommandLine() cmdline.parse_args() con = cmdline.context() ...
mit
-2,743,865,366,853,403,600
29.208333
69
0.586207
false
rexyeah/jira-cli
tests/common_bridge_cases.py
1
3778
""" """ import os import vcr jiravcr = vcr.VCR( record_mode = 'once', match_on = ['uri', 'method'], ) class BridgeTests: def test_get_issue(self): with jiravcr.use_cassette(os.path.join(self.vcr_directory, "issue.yaml")): self.assertIsNotNone(self.bridge.get_issue("TP-9")) def te...
mit
1,999,886,308,777,613,300
36.79
84
0.58973
false
aemerick/galaxy_analysis
method_paper_plots/star_abundances.py
1
26128
from galaxy_analysis.plot.plot_styles import * import matplotlib.pyplot as plt import glob import deepdish as dd import yt from galaxy_analysis.utilities import utilities import numpy as np from matplotlib.ticker import NullFormatter from galaxy_analysis.particle_analysis.abundances import single_MDF # from galaxy_anal...
mit
2,397,714,309,862,547,500
35.542657
121
0.530618
false
sernst/cauldron
cauldron/session/display/__init__.py
1
23013
import json as _json_io import textwrap import typing from datetime import timedelta import cauldron as _cd from cauldron import environ from cauldron import render from cauldron.render import plots as render_plots from cauldron.render import texts as render_texts from cauldron.session import report def _get_report(...
mit
8,871,468,498,856,755,000
33.502249
79
0.655629
false
julienmalard/Tikon
pruebas/test_calibrador/test_spotpy.py
1
1920
import unittest from warnings import warn as avisar import scipy.stats as estad from pruebas.test_central.rcrs.modelo_calib import generar from tikon.calibrador.spotpy_ import EMV, RS, BDD, CMEDZ, MC, MLH, CAACAA, CAA, ECBUA, ERP, CMMC, CalibSpotPy from tikon.ecs.aprioris import APrioriDist class PruebaSpotPy(unitte...
agpl-3.0
-2,336,974,433,023,352,000
40.630435
109
0.544648
false
fanchao01/spider
mini_spider/log.py
1
2513
#!/usr/bin/env python #-*- coding:utf-8 -*- """ This module provide configure file management service in i18n environment. """ import os import logging import logging.handlers _LOG_FORMAT = "%(levelname)s: %(asctime)s: %(filename)s:%(lineno)d * %(thread)d %(message)s" _LOG_DATEFMT = "%m-%d %H:%M:%S" def init_log(lo...
gpl-2.0
-2,805,531,497,963,570,700
34.9
98
0.524473
false
stonewell/wxglterm
src/utils/app_config.py
1
1301
import os import json class DictQuery(dict): def get(self, path, default=None): try: return self.__get(path, default) except: import logging logging.exception('get failed') def __get(self, path, default=None): keys = path.split("/") val = No...
mit
-2,868,741,877,912,930,300
25.55102
69
0.520369
false
Brian-Tomasik/leveraged_investing
TaxRates.py
1
1393
class TaxRates(object): """Investor's tax rates""" def __init__(self, short_term_cap_gains_rate=.28, long_term_cap_gains_rate=.15, state_income_tax=.05): self.__short_term_cap_gains_rate = short_term_cap_gains_rate self.__long_term_cap_gains_rate = long_term_cap_gains_rate ...
unlicense
-9,186,204,606,484,050,000
40
109
0.653984
false
solo2101/Tilo-Menu
src/lib/tilo/backend.py
1
3706
#!/usr/bin/env python # This application is released under the GNU General Public License # v3 (or, at your option, any later version). You can find the full # text of the license under http://www.gnu.org/licenses/gpl.txt. # By using, editing and/or distributing this software you agree to # the terms and condition...
gpl-2.0
-6,273,977,392,544,399,000
24.040541
121
0.648948
false
utecht/random-lines
random-lines.py
1
1121
#!/usr/bin/env python import random import argparse import sys parser = argparse.ArgumentParser(description='Return random lines of file') parser.add_argument('file', type=argparse.FileType('r'), help='the input file') parser.add_argument('-n', '--num', type=int, help='number of lines to return') parser.add_argument('...
gpl-2.0
-3,425,612,094,720,691,700
30.138889
110
0.693131
false
ldiary/pytest-testbook
setup.py
1
1591
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import codecs from setuptools import setup directory_name = os.path.dirname(__file__) with codecs.open(os.path.join(directory_name, 'pytest_testbook', '__init__.py'), encoding='utf-8') as fd: VERSION = re.compile(r".*__version__ = '(.*?)'", re.S)....
mit
2,069,228,989,268,938,500
30.196078
105
0.616593
false
matthewwardrop/formulaic
formulaic/materializers/transforms/scale.py
1
1389
import numpy import scipy.sparse as spsparse from formulaic.utils.stateful_transforms import stateful_transform @stateful_transform def scale(data, center=True, scale=True, ddof=1, _state=None): data = numpy.array(data) if 'ddof' not in _state: _state['ddof'] = ddof else: ddof = _state[...
mit
-7,119,373,598,480,839,000
26.78
95
0.596112
false
erilyth/sugar
src/jarabe/view/pulsingicon.py
1
7328
# Copyright (C) 2008 One Laptop Per Child # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distribu...
gpl-2.0
-5,282,615,998,041,395,000
29.406639
79
0.602211
false
rwgdrummer/maskgen
maskgen/analytics/dctAnalytic.py
1
17525
# ============================================================================= # Authors: PAR Government # Organization: DARPA # # Copyright (c) 2016 PAR Government # All rights reserved. # # # adapted from https://github.com/enmasse/jpeg_read #==========================================================================...
bsd-3-clause
4,658,638,402,282,503,000
29.06175
96
0.473096
false
scikit-optimize/scikit-optimize
skopt/callbacks.py
1
9377
"""Monitor and influence the optimization procedure via callbacks. Callbacks are callables which are invoked after each iteration of the optimizer and are passed the results "so far". Callbacks can monitor progress, or stop the optimization early by returning `True`. """ try: from collections.abc import Callable ...
bsd-3-clause
9,038,504,553,052,238,000
28.394984
79
0.581743
false
bjackman/workload-automation
wlauto/resource_getters/standard.py
1
23149
# Copyright 2013-2015 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
apache-2.0
-598,047,231,617,503,000
38.70669
121
0.615016
false
pythonalliance/uno2bot
errors.py
1
1077
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Telegram bot to play UNO in group chats # Copyright (c) 2016 Jannes Höke <uno@jhoeke.de> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundatio...
agpl-3.0
8,331,047,116,921,851,000
24.619048
74
0.749071
false
partofthething/home-assistant
homeassistant/components/zha/core/const.py
1
10279
"""All constants related to the ZHA component.""" import enum import logging from typing import List import bellows.zigbee.application from zigpy.config import CONF_DEVICE_PATH # noqa: F401 # pylint: disable=unused-import import zigpy_cc.zigbee.application import zigpy_deconz.zigbee.application import zigpy_xbee.zigb...
mit
6,439,723,803,792,472,000
29.321534
88
0.729254
false
eliezerfot123/django-with-angular
django_with_angular_je/django_with_angular_je/settings.py
1
2686
""" Django settings for django_with_angular_je project. Generated by 'django-admin startproject' using Django 1.8.2. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ ""...
gpl-2.0
8,488,484,638,799,005,000
25.333333
71
0.693596
false
ubalance-team/magum
magum/magum.py
1
26743
#!/usr/bin/python """ MAGUM python module (Beta 1.1.0) MAGUM stands for (Magnetometer, Accelerometer and Gyroscope Udoo Management) it includes some modules such as smbus, time, os, sys, subprocess etc.. to manage the udoo-neo motion sensors over the I2C serial communicaton protocol. Because the I2C device interfa...
gpl-2.0
4,612,450,192,025,019,000
33.067516
377
0.63239
false
astraw/stdeb
stdeb/command/install_deb.py
1
1027
import glob import os import stdeb.util as util from distutils.core import Command __all__ = ['install_deb'] class install_deb(Command): description = 'distutils command to install debian binary package' user_options = [] boolean_options = [] def initialize_options(self): pass def fin...
mit
6,799,082,127,808,595,000
25.333333
74
0.620253
false
yookoala/ibus-cangjie
src/engine.py
1
16581
# Copyright (c) 2012-2013 - The IBus Cangjie authors # # This file is part of ibus-cangjie, the IBus Cangjie input method engine. # # ibus-cangjie is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version...
gpl-3.0
8,909,056,220,710,151,000
31.89881
88
0.58947
false
VPAC/pytsm
pytsm/actions/__init__.py
1
1692
# Copyright 2012-2014 VPAC # # This file is part of pytsm. # # pytsm is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pytsm is distr...
gpl-3.0
950,840,453,649,099,100
27.677966
76
0.685579
false
pablo-co/insight-jobs
process_stops.py
1
3206
import sys import traceback from bhulan.processVehicles import importTrucks, initCompute from bhulan.processStops import saveComputedStops from bhulan.util import notify, getTime from pymongo import MongoClient from bhulan.constants import WATTS_DATA_DB_KEY from bhulan.inputOutput import saveStopsToFile import numpy as...
mit
367,163,636,033,930,430
24.046875
105
0.591391
false
partizand/bankparser
setup.py
1
3023
#!/usr/bin/python3 """Setup """ #import distutils.cmd import re from setuptools import setup, find_packages # import build # import src.bankparser # class GenFiles(distutils.cmd.Command): # """Генерация некоторых файлов проекта и справки # """ # user_options = [] # description = 'generate .py and rea...
gpl-3.0
-2,226,578,515,833,647,000
26.847619
76
0.578659
false
CloverHealth/airflow
airflow/contrib/kubernetes/kubernetes_request_factory/pod_request_factory.py
1
3983
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
7,108,266,722,964,942,000
31.917355
90
0.659302
false
dwalton76/ev3dev-lang-python
tests/motor/motor_param_unittest.py
1
24419
#!/usr/bin/env python # Based on the parameterized test case technique described here: # # http://eli.thegreenplace.net/2011/08/02/python-unit-testing-parametrized-test-cases import unittest import time import sys import ev3dev.ev3 as ev3 import parameterizedtestcase as ptc from motor_info import motor_info clas...
mit
2,423,050,435,570,949,000
38.705691
119
0.653794
false
janmtl/pypsych
tests/data/generators/eprime.py
1
2106
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Script for generating mock EPrime test data """ import pandas as pd import numpy as np import io pd.set_option('display.max_rows', 50) pd.set_option('display.max_columns', 500) pd.set_option('display.width', 1000) from pypsych.config import Config def generate_mock_...
bsd-3-clause
-712,407,890,185,442,400
32.967742
80
0.551282
false
lbin/nexar-2
lib/utils/visualization.py
1
3989
# -------------------------------------------------------- # Tensorflow Faster R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Xinlei Chen # -------------------------------------------------------- from __future__ import absolute_import from __future__ import division from __future__ impor...
mit
5,248,297,059,724,088,000
44.329545
99
0.598646
false
DXCanas/content-curation
contentcuration/contentcuration/viewsets/channelset.py
1
4021
from django.core.exceptions import PermissionDenied from django.db.models import CharField from django.db.models import Q from rest_framework import serializers from rest_framework.permissions import IsAuthenticated from contentcuration.models import Channel from contentcuration.models import ChannelSet from contentcu...
mit
6,839,614,447,070,985,000
35.554545
88
0.66476
false
Onirik79/aaritmud
data/proto_rooms/villaggio-zingaro/villaggio-zingaro_room_locanda.py
1
1355
# -*- coding: utf-8 -*- #= DESCRIZIONE ================================================================= """ Inietta una bimba in locanda. """ #= IMPORT ====================================================================== import random from src.database import database from src.defer import defer_random_time...
gpl-2.0
7,353,757,211,943,525,000
25.54902
80
0.517725
false
Donkyhotay/MoonPy
zope/security/tests/test_checker.py
1
24043
############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # T...
gpl-3.0
150,918,352,054,562,050
37.224165
80
0.614441
false
c4mb0t/django-setman
testproject/core/migrations/0001_initial.py
2
4372
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'UserProfile' db.create_table('core_userprofile', ( ('id', self.gf('django.db.m...
bsd-3-clause
-3,425,025,220,831,337,500
60.577465
182
0.558554
false
MichaelVL/osm-analytic-tracker
HumanTime.py
1
2895
import datetime, pytz import re import tzlocal def date2human(when, slack_secs=180): """ Convert timestamp to human-friendly times, like '3 minutes ago' """ if not when: return None now = datetime.datetime.utcnow().replace(tzinfo=pytz.utc) diff = now-when secs = diff.seconds days = diff...
gpl-2.0
-3,093,306,471,708,067,300
30.813187
90
0.562003
false
DataViva/dataviva-site
dataviva/apps/build_graph/views.py
1
3965
# -*- coding: utf-8 -*- import re from flask import Blueprint, render_template, g, jsonify, request from dataviva.apps.general.views import get_locale from dataviva.apps.embed.models import Build, App from dataviva.api.rais.services import Industry as CnaeService from dataviva.api.secex.services import Product as Secex...
mit
-1,822,615,599,357,939,200
26.727273
101
0.588398
false
polyaxon/polyaxon-api
polyaxon_lib/polyaxonfile/local_runner.py
1
4049
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import atexit import json import os import signal import subprocess import sys import time from six.moves import xrange from multiprocessing import Process from tensorflow.python.platform import tf_logging as logging from po...
mit
5,097,832,108,795,529,000
25.81457
93
0.61472
false
yugangw-msft/azure-cli
src/azure-cli/azure/cli/command_modules/vm/_completers.py
9
1524
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
mit
3,530,653,606,838,533,000
42.542857
98
0.652231
false
isaac-s/cloudify-manager
rest-service/manager_rest/flask_utils.py
1
3338
######### # Copyright (c) 2013 GigaSpaces Technologies Ltd. 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/LICENSE-2.0 # # Unless...
apache-2.0
-3,778,302,000,744,430,000
34.892473
77
0.685141
false
ecdpalma/napscheduler
napscheduler/scheduler.py
1
16056
""" This module is the main part of the library. It houses the Scheduler class and related exceptions. """ from threading import Thread, Event, Lock from datetime import datetime, timedelta from logging import getLogger import os import sys from napscheduler.util import * from napscheduler.triggers import SimpleTrigg...
mit
-8,972,679,782,593,459,000
36.166667
86
0.564275
false
SetBased/py-etlt
test/helper/AllenTest.py
1
2762
import unittest from etlt.helper.Allen import Allen class AllenTest(unittest.TestCase): """ Test cases for class Allen algebra. """ # ------------------------------------------------------------------------------------------------------------------ def _test1(self, expected, x, y): relat...
mit
-4,219,810,705,451,695,000
40.848485
120
0.34323
false
USGSDenverPychron/pychron
pychron/rpc/rpcable.py
1
1606
# =============================================================================== # Copyright 2012 Jake Ross # # 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/licens...
apache-2.0
-2,558,149,608,230,918,000
42.405405
81
0.537983
false
vdenPython/wwwgaseng
wwwgaseng/settings.py
1
3071
""" Django settings for wwwgaseng project. Generated by 'django-admin startproject' using Django 1.8.3. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build pa...
apache-2.0
666,975,278,690,597,100
25.646018
78
0.679734
false
modicum/wyoming
source/conf.py
1
11524
# -*- coding: utf-8 -*- # # wyoming documentation build configuration file, created by # sphinx-quickstart on Mon Jan 25 11:12:20 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
mit
3,484,720,184,999,613,400
30.486339
79
0.705658
false
Lothilius/python-jumble
Permutations.py
1
2071
# Files: Permutations.py # # Description: Creats permutations of an entered word. # __author__ = 'lothilius' import math class Permutations(): """This module contains functions to generate all unique permutations of a string, and to count permutations. """ def countOccurrences(word): # c...
mit
-8,432,174,870,537,733,000
31.359375
73
0.568807
false
hexlism/xx_net
gae_proxy/local/gae_handler.py
1
28513
#!/usr/bin/env python # coding:utf-8 import errno import time import struct import zlib import functools import re import io import string import socket import ssl import httplib import Queue import urlparse import threading from proxy import xlog from connect_manager import https_manager from appids_manager import ...
bsd-2-clause
-704,005,076,090,287,700
39.930935
135
0.530495
false
ranqingfa/ardupilot
Tools/autotest/autotest.py
1
18485
#!/usr/bin/env python """ APM automatic test suite Andrew Tridgell, October 2011 """ from __future__ import print_function import atexit import fnmatch import glob import optparse import os import shutil import signal import sys import time import traceback import apmrover2 import arducopter import arduplane import ...
gpl-3.0
-3,368,664,535,770,807,300
31.316434
137
0.611036
false
ergs/transmutagen
transmutagen/origen.py
1
19764
# PYTHON_ARGCOMPLETE_OK import argparse import os from subprocess import run import logging from itertools import combinations import numpy as np from scipy.sparse import csr_matrix from scipy.sparse.linalg import use_solver import tables from pyne.utils import toggle_warnings import warnings toggle_warnings() warni...
bsd-3-clause
-8,848,703,059,821,995,000
39.666667
165
0.634183
false
jschultz/Gooey
gooey/python_bindings/config_generator.py
1
2477
import os import sys from gooey.gui.windows import layouts from gooey.python_bindings import argparse_to_json from gooey.gui.util.quoting import quote def create_from_parser(parser, source_path, cmd_args, **kwargs): auto_start = kwargs.get('auto_start', False) if hasattr(sys, 'frozen'): run_cmd = ...
mit
-7,430,879,707,997,304,000
44.735849
169
0.612434
false
andresailer/DIRAC
tests/Integration/DataManagementSystem/Test_FileCatalogDB.py
1
56699
""" This is a test of the FileCatalogDB It supposes that the DB is present. """ # pylint: disable=invalid-name,wrong-import-position import unittest import itertools import os import sys from DIRAC.Core.Base import Script Script.parseCommandLine() from DIRAC.DataManagementSystem.DB.FileCatalogDB import FileCat...
gpl-3.0
4,499,916,033,939,739,000
37.861549
118
0.580292
false
lmazuel/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_peering_py3.py
1
4752
# 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 ...
mit
-2,799,743,572,390,819,000
54.255814
339
0.681187
false
NelleV/pyconfr-test
symposion_project/settings.py
1
6854
# -*- coding: utf-8 -*- # Django settings for account project import os.path import posixpath PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__)) DEBUG = True TEMPLATE_DEBUG = DEBUG # tells Pinax to serve media through the stat...
bsd-3-clause
2,700,904,606,327,757,300
29.327434
122
0.695506
false
rrrrrr8/vnpy
vnpy/api/fcoin/vnfcoin.py
1
8705
# encoding: UTF-8 from __future__ import print_function import hashlib import hmac import json import ssl import traceback import base64 from queue import Queue, Empty from multiprocessing.dummy import Pool from time import time from urlparse import urlparse from copy import copy from urllib import urlencode from thr...
mit
-5,416,593,543,440,437,000
27.914966
104
0.407246
false
patpatpatpatpat/digestus
digestus/users/migrations/0002_auto_20160411_0706.py
1
1042
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-04-11 07:06 from __future__ import unicode_literals import django.contrib.auth.models import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0001_initial'), ] ...
bsd-3-clause
4,507,607,847,754,448,000
36.214286
409
0.619962
false
jhamman/xarray
xarray/core/dask_array_ops.py
1
3415
import numpy as np from . import dtypes, nputils def dask_rolling_wrapper(moving_func, a, window, min_count=None, axis=-1): """Wrapper to apply bottleneck moving window funcs on dask arrays """ import dask.array as da dtype, fill_value = dtypes.maybe_promote(a.dtype) a = a.astype(dtype) # in...
apache-2.0
-4,649,155,484,743,141,000
34.206186
85
0.610542
false
jds2001/ocp-checkbox
plainbox/plainbox/impl/checkbox.py
1
11485
# This file is part of Checkbox. # # Copyright 2012, 2013 Canonical Ltd. # Written by: # Zygmunt Krynicki <zygmunt.krynicki@canonical.com> # # Checkbox is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either ...
gpl-3.0
1,173,677,311,311,144,000
32.97929
79
0.60714
false
username115/FRCScouting
gen_scripts/SQLITEContractGen.py
1
8061
#! /usr/bin/python _description = ''' This script take in a SQL file with INSERTS and CREATES and transforms it into a SQLite contract in Java. Meant to be used with a phpmyadmin exported sql file. Defaults assume the FRC 836 file structure. ''' _defaultRun = ''' python SQLITEContractGen.py --packagename=org.frc...
apache-2.0
-1,132,357,694,553,966,600
32.5875
87
0.62945
false
PXke/invenio
invenio/ext/logging/wrappers.py
1
19138
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version ...
gpl-2.0
5,910,561,714,720,999,000
36.452055
115
0.564845
false
nguy/brawl4d
LMA/controller.py
1
10240
""" Support for LMA data display in brawl4d. These are meant to be lightweight wrappers to coordinate data formats understood by the lmatools package. """ import numpy as np from lmatools.flashsort.autosort.LMAarrayFile import LMAdataFile from stormdrain.bounds import Bounds, BoundsFilter from stormdra...
bsd-2-clause
341,399,929,400,334,140
45.130631
125
0.578906
false
apache/bloodhound
trac/trac/tests/core.py
2
13792
# -*- coding: utf-8 -*- # # Copyright (C)2005-2009 Edgewall Software # Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de> # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.e...
apache-2.0
8,011,652,877,673,540,000
34.638243
80
0.609411
false
bsmithers/CLIgraphs
histogram.py
1
8515
#!/usr/bin/env python2 from __future__ import division import itertools import math import sys import numpy import scipy.stats import cligraph import utils """ TODO: - Auto-detect number of bins - Fixed width or variable width bins - Stacked bins, overlapped bins or bins next to each other - Change which side of bi...
agpl-3.0
-3,073,636,207,774,765,000
37.881279
100
0.593188
false
WUJISHANXIA/wujishanxia
bootcamp/articles/tests/test_views.py
1
6318
from django.contrib.auth import get_user_model from django.http import HttpResponseBadRequest from django.core.urlresolvers import reverse from django.test import Client, TestCase from bootcamp.articles.models import Article class TestViews(TestCase): """ Includes tests for all the functionality associat...
mit
7,096,354,799,373,921,000
46.149254
83
0.534188
false
CReSIS/OPS
conf/tools/createUserExample.py
1
1232
# After editing the script (e.g. with gedit), run this script by following these steps: # (1) Switch to root user: sudo -i # (2) Activate VirtualEnv: source /usr/bin/venv/bin/activate # (3) Open a Python shell with Django environment: python /var/django/ops/manage.py shell # (4) Run this script: execfile('createU...
gpl-3.0
2,488,223,651,397,870,000
36.333333
89
0.75487
false
boxlab/UltraEnc-X
0.3.1/model/main_functions.py
1
1133
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' impelement the main functions required by enc.py. ''' from random import randint from model.requirements import lmap, repeat def generate_otp(sheets, strength, length): for sheet in range(sheets): filename = "uexor_%s.uep" % (str(sheet),) ...
gpl-3.0
-55,255,850,452,821,720
24.177778
72
0.578994
false
dpausp/arguments
tests/concepts/document/test_documents.py
1
1326
import factory from assert_helpers import assert_difference, assert_no_difference from ekklesia_portal.datamodel import Document from webtest_helpers import assert_deform, fill_form def test_create_document(client, db_query, document_factory, proposition_type_factory, logged_in_department_admin): department = lo...
agpl-3.0
-8,858,794,118,393,888,000
38
115
0.723982
false
kn-bibs/dotplot
dotplot/matrices.py
1
3681
"""This module works with similarity matrices of aminoacids""" import os available_matrices = { 'PAM120': 'matrices/PAM120.txt' } class SimilarityMatrix: def __init__(self, name): filename = available_matrices[name] # get the raw matrix from file matrix = self.read_raw_matrix(filen...
lgpl-3.0
4,772,096,541,550,794,000
30.194915
77
0.549307
false
lmazuel/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/local_network_gateway.py
1
3220
# 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 ...
mit
6,252,235,653,991,100,000
40.818182
110
0.618012
false
shumingch/molecule_simulation
init.py
1
2823
#init from camera from bge import logic, render from particle import Particle from mathutils import Vector, Matrix gdict = logic.globalDict def draw(): camera = scene.objects["Camera"] string = "BondCraft" ###draws bonds and changes text before frame load atoms = gdict["atoms"].copy() for atom ...
mit
-7,731,772,127,578,801,000
28.416667
70
0.552604
false
stosdev/zebra-supervisor
judge/models/profile.py
1
1441
# -*- coding: utf-8 -*- """Module containing judge user profiles and various utilities.""" from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_unicode_compatible from django.db import models from django.contrib.auth.models import User from django.db.models.signals impor...
gpl-3.0
-5,783,652,171,932,656,000
34.146341
79
0.628036
false
phobson/bokeh
scripts/version_update.py
1
2576
import os import re import sys def check_input(new_ver): """ Ensure that user input matches the format X.X.X """ pat = r'\d+.\d+.\d+' if not re.match(pat, new_ver): print("The new version must be in the format X.X.X (ex. '0.6.0')") return True def version_update(new_ver, file_array): ...
bsd-3-clause
-1,888,264,344,816,569,000
32.454545
104
0.571817
false
pmaigutyak/mp-shop
delivery/models.py
1
2389
from django.db import models from django.utils.translation import ugettext_lazy as _ class DeliveryMethod(models.Model): name = models.CharField(_('Name'), max_length=255) code = models.CharField(_('Code'), max_length=255, unique=True) def __str__(self): return self.name class Meta: ...
isc
5,401,627,924,899,312,000
23.628866
78
0.580159
false
jcfr/mystic
examples/constraint1_example01.py
1
1202
#!/usr/bin/env python # # Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 1997-2015 California Institute of Technology. # License: 3-clause BSD. The full license text is available at: # - http://trac.mystic.cacr.caltech.edu/project/mystic/browser/mystic/LICENSE """ Example: - Minimize R...
bsd-3-clause
-6,508,856,531,346,199,000
23.530612
78
0.686356
false
sahpat229/POLLUTION
POLLUTION/settings.py
1
3175
""" Django settings for POLLUTION project. Generated by 'django-admin startproject' using Django 1.9.1. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os ...
mit
-2,247,838,034,777,714,000
25.239669
91
0.689764
false
zzliujianbo/shadowsocks
shadowsocks/utils.py
1
11775
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2014 clowwindy # # 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 u...
mit
679,679,329,797,133,600
35.342593
79
0.569682
false
cklb/PyMoskito
pymoskito/simulation_modules.py
1
14724
import logging from copy import copy from abc import ABCMeta, abstractmethod from collections import OrderedDict from PyQt5.QtCore import QObject pyqtWrapperType = type(QObject) __all__ = ["SimulationModule", "SimulationException", "Trajectory", "Feedforward", "Controller", "Limiter", "ModelMixe...
bsd-3-clause
5,801,520,427,617,726,000
27.927308
84
0.609006
false
mcedit/mcedit
albow/menu_bar.py
1
1799
# # Albow - Menu bar # from pygame import Rect from widget import Widget, overridable_property class MenuBar(Widget): menus = overridable_property('menus', "List of Menu instances") def __init__(self, menus=None, width=0, **kwds): font = self.predict_font(kwds) height = font.get_linesize...
isc
-3,368,339,507,747,398,700
25.850746
67
0.496943
false
justinhayes/cm_api
python/src/cm_api/endpoints/roles.py
1
8270
# Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file ex...
apache-2.0
-4,214,432,242,808,278,500
31.431373
83
0.655381
false
jablonskim/jupyweave
jupyweave/output_manager.py
1
1220
from os import makedirs from os.path import join, dirname import uuid class OutputManager: """Responsible for managing """ def __init__(self, output_settings, input_filename): self.__data_dir = output_settings.data_directory(input_filename) self.__data_dir_url = output_settings.data_dir_url(i...
mit
6,834,835,077,078,132,000
32.888889
80
0.622951
false
brianhelba/pylibtiff
libtiff/tests/test_simple.py
2
1148
import os from tempfile import mktemp from numpy import * from libtiff import TIFF def test_write_read(): for itype in [uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, complex64, complex128]: image = array([[1, 2, 3], [4, 5,...
bsd-3-clause
-65,418,931,846,777,350
24.511111
57
0.495645
false