repo_name
stringlengths
6
90
path
stringlengths
4
230
copies
stringlengths
1
4
size
stringlengths
4
7
content
stringlengths
734
985k
license
stringclasses
15 values
hash
int64
-9,223,303,126,770,100,000
9,223,233,360B
line_mean
float64
3.79
99.6
line_max
int64
19
999
alpha_frac
float64
0.25
0.96
autogenerated
bool
1 class
ratio
float64
1.5
8.06
config_test
bool
2 classes
has_no_keywords
bool
2 classes
few_assignments
bool
1 class
ganggas95/websen
websen/views/admin/admin_page.py
1
32146
from flask_login import login_required, LoginManager, login_user, logout_user, current_user, UserMixin from websen import app from websen.databases.models import db, User, Jabatan, Jadwal, Pegawai, Absen from datetime import timedelta import logging, os, string, random, hashlib, datetime, uuid, base64 from sqlalchemy i...
gpl-3.0
3,637,409,843,515,084,300
39.538462
159
0.598581
false
3.201793
false
false
false
rhoml/lemur
lemur/notifications/models.py
9
1101
""" .. module: lemur.notifications.models :platform: Unix :copyright: (c) 2015 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from sqlalchemy.orm import relationship from sqlalchemy import Integer, String, Colu...
apache-2.0
-7,739,432,607,122,657,000
30.457143
62
0.708447
false
4.018248
false
false
false
ahlusar1989/fileprocessor
tests/run_test.py
2
2399
import sys import os import unittest def runTests(testDirectory, projectDirectory = None, testName = None): """Run unit tests from files with filenames of the form test_*.py. Arguments: testDirectory -- Absolute path to directory containing all the tests Keyword arguments: projectDirectory -- Path to...
mit
-1,220,036,334,842,679,300
33.835821
84
0.706544
false
3.754304
true
false
false
asgard-lab/neutron
neutron/agent/dhcp/config.py
15
3369
# Copyright 2015 OpenStack Foundation # # 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 re...
apache-2.0
-7,080,113,351,229,266,000
44.527027
79
0.596319
false
4.456349
false
false
false
ohld/instabot
instabot/bot/bot_story.py
2
2305
def download_stories(self, username): user_id = self.get_user_id_from_username(username) list_image, list_video = self.get_user_stories(user_id) if list_image == [] and list_video == []: self.logger.error( ( "Make sure that '{}' is NOT private and that " "posted some stor...
apache-2.0
-6,459,042,431,130,973,000
34.461538
84
0.61128
false
3.476621
false
false
false
readline/StarAlignerFusionUtil
lib/GTF.py
1
1682
#!/usr/bin/env python import os, sys def getLongestTid(gtfpath, gid): if gtfpath[-3:] == '.gz': infile = gzip.open(gtfpath, 'rb') else: infile = open(gtfpath, 'r') gstart, gend = 0, 0 transdic = {} while 1: line = infile.readline() if not line: break...
mit
2,515,954,642,620,202,500
22.690141
61
0.442925
false
3.475207
false
false
false
FoxInRage/zChemistry
main.py
1
10638
#data[0] - num - Номер в таблице #data[1] - name - Имя в таблице #data[2] - Rname - Русское название #data[3] - Lname - Латинское название #data[4] - Ename - Английское название #data[5] - Birth - Дата открытия #data[6] - Eshell - Электронная оболочка #data[7] - Doxi - Степень окисления #data[8] - Amass - Атомная масса...
mit
-5,454,686,064,273,698,000
38.897872
652
0.602282
false
2.439761
false
false
false
agateau/odtfusion
replacer.py
1
2643
# -*- coding: UTF-8 -*- """ This file is part of the odtfusion project. @author: Aurélien Gâteau <aurelien.gateau@free.fr> @license: GPL v3 or later """ import re from lxml import etree TEXT_URI = "urn:oasis:names:tc:opendocument:xmlns:text:1.0" PLACEHOLDER_START = "${" PLACEHOLDER_END = "}" PLACEHOLDER_RX = re.com...
gpl-3.0
397,875,252,725,533,200
29.356322
107
0.572889
false
3.535475
false
false
false
lethehaiau/BiDAF
squad/utils.py
2
3469
import re def get_2d_spans(text, tokenss): spanss = [] cur_idx = 0 for tokens in tokenss: spans = [] for token in tokens: if text.find(token, cur_idx) < 0: print(tokens) print("{} {} {}".format(token, cur_idx, text)) raise Excepti...
apache-2.0
2,185,094,616,487,106,000
29.973214
117
0.535313
false
3.083556
false
false
false
ralphwetzel/theonionbox
theonionbox/tob/nodes/node.py
1
13032
from typing import Optional, Union import contextlib import functools import logging from time import time, strftime import uuid import stem.response from ..ccfile import CCNode from ..config import DefaultNodeConfig from .. import livedata from ..log import LoggingManager, ForwardHandler from ..onionoo import getOn...
mit
3,013,401,059,554,411,500
33.028721
124
0.565531
false
4.174247
true
false
false
ArtezGDA/text-IO
Floris/text_security/text_security.py
1
1172
#copyright (C) 2015 #ArtEZ Graphic Design (GDA) #Floris Versteeg 2A #Text I/O project #file folder: text_security #file name: text_security #programma dat bij het open van dit bestand in de terminal --> # <-- een mail stuurt naar fsversteeg2gmail.com #import mail module import smtplib from email.MIMEMultipart import...
mit
-7,679,534,621,334,016,000
25.659091
96
0.767918
false
2.688073
false
true
false
nicfit/vexmpp
vexmpp/protocols/file_transfer.py
1
13300
# -*- coding: utf-8 -*- import os import asyncio from hashlib import md5 from pathlib import Path from tempfile import mkstemp from base64 import b64decode, b64encode from collections import namedtuple from lxml import etree from .. import getLogger from ..errors import (BadRequestStanzaError, XmppError, ...
mit
-1,712,157,980,596,306,400
34.092348
80
0.551128
false
3.780557
false
false
false
rohandavidg/CONCORD-VCF
bin/batch_allele_freq.py
1
2626
#!/dlmp/sandbox/cgslIS/rohan/Python-2.7.11/python """ This script creates a plot of the allele freq for all the samples in the batch """ import vcf import os import csv from do_logging import configure_logger from collections import defaultdict import pprint import parse_vcf import plot_dict import plot_allele_freq_...
mit
-880,394,891,224,498,200
27.857143
99
0.66032
false
3.115065
false
false
false
landlab/landlab
tests/utils/test_stable_priority_queue.py
3
1485
#! /usr/bin/env python import numpy as np import pytest from landlab.utils import StablePriorityQueue def test_add_subtract_examine(): q = StablePriorityQueue() q.add_task("b", priority=2) q.add_task("a", priority=1) q.add_task(0, priority=0) q.add_task("c", priority=2) q.remove_task(0) ...
mit
4,756,181,444,159,939,000
22.203125
76
0.626263
false
2.889105
true
false
false
geowurster/tinysort
tests/test_io.py
1
3820
""" Unittests for tinymr.serialize """ import os import pickle import pytest from tinysort import tools import tinysort.io def test_BaseSerializer_exceptions(): slz = tinysort.io.BaseSerializer() with pytest.raises(NotImplementedError): slz.open(None, None) def test_str2type(): values = [ ...
bsd-3-clause
-3,393,094,284,236,515,300
20.828571
75
0.556021
false
3.136289
true
false
false
kfreedland/quadrotor
listener2.py
1
1208
import rospy, roslib, math from geometry_msgs.msg import TransformStamped as ts from geometry_msgs.msg import Transform from geometry_msgs.msg import Vector3Stamped objpos = None def callback(data): global objpos objpos = data.transform.translation def callback2(data): #print objpos #print if (objpos != None): ...
mit
-1,950,194,591,116,268,800
28.463415
72
0.692053
false
3.195767
false
false
false
kgjamieson/NEXT-psych
next/database_client/CacheStore/redis_data_structures/dictTest.py
6
1534
import redisDictionary import time from redisDictionary import * def main(): expId = 0 subId = 'D' d = {'sape': 4139, 'jack': 4098, 'guido': 4127} d2 = {'one': 1, 'two': 2, 'three': 3} dict = Dictionary(expId, subId, d) dict2 = Dictionary(expId, subId, d2) print 'dict1 = %s...
apache-2.0
6,503,196,098,738,213,000
21.573529
51
0.503911
false
2.905303
false
false
false
rawdlite/mopidy-remote
mopidy_remote/__init__.py
1
1398
from __future__ import unicode_literals import logging import os # TODO: Remove entirely if you don't register GStreamer elements below #import pygst #pygst.require('0.10') #import gst #import gobject from mopidy import config, ext __version__ = '0.0.1' # TODO: If you need to log, use loggers named after the curr...
apache-2.0
-5,161,171,520,733,930,000
29.391304
77
0.663805
false
3.728
true
false
false
roadhead/satchmo
satchmo/product/templatetags/satchmo_product.py
2
2603
from django import template from django.conf import settings from django.core import urlresolvers from django.template import Context, Template from django.utils.translation import get_language, ugettext_lazy as _ from satchmo import caching from satchmo.configuration import config_value from satchmo.product.models imp...
bsd-3-clause
1,598,482,156,134,473,700
28.579545
95
0.662313
false
3.920181
false
false
false
IceCubeDev/hackerschool
WebServer/1.0/JUNK/backup/web/threaded/ThreadedServer.py
1
1082
__author__ = 'Ivan Dortulov' from web.BaseServer import * from web.RequestHandler import * from web.threaded.ClientThread import * from web.threaded.ThreadedRequestHandler import * import socket class ThreadedServer(BaseServer): def __init__(self, address, port, handler=ThreadedRequestHandler): Threaded...
gpl-2.0
-8,384,625,003,014,143,000
29.083333
70
0.666359
false
4.243137
false
false
false
hans/adversarial
tests/test_deconv_sanity.py
1
1903
""" Simple sanity check for deconvolution layer. """ import numpy as np from numpy.testing import assert_array_almost_equal from pylearn2.models.mlp import MLP from pylearn2.space import Conv2DSpace import theano from adversarial.deconv import Deconv input_space = Conv2DSpace(shape=(2, 1), num_channels=16, axes=('c...
bsd-3-clause
-1,597,003,396,116,830,700
29.693548
79
0.588019
false
3.001577
false
false
false
manufacturedba/reboot_roberto
reboot/views/index.py
1
1653
""" Views for loading pages with context """ from zinnia.models.entry import Entry from django.views.generic.base import TemplateView from django.http import HttpResponse from django.http import Http404 from posixpath import basename import json class JsonResponse(HttpResponse): def __init__(self, content={}, m...
mit
4,974,041,566,377,957,000
34.934783
149
0.633999
false
4.271318
false
false
false
wfxiang08/redis-py
redis/_compat.py
1
1251
# -*- coding:utf-8 -*- """Internal module for Python 2 backwards compatibility.""" import sys from urllib import unquote from urlparse import parse_qs, urlparse from itertools import imap, izip from string import letters as ascii_letters from Queue import Queue try: from cStringIO import StringIO as BytesIO except...
mit
441,858,874,398,898,400
22.615385
68
0.722901
false
3.673653
false
false
false
Balandat/cont_no_regret
old_code/QuadLoss_ex_old.py
1
4971
''' Numerical example for the Continuous No-Regret Algorithm with quadratic loss functions @author: Maximilian Balandat, Walid Krichene @date: Nov 24, 2014 ''' import numpy as np from ContNoRegret.Domains import Rectangle, UnionOfDisjointRectangles from ContNoRegret.Distributions import Uniform from ContNoRegret.Loss...
mit
-6,318,914,013,033,456,000
37.534884
93
0.684571
false
2.676898
false
false
false
ekarlso/partizan
tests/functional/fixtures/database.py
1
2371
# -*- coding: utf-8 -*- # Copyright 2015 Hewlett-Packard Development Company, L.P. # # 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 # # Unle...
apache-2.0
1,337,937,300,835,087,000
32.871429
75
0.624631
false
3.886885
false
false
false
karldoenitz/karlooper
karlooper/web/http_connection.py
1
1101
# -*-encoding:utf-8-*- class HttpConnection(object): """ This class contains four methods def __init__(self): initialize def add_connection(self, name, value): add connection def get_connection(self, name): get connection def remove_connection(self, name): remove connection """ _...
mit
-8,431,935,042,000,911,000
20.173077
67
0.573115
false
4.549587
false
false
false
bjmnbraun/icestick_fastio
thirdparty/magma/parts/lattice/ice40/primitives/RAMB.py
1
4771
from collections import OrderedDict from magma import * __all__ = ['SB_RAM40_4K'] __all__ += ['RAMB', 'ROMB'] # posedge read clock, posedge write clock SB_RAM40_4K = DeclareCircuit("SB_RAM40_4K", "output RDATA", Out(Array(16, Bit)), "input RADDR", In(Array(11, Bit)), "input RCLK", In(Bit), "input RC...
mit
941,153,964,226,623,700
30.183007
74
0.511004
false
2.858598
false
false
false
iut-ibk/DynaMind-UrbanSim
3rdparty/opus/src/urbansim/gridcell/building_age.py
2
3789
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE from numpy import ma from opus_core.variables.variable import Variable from variable_functions import my_attribute_label class building_age(Variable): """The age of a building in this g...
gpl-2.0
-5,641,286,500,698,247,000
38.763441
123
0.562418
false
3.854527
true
false
false
Smile-SA/odoo_addons
smile_document/tests/test_document.py
1
1993
# -*- coding: utf-8 -*- # (C) 2019 Smile (<http://www.smile.eu>) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import fields from dateutil.relativedelta import relativedelta import odoo.tests.common as common from odoo.exceptions import UserError class Testdocument(common.TransactionCa...
agpl-3.0
-3,244,692,521,159,761,400
37.326923
78
0.619167
false
3.818008
true
false
false
stack-of-tasks/rbdlpy
tutorial/lib/python2.7/site-packages/OpenGL/constant.py
9
3305
"""Implementation of OpenGL constant objects""" import sys from OpenGL._bytes import bytes,unicode,as_8_bit, long, integer_types, maxsize from OpenGL import _configflags class Constant( object ): """OpenGL constant that displays itself as a name rather than a value The purpose of this class is to make debuggi...
lgpl-3.0
486,325,399,335,112,960
41.371795
93
0.620272
false
4.242619
false
false
false
alaski/nova
nova/network/__init__.py
12
1258
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # 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 ...
apache-2.0
-8,638,393,722,477,045,000
28.255814
78
0.715421
false
3.766467
false
false
false
normalnorway/normal.no
django/apps/links/migrations/0001_initial.py
1
1595
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Category', fields=[ ('id', models.AutoField(ver...
gpl-3.0
469,476,942,264,398,700
36.093023
150
0.522257
false
4.455307
false
false
false
RDFLib/PyRDFa
pyRdfa/serializers/turtleserializer.py
1
5862
""" Serializer for Turtle. This is a slightly modified version of RDFLib's TurtleSerializer module; the original version had some bugs (in defining prefixes), and the overall output look has also been slightly improved. """ from rdflib import BNode from rdflib import Literal from rdflib import URIRe...
bsd-3-clause
1,701,842,133,414,672,100
24.710526
115
0.649778
false
2.984725
false
false
false
Shuailong/Leetcode
solutions/add-binary.py
1
1122
#!/usr/bin/env python # encoding: utf-8 """ add-binary.py Created by Shuailong on 2016-03-06. https://leetcode.com/problems/add-binary/. """ class Solution(object): def addBinary(self, a, b): """ :type a: str :type b: str :rtype: str """ if len(a) < len(b): ...
mit
-4,701,031,608,066,045,000
18.344828
42
0.38057
false
3.205714
false
false
false
Fillll/reddit2telegram
reddit2telegram/channels/tech_weekly_radar/app.py
1
1823
#encoding:utf-8 import random import time from utils import SupplyResult from utils.tech import get_active_period, get_newly_active, get_all_public_channels, get_all_tags from utils.tech import generate_list_of_channels, get_top_growers_for_last_week, default_ending from utils.tech import chunker subreddit = 'all' ...
mit
-557,238,843,157,511,700
39.909091
131
0.667778
false
2.821317
false
false
false
madhadron/rnaseq
bin/samfiles_to_sqlite.py
1
4053
""" samfiles_to_sqlite.py by Fred Ross, <madhadron@gmail.com> Load a list of SAM/BAM files into an SQLite database as a group, calculating their leftsite depth on each transcript and the multiplicities. The resulting database is ready to be handed to find_subproblems.py and to inference.py, both of which will treat i...
gpl-3.0
3,178,685,657,579,446,300
32.221311
86
0.511226
false
4.085685
false
false
false
Zheng-Yejian/xyplayer
xyplayer/utils.py
2
10988
import os import io import re import sys import time import json import shutil import tempfile from functools import wraps from mutagenx.mp3 import MP3 from mutagenx.easyid3 import EasyID3 from PyQt5.QtCore import QTime from xyplayer import app_version_num, Configures def get_usable_fonts(): """读取系统可用的中文字体""" ...
gpl-3.0
8,917,921,343,210,303,000
29.938776
103
0.588391
false
3.145228
true
false
false
zhzDeveloper/Python_Study
OC/packageIpa.py
1
1724
#!/usr/local/bin/python3 import os project_name = 'BXLife' configuration = 'Release' # or Debug dest_path = 'build' team_id = 'Z3HFL97CNG' bundle_id = 'com.wywk.yupaopao' deployment_target = '8.0' preprocessor_definitions = '\"$(inherited)\"' # GCC_PREPROCESSOR_DEFINITIONS={PreprocessorDefinitions} def clean_build...
apache-2.0
-2,654,682,327,597,904,400
28.741379
64
0.62471
false
3.822616
true
false
false
gnowledge/ncert_nroer
gstudio/testloop.py
3
1908
import rdflib from rdflib.graph import ConjunctiveGraph as Graph from rdflib import plugin from rdflib.store import Store, NO_STORE, VALID_STORE from rdflib.namespace import Namespace from rdflib.term import Literal from rdflib.term import URIRef from tempfile import mkdtemp from gstudio.models import * def rdf_descri...
agpl-3.0
-6,344,696,427,823,768,000
31.338983
149
0.662474
false
3.444043
false
false
false
karesansui/karesansui
bin/write_conf.py
1
8366
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2012 HDE, Inc. # # 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, incl...
mit
1,296,975,302,220,959,500
36.769585
160
0.580405
false
3.665474
false
false
false
TommyOd/latex_templates
tools/autolabel/autolabel.py
1
2704
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import os import string def lines_from_file(path): """ Return every line from a file as list. """ with open(path) as file: for line in file: yield line.strip('\n') def between(string, start, end): ...
mit
-5,803,865,171,540,244,000
24.037037
87
0.515533
false
3.824611
false
false
false
carthagecollege/django-djauth
djauth/bin/ldap_password.py
1
1400
# -*- coding: utf-8 -*- """ Shell script to search LDAP store by username or ID """ from django.conf import settings from djauth.LDAPManager import LDAPManager from optparse import OptionParser import os, sys, ldap # set up command-line options desc = """ Accepts as input: dn cn=username,o=users [and] pa...
bsd-3-clause
-6,765,499,909,517,305,000
22.728814
71
0.604286
false
3.626943
false
false
false
timvandermeij/mobile-radio-tomography
environment/Environment.py
3
17172
# Core imports import math # Package imports from Location_Proxy import Location_Proxy from ..core.Import_Manager import Import_Manager from ..core.Thread_Manager import Thread_Manager from ..core.USB_Manager import USB_Manager from ..trajectory.Servo import Servo from ..vehicle.Vehicle import Vehicle from ..zigbee.Se...
gpl-3.0
-6,886,053,503,594,862,000
36.657895
156
0.625029
false
4.455631
false
false
false
ECP-CANDLE/Benchmarks
Pilot1/Uno_UQ/uno_holdoutUQ_data.py
1
4070
#! /usr/bin/env python from __future__ import division, print_function import logging import os from keras import backend as K import data_utils_.uno as uno import candle import data_utils_.uno_combined_data_loader as uno_combined_data_loader logger = logging.getLogger(__name__) os.environ['TF_CPP_MIN_LOG_LEVEL...
mit
1,593,088,015,929,986,000
36.33945
133
0.610811
false
3.508621
false
false
false
LaurentClaessens/mazhe
src_yanntricks/yanntricksExampleChangementVariables.py
1
1121
from yanntricks import * def ExampleChangementVariables(): fig = GenericFigure("ExampleChangementVariables") ssfig1=fig.new_subfigure(r'''La r\'egion $V$''', 'vecchiaregione') ssfig2=fig.new_subfigure(r'''La r\'egion $U=\phi^{-1}(V)$''', 'nuovaregione') pspict=ssfig1.new_pspicture('vreg') pspict2=s...
gpl-3.0
3,701,476,640,837,115,400
25.069767
81
0.637823
false
2.301848
false
false
false
Ruide/angr-dev
angr-management/angrmanagement/ui/widgets/qstring_table.py
1
3604
from PySide.QtGui import QTableWidget, QTableWidgetItem, QColor, QAbstractItemView from PySide.QtCore import Qt from angr.analyses.cfg.cfg_fast import MemoryData from ...utils import filter_string_for_display class QStringTableItem(QTableWidgetItem): def __init__(self, mem_data, *args, **kwargs): supe...
bsd-2-clause
-5,388,972,574,986,488,000
24.560284
82
0.578246
false
4.06772
false
false
false
MinnowBoard/minnow-maker
pyDrivers/ada_lcd.py
2
6461
#!/usr/bin/env python # Author: Evan Steele <evan.steele@intel.com> # Copyright (c) 2015 Intel Corporation. # # 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 #...
mit
-4,754,558,046,062,275,000
28.637615
150
0.706857
false
2.734236
false
false
false
georgreen/CP2A-BucketList-Application
app/models/profile.py
1
9096
"""This module contains Model a user's Profile.""" from app.base import BaseModel, database from app.models import bucketlist from sqlalchemy.orm.collections import attribute_mapped_collection budy = database.Table('budys', database.Column("user_id", database.Integer, ...
mit
4,702,915,455,211,016,000
35.095238
79
0.568492
false
4.019443
false
false
false
abhi252/GloVeGraphs
Glove-Graphs/src/glovegraph.py
1
7220
from argparse import ArgumentParser import codecs from collections import Counter import itertools from functools import partial import logging from math import log import os.path import cPickle as pickle from random import shuffle import msgpack import numpy as np from scipy import sparse class NodeEmbedding(): d...
gpl-3.0
284,482,514,945,753,180
33.711538
104
0.640859
false
3.370682
false
false
false
pkimber/stock
stock/migrations/0001_initial.py
1
2932
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Product', fields=[ ('id', models.AutoField(prim...
apache-2.0
1,532,904,915,879,287,800
37.578947
114
0.513643
false
4.75974
false
false
false
kubeup/archon
vendor/github.com/google/certificate-transparency/python/ct/crypto/asn1/x509_time_test.py
29
2308
#!/usr/bin/env python import unittest from ct.crypto import error from ct.crypto.asn1 import x509_time class TimeTest(unittest.TestCase): def verify_time(self, time_struct, year, month, day, hour, minute, sec): self.assertEqual(year, time_struct.tm_year) self.assertEqual(month, time_struct.tm_mo...
apache-2.0
8,023,762,311,331,623,000
35.634921
79
0.627383
false
3.040843
true
false
false
darrencheng0817/AlgorithmLearning
Python/sorting/insertionSort.py
1
1618
''' Created on 2015.11.30 @author: Darren ''' def insertionSort(nums): """ Original version :type nums:list[int] :rtype list[int] """ res=list(nums) for i in range(1,len(res)): #find a place for res[i] j=i-1 while j>=0: if res[i]>res[j]: ...
mit
8,747,291,999,642,575,000
22.808824
82
0.497528
false
3.076046
false
false
false
FUMBBLPlus/fplusdb_main
pythonlib/schema.py
1
15386
from collections import OrderedDict, UserString from enum import Enum from types import MappingProxyType import sqlalchemy as sa from sqlalchemy.dialects import postgresql as pg import fumbbl_base.custom_types import fumbbl_base.rules from fplusdb_main import custom_types ## type converter #########################...
mit
-6,420,534,894,973,033,000
33.575281
66
0.595801
false
3.476277
false
false
false
mission-peace/interview
python/dynamic/bitonicsequence.py
1
1382
""" Problem Statement ================= Find the length of the longest Bitonic Sequence in a given sequence of numbers. A Bitonic sequence is a sequence of numbers which are increasing and then decreasing. Video ----- * https://youtu.be/TWHytKnOPaQ Analysis -------- * Runtime O(n) Reference --------- * http://www.g...
apache-2.0
-1,283,801,932,745,699,300
27.791667
115
0.620116
false
3.199074
false
false
false
wolverton-research-group/qmpy
qmpy/analysis/thermodynamics/space.py
1
57105
# qmpy/analysis/thermodynamics/space.py import networkx as nx from scipy.spatial import ConvexHull import matplotlib.pyplot as plt import logging from django.db import transaction import qmpy from qmpy.utils import * from . import phase from .reaction import Reaction from .equilibrium import Equilibrium logger = lo...
mit
-7,478,293,518,447,622,000
30.991597
103
0.503756
false
3.754932
false
false
false
SciLifeLab/scilifelab
scilifelab/lims_utils/load_status_from_google_docs.py
1
5207
#!/usr/bin/env python import sys import os import time from datetime import datetime from uuid import uuid4 import hashlib from optparse import OptionParser import logging from scilifelab.google.google_docs import SpreadSheet from scilifelab.google import get_credentials import couchdb # GOOGLE DOCS def ...
mit
9,110,593,042,715,605,000
45.90991
117
0.565777
false
3.773188
false
false
false
Azure/azure-sdk-for-python
sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_08_01/operations/_vpn_site_link_connections_operations.py
1
5309
# 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 ...
mit
5,741,004,486,669,749,000
46.401786
238
0.667922
false
4.431553
true
false
false
MTASZTAKI/ApertusVR
plugins/physics/bulletPhysics/3rdParty/bullet3/examples/pybullet/gym/pybullet_envs/examples/dominoes.py
2
1644
import pybullet_data as pd import pybullet_utils as pu import pybullet import pybullet_utils.bullet_client as bc import time p = bc.BulletClient(connection_mode=pybullet.GUI) p.setAdditionalSearchPath(pd.getDataPath()) p.loadURDF("plane_transparent.urdf", useMaximalCoordinates=True) p #.setPhysicsEngineParameter(numS...
mit
-5,120,142,935,776,709,000
36.363636
80
0.630779
false
3.067164
false
false
false
openqt/algorithms
projecteuler/pe649-low-prime-chessboard-nim.py
1
1224
#!/usr/bin/env python # coding=utf-8 """649. Low-Prime Chessboard Nim https://projecteuler.net/problem=649 Alice and Bob are taking turns playing a game consisting of $c$ different coins on a chessboard of size $n$ by $n$. The game may start with any arrangement of $c$ coins in squares on the board. It is possible a...
gpl-3.0
-3,082,847,635,493,971,000
38.483871
78
0.732843
false
3.162791
false
false
false
phpdude/django-admin-row-actions
django_admin_row_actions/views.py
1
1131
from django.contrib import admin from django.contrib import messages from django.http import Http404, HttpResponse, HttpResponseRedirect from django.views.generic import View from django.views.generic.detail import SingleObjectMixin class ModelToolsView(SingleObjectMixin, View): """A special view that run th...
mit
-1,187,917,147,573,788,000
32.264706
68
0.648099
false
4.524
false
false
false
isandlaTech/cohorte-devtools
qualifier/deploy/cohorte-home/repo/cohorte/composer/node/criteria/distance/configuration.py
2
3187
#!/usr/bin/env python # -- Content-Encoding: UTF-8 -- """ Votes according to the composition configuration :author: Thomas Calmant :license: Apache Software License 2.0 :version: 3.0.0 .. Copyright 2014 isandlaTech Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file...
apache-2.0
-8,602,718,456,129,435,000
29.066038
80
0.60935
false
4.572453
true
false
false
Thortoise/Super-Snake
Blender/animation_nodes-master/graphics/rectangle.py
1
3486
from bgl import * from mathutils import Vector class Rectangle: def __init__(self, x1 = 0, y1 = 0, x2 = 0, y2 = 0): self.resetPosition(x1, y1, x2, y2) self.color = (0.8, 0.8, 0.8, 1.0) self.borderColor = (0.1, 0.1, 0.1, 1.0) self.borderThickness = 0 @classmethod def fromReg...
gpl-3.0
-1,659,078,987,950,256,000
30.405405
106
0.589788
false
3.242791
false
false
false
UManPychron/pychron
pychron/entry/tasks/importer_panes.py
3
4782
# =============================================================================== # Copyright 2013 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
6,105,811,322,242,684,000
44.113208
123
0.364074
false
5.125402
false
false
false
paw3142/meta-overc-1
meta-pod/recipes-support/overc-system-agent/files/overc-system-agent-1.2/Overc/backends/btrfs.py
1
7532
import sys, os import subprocess from Overc.utils import Utils from Overc.utils import ROOTMOUNT class Btrfs(Utils): def __init__(self): self.name = None self.rootfs = None self.rootdev = self._getrootdev() self.bakup_mode = self._get_bootmode() self.kernel_md5 = self._com...
mit
621,229,824,431,302,100
38.642105
118
0.566516
false
3.596944
false
false
false
uccser/cs4teachers
dthm4kaiako/poet/views.py
1
6764
"""Views for POET application.""" from ipware import get_client_ip from json import dumps from django.forms import ValidationError from django.urls import reverse, reverse_lazy from django.shortcuts import render, redirect from django.core.exceptions import ObjectDoesNotExist from django.contrib import messages from d...
mit
2,406,945,640,334,832,000
34.229167
98
0.654494
false
4.193428
false
false
false
eekim/purplewiki
extras/InvertRevisions.py
1
1333
#!/usr/bin/env python # InvertRevisions.py # 2005 March 15 # Jonathan Cheyer # # workaround for bug in PurpleWiki-0.96alpha/extras/backendConvert.pl # License: GPL Version 2, http://www.gnu.org/copyleft/gpl.html import sys import os def getTotal(current): f = open(current, "r") total = int(f.readline()) ...
gpl-2.0
8,521,387,625,414,131,000
26.770833
69
0.602401
false
3.078522
false
false
false
biothings/biothings.api
biothings/hub/datatransform/ciidstruct.py
1
2198
""" CIIDStruct - case insenstive id matching data structure """ # pylint: disable=E0611 from biothings.hub.datatransform import IDStruct class CIIDStruct(IDStruct): """ CIIDStruct - id structure for use with the DataTransform classes. The basic idea is to provide a structure that provides a list of (orig...
apache-2.0
539,057,411,037,440,960
33.888889
85
0.552775
false
4.387226
false
false
false
Linusp/soph
demos/utils.py
1
2770
# coding: utf-8 from __future__ import unicode_literals import re import pickle import jieba import logging from functools import partial, reduce from keras.models import Sequential jieba.setLogLevel(logging.INFO) PUNCTS_PATTERN = re.compile(r"[.,;:!?'\"~\[\]\(\)\{\}_—。….,;、:!?‘’“”〕《》【】〖〗()「」~]") SPACES_PATTERN = r...
mit
-5,573,094,019,162,440,000
20.533333
83
0.580495
false
2.893617
false
false
false
miquelramirez/LAPKT-public
deploy-ipc-2014.py
2
4857
import sys import os def create_planner_dir( base_dir, planner_id ) : print >> sys.stdout, "Deploying planner:", planner_id planner_folder = os.path.join( base_dir, planner_id ) if os.path.exists( planner_folder ) : print >> sys.stdout, "Folder", planner_folder, "already exists, deleting..." rv = os.system( '...
gpl-3.0
-7,448,702,957,791,028,000
28.981481
88
0.639078
false
2.583511
false
false
false
saradbowman/osf.io
addons/wiki/migrations/0006_wikipage_wikiversion.py
11
2876
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-02-20 17:30 from __future__ import unicode_literals import addons.wiki.models from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django_extensions.db.fields import osf.models.base import osf.util...
apache-2.0
-2,963,853,299,496,892,400
51.290909
169
0.630737
false
4.050704
false
false
false
Nixiware/viper-skeleton-application
application/module/default/model/article.py
1
9709
from datetime import datetime from twisted.logger import Logger from twisted.internet import reactor from twisted.python.failure import Failure class Model: log = Logger() def __init__(self, application): self.application = application self.dbService = self.application.getService("viper.mysq...
mit
8,629,302,860,583,438,000
36.486486
115
0.550211
false
5.002061
false
false
false
carlgao/lenga
images/lenny64-peon/usr/share/python-support/python-boto/boto/s3/connection.py
1
8284
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # 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, modi...
mit
9,137,731,474,220,879,000
39.019324
94
0.629044
false
4.090864
false
false
false
chao-master/openTTDMapper
tiles.py
1
3416
import struct,sys import traceback import lzma import StringIO import colorsys from openttdMap import * itr = open("indyTypeRaw","w") #DEBUG class Tile(object): def __init__(self,tHeight,gameMap): self.height = tHeight self.gameMap = gameMap self.owner = None @staticmethod ...
mit
5,452,011,135,180,175,000
26.548387
98
0.613583
false
3.139706
false
false
false
balabit/ipython3-versioncontrol
notebook_v4_to_py.py
1
5121
""" The script takes an .ipynb file (or all such files in the directory), and, if it doesn't already have a corresponding .py file, creates it from the .ipynb file. We do this because we don't want to version-control .ipynb files (which can contain images, matrices, data frames, etc), but we do want to s...
mit
3,789,665,726,091,096,000
40.97541
116
0.65124
false
4.048221
false
false
false
garbersc/keras-galaxies
tests/keras_test.py
1
4828
from theano import config import keras.callbacks import keras.backend as T from keras.models import Sequential from keras.layers import Dense, Activation, Convolution2D, MaxPooling2D, MaxPooling1D, Dropout, Input, Convolution1D from keras.layers.core import Lambda, Reshape from keras.models import Model import numpy as...
bsd-3-clause
-1,133,125,848,103,856,000
29.175
178
0.688484
false
2.561273
true
false
false
HalcyonChimera/osf.io
tests/framework_tests/test_encryption.py
24
3575
# -*- coding: utf-8 -*- import unittest from nose.tools import * # noqa from framework.encryption import encrypt, decrypt, ensure_bytes class EncryptionTestCase(unittest.TestCase): def test_ensure_bytes_encodes_no_unicode_in_string_type_str(self): my_value = 'hello' assert_true(isinstance(my_val...
apache-2.0
8,541,899,734,337,444,000
40.746988
74
0.655411
false
2.946429
true
false
false
Rathcke/uni
ml/exam/src/q1.py
2
4966
import numpy as np from numpy.linalg import * import matplotlib.pyplot as plt import pylab as P from sklearn.preprocessing import normalize ### Load data ### def loadData(fname): data = [] with open(fname, 'r') as f: for l in f: data.append(l.split(",")) f.close return np.array(...
gpl-3.0
-927,965,356,284,923,400
31.03871
79
0.543294
false
2.892254
false
false
false
CosmosID/cosmosid-cli
setup.py
1
1945
""" ``CosmosID`` ------------ ``cosmosid`` provides a command line client and Python library for CosmosID """ from setuptools import setup, find_packages import os import codecs import os.path def read(rel_path): here = os.path.abspath(os.path.dirname(__file__)) with codecs.open(os.path.join(here, rel_path)...
mit
8,938,889,630,769,069,000
28.469697
78
0.613368
false
3.704762
false
false
false
rbwinslow/hq
hq/hquery/object_type.py
1
3015
import re from builtins import str from future.standard_library import install_aliases from hq.hquery.expression_context import peek_context from hq.string_util import truncate_string, is_a_string install_aliases() from ..verbosity import verbose_print from ..soup_util import is_any_node, is_tag_node, is_text_node, ...
mit
-5,067,740,309,012,888,000
26.916667
115
0.636153
false
3.399098
false
false
false
srluge/DelugeSickbeardPlugin
setup.py
1
2106
# Deluge Sickbeard plugin # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sub...
mit
-7,278,642,805,207,500,000
41.979592
96
0.666192
false
3.966102
false
false
false
simplegeo/metartg
dewpoint/aws.py
1
5254
from xml.etree import ElementTree import urlparse import urllib2 import urllib import hashlib import base64 import hmac import time import re def format_time(ts=None): if ts is None: ts = time.time() return time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(ts)) def parse_time(ts): ts = int(time.mk...
bsd-3-clause
6,449,152,033,976,180,000
29.369942
88
0.523982
false
3.883222
false
false
false
hamsham/FoodMunchDB
web_crawlers/recipe_storage.py
1
5829
__author__ = 'hammy' import abc import codecs import sys import inspect import os CURRENT_DIR = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) PARENT_DIR = os.path.dirname(CURRENT_DIR) sys.path.append(PARENT_DIR) from food_types import IngredientUse from recipe_db import RecipeDB # ------...
gpl-3.0
-5,030,846,184,912,702,000
32.693642
87
0.560645
false
4.543258
false
false
false
dahfool/navigator
geography/migrations/0007_new_countries_remove_regions.py
2
2838
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-12-01 08:33 from __future__ import unicode_literals import os import csv from django.db import migrations, connections from core.utils import fix_model_index fixture_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../fixtures')) csvfilename...
mit
426,707,701,566,161,340
32.785714
105
0.624031
false
3.963687
false
false
false
khardix/rejskol
rsscrapper.py
1
6362
#!/usr/bin/python3 # -*- coding: utf-8 -*- # rsscrapper - Python module for extracting data from http://rejskol.msmt.cz # Copyright © 2014 Jan Stanek - <khardix@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # publish...
agpl-3.0
-3,497,096,202,883,670,000
33.873626
111
0.650071
false
3.434524
false
false
false
Nexedi/re6stnet
demo/ping.py
1
3229
# -*- coding: utf-8 -*- ''' Script launched on machines from the demo with the option -p/--ping It uses Multiping to ping several IPs passed as arguments. After Re6st is stable, this script logs when it does not get response from a machine in a csv file stored in the directory of the machine in this format: time, seque...
gpl-2.0
-3,730,558,514,776,410,600
32.635417
78
0.589347
false
3.702982
false
false
false
lemiere/python-lecture
tp_derivation/correction/3.1.py
1
1127
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt def derivC1(f,h,x): return (f(x+h)-f(x-h))/(2*h) def dderivC1(f,h,x): return (derivC1(f,h,x+h)-derivC1(f,h,x-h))/(2*h) def dderiv(f,h,x): return (f(x+h)+f(x-h)-2*f(x))/(h*h) def mcos(x): return -np.cos(x) def ecart(deriv,f,df,h,n):...
gpl-3.0
6,361,175,973,341,194,000
17.177419
57
0.609583
false
1.97373
false
false
false
jaap3/django-richtextfield
djrichtextfield/widgets.py
1
2470
import json from django.forms.widgets import Media, Textarea from django.urls import reverse from django.utils.encoding import force_str from django.utils.html import format_html from djrichtextfield import settings from djrichtextfield.sanitizer import SanitizerMixin class RichTextWidget(SanitizerMixin, Textarea):...
mit
2,247,254,414,030,397,000
35.865672
98
0.619433
false
4.035948
false
false
false
remiomosowon/pyeasyga
examples/multi_dimensional_knapsack.py
1
1272
from pyeasyga import pyeasyga # setup data data = [(821, 0.8, 118), (1144, 1, 322), (634, 0.7, 166), (701, 0.9, 195), (291, 0.9, 100), (1702, 0.8, 142), (1633, 0.7, 100), (1086, 0.6, 145), (124, 0.6, 100), (718, 0.9, 208), (976, 0.6, 100), (1438, 0.7, 312), (910, 1, 198), (148, 0.7, 171), (1636...
bsd-3-clause
-8,721,444,760,496,746,000
41.4
78
0.515723
false
2.689218
false
false
false
espiritocz/giSAR
PEDRO.py
1
3380
#!/usr/bin/python # -*- coding: latin-1 -*- import os.path import sys from qgis.core import * from qgis.utils import iface from PyQt4.QtGui import QColor from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4.QtGui import * from qgis.core import * from qgis.gui import * from PyQt4.QtCore impor...
gpl-3.0
-1,667,321,911,335,986,000
30.190476
121
0.703375
false
3.029596
false
false
false
gpanda/abrisk
libs/driver.py
1
7555
#!/usr/bin/env python # -*- coding: utf8 -*- from __future__ import print_function __author__ = 'gpanda' import re import requests import sys import codecs import locale from common import print_table_row, LOG #print(locale.getpreferredencoding()) #sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys....
gpl-2.0
-8,553,222,042,392,577,000
23.933993
97
0.569027
false
3.106497
false
false
false
NPrescott/static
quiescent/feed.py
1
2633
# Copyright 2018 Nolan Prescott # # 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 your option) any later version. # # This program is distributed in the...
gpl-3.0
994,201,884,794,246,300
36.614286
90
0.6673
false
3.572592
false
false
false
wojab/python_training
bdd/group_steps.py
1
2228
from pytest_bdd import given, when, then from model.group import Group import random from random import randrange @given('a group list') def group_list(db): return db.get_group_list() @given("a group with <name>, <header> and <footer>") def new_group(name, header, footer): return Group(name=name, header=head...
apache-2.0
6,007,448,093,727,791,000
33.8125
106
0.697935
false
3.085873
false
false
false
virtue1990/mongodemo
exapmles/advanced.py
1
1150
# -*- coding:utf-8 -*- from mongoengine import * from config import mongo_url from mongoengine.context_managers import switch_collection,switch_db import datetime class InitConnectDb(object): def __init__(self): self.init_db() def init_db(self): connect(mongo_url) register_connection('...
gpl-3.0
8,103,160,423,119,603,000
21.115385
68
0.647826
false
3.709677
false
false
false
BetterWorks/django-anonymizer
anonymizer/introspect.py
1
3585
import re from django.db.models import EmailField field_replacers = { 'AutoField': '"SKIP"', 'ForeignKey': '"SKIP"', 'ManyToManyField': '"SKIP"', 'OneToOneField': '"SKIP"', 'SlugField': '"SKIP"', # we probably don't want to change slugs 'DateField': '"date"', 'DateTimeField': '"datetime"'...
mit
3,994,672,622,235,322,000
29.12605
79
0.549791
false
3.528543
false
false
false
cherrygirl/micronaet7
base_minerals/partner.py
1
32704
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP module # Copyright (C) 2010 Micronaet srl (<http://www.micronaet.it>) # # Italian OpenERP Community (<http://www.openerp-italia.com>) # #####################################################...
agpl-3.0
-8,060,347,106,206,364,000
49.702326
168
0.396263
false
4.836291
false
false
false
pennersr/django-allauth
allauth/socialaccount/providers/orcid/provider.py
2
1564
from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider class Scope(object): USERINFO_PROFILE = "/authenticate" class OrcidAccount(ProviderAccount): def get_profile_url(self): return extract_from_dict(self.account.ex...
mit
6,449,739,463,738,600,000
27.436364
86
0.618926
false
3.777778
false
false
false
rail-berkeley/d4rl
d4rl/ope.py
1
4289
""" Metrics for off-policy evaluation. """ from d4rl import infos import numpy as np UNDISCOUNTED_POLICY_RETURNS = { 'halfcheetah-medium' : 3985.8150261686337, 'halfcheetah-random' : -199.26067391425954, 'halfcheetah-expert' : 12330.945945279545, 'hopper-medium' : 2260.1983114487352, 'hopper-rando...
apache-2.0
-4,369,487,419,313,025,500
31.492424
106
0.667755
false
3.188848
false
false
false
RenolY2/sarc-extract
SARCExtract-0.4.py
1
6093
# # Made by NWPlayer123, no rights reserved, feel free to do whatever # import os import sys import struct try: xrange(10) except NameError: # In Python 3, xrange does not exist anymore. # Python 2's xrange is the same as Python 3's range, so we define it as such. def xrange(*args): return ran...
mit
-1,275,445,441,547,918,800
21.735075
81
0.49483
false
3.561075
true
false
false
eResearchSA/reporting-unified
ersa_reporting/keystone.py
1
3576
"""Application and persistence management.""" # pylint: disable=no-member, import-error, no-init, too-few-public-methods # pylint: disable=cyclic-import, no-name-in-module, invalid-name from functools import lru_cache from ersa_reporting import configure, get_or_create from ersa_reporting import record_input, commit...
apache-2.0
-8,076,970,927,227,861,000
27.15748
79
0.588926
false
4.768
false
false
false
lmallin/coverage_test
python_venv/lib/python2.7/site-packages/pandas/core/indexes/interval.py
6
34971
""" define the IntervalIndex """ import numpy as np from pandas.core.dtypes.missing import notnull, isnull from pandas.core.dtypes.generic import ABCPeriodIndex from pandas.core.dtypes.dtypes import IntervalDtype from pandas.core.dtypes.common import ( _ensure_platform_int, is_list_like, is_datetime_or_ti...
mit
-1,857,080,171,045,723,600
31.622201
79
0.555746
false
4.235828
false
false
false