repo_name
stringlengths
8
92
path
stringlengths
5
221
copies
stringclasses
10 values
size
stringlengths
4
6
content
stringlengths
974
828k
license
stringclasses
15 values
hash
int64
-9,212,977,344,346,658,000
9,220,224,517B
line_mean
float64
8.67
91.6
line_max
int64
15
966
alpha_frac
float64
0.29
0.86
autogenerated
bool
1 class
nl_text
stringlengths
0
164k
nl_size
int64
0
164k
nl_language
stringclasses
17 values
nl_language_score
float64
0.04
1
ogdch/ckanext-meteoswiss
ckanext/meteoswiss/harvesters/meteoswissharvester.py
1
13076
#n -*- coding: utf-8 -*- import json import os import tempfile from uuid import NAMESPACE_OID, uuid4, uuid5 from boto.s3.connection import S3Connection from boto.s3.key import Key from ckan import model from ckan.model import Session from ckan.logic import get_action, action from ckan.lib.munge import munge_title_to_...
agpl-3.0
-5,317,946,303,690,557,000
32.14467
79
0.532353
false
n -*- coding: utf-8 -*- Sheet name Use GM03 descriptions(u'Kamerabild', True), Skip metadata file Find or create group the dataset should get assigned to Find or create the organization the dataset should get assigned to because license_url does not exist, we save it in extras for now Never import state fro...
409
en
0.640226
Morgan-Stanley/hobbes
scripts/fregion.py
1
33452
#!/usr/bin/env python ######################################################## # # fregion.py : read structured data files # # to load a file from the path P into the variable f: # f = fregion.FRegion(P) # # to read the stored field 'x' out of f: # f.x # # to read the 'metadata' for the field 'x' (t...
apache-2.0
-8,184,452,706,866,680,000
25.073266
152
0.582207
false
Lazy loading data from file decorator to config lazy read function !/usr/bin/env python fregion.py : read structured data files to load a file from the path P into the variable f: f = fregion.FRegion(P) to read the stored field 'x' out of f: f.x to read the 'metadata' for the field 'x' (type and off...
2,526
en
0.785892
tiagoams/blueC_fluxes
int_adv.py
1
2848
#!/usr/bin/env python # -*- coding: utf-8 -*- """ budget_term_densities Calculates density maps for nutrient budget terms from NEMO-ERSEM output. NERC-DEFRA SSB-BlueC projects Created on Tue Jan 24 09:18:52 2017 @author: TAMS00 """ #import pandas as pd import netCDF4 import xarray as xr import num...
gpl-3.0
214,627,983,886,993,120
32.313253
179
0.629916
false
!/usr/bin/env python -*- coding: utf-8 -*-import pandas as pd,os.path.join(base+'/1981/02/','amm7_1d_19810201_19810228_grid_T.nc')]os.path.join(base+'/1981/01/','restart_trc.nc'),modelvars=[['Y4_fdetrc_result']]modelvars=[['net_PelBen_POC_result','G3_c_pb_flux','nav_lon','nav_lat'],['fabm_st2DnQ1_c','fabm_st2DnQ6_c','f...
930
en
0.247108
unibg-gislab/treets
treets/db_client.py
1
5982
#! /urs/bin/python # coding: utf8 from __future__ import print_function import pymongo from random import uniform TWEETS_LIMIT = 0 TRACES_LIMIT = 0 class DBClient(object): '''Docstring for DBClient''' def __init__(self): super(DBClient, self).__init__() self.mongo = pymongo.MongoClient() ...
mit
-6,620,564,958,461,042,000
35.699387
97
0.564694
false
Docstring for DBClient returns <limit> random tweets TODO docstring Returns first <limit> lists of tweets from the same users TODO docstring TODO docstring TODO docstring Returns first <limit> tweets search for tweets containing <text> and returns results returns tweets posted by user returns <limit> tweets whithin <di...
595
en
0.272064
ClearcodeHQ/pytest-redis
src/pytest_redis/executor.py
1
7872
# Copyright (C) 2017 by Clearcode <http://clearcode.cc> # and associates (see AUTHORS). # This file is part of pytest-redis. # pytest-redis 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 versi...
lgpl-3.0
-2,153,815,324,643,324,000
32.21519
100
0.605183
false
Reddis executor. Extended TCPExecutor to contain all required logic for parametrising and properly constructing command to start redis-server. Exception raised when the redis_exec points to non existing file. Exception raised when redis<2.6 would be detected. Exception raised when unixsocket path is too long. Init met...
2,538
en
0.733296
PaloAltoNetworks-BD/ansible-pan
library/panos_object.py
1
17603
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2017 Palo Alto Networks, Inc # # 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...
isc
49,532,090,653,482,990
34.418511
118
0.589104
false
!/usr/bin/env python -*- coding: utf-8 -*- Copyright 2017 Palo Alto Networks, Inc 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 ...
1,155
en
0.82502
svenrdz/bot_twitter
autofollowrt/autofollowrt.py
1
21724
# -*- coding: utf-8 -*- # native imports import os import re import sys import copy import time import pickle import random from threading import Thread, RLock from multiprocessing import Queue # external imports # Twitter package: https://pypi.python.org/pypi/twitter # Homepage of Twitter package: http://mike.verdon...
gpl-3.0
-6,055,042,456,488,697,000
33.537361
135
0.506997
false
-*- coding: utf-8 -*- native imports external imports Twitter package: https://pypi.python.org/pypi/twitter Homepage of Twitter package: http://mike.verdone.ca/twitter/ DATA TWITTER Starting value for the Twitter and TwitterStream instances Create locks for these instances, so they won't be accessed at the same...
1,487
en
0.792142
linksuccess/linksuccess
parsingframework/heatmaps.py
1
18035
import numpy as np import numpy.random import matplotlib.pyplot as plt import cPickle as pickle import MySQLdb from wsd.database import MySQLDatabase import matplotlib.cm as cm from matplotlib.colors import LogNorm, Normalize, BoundaryNorm, PowerNorm from conf import * from matplotlib import style style.use('acm-3c...
mit
-2,729,897,635,614,966,000
29.158863
115
0.623177
false
fig_size = (3.5, 3)plt.title("Clicks Heatmap Log Normalized")plt.title("Clicks Heatmap Normalized")fig_size = (3.5, 3)plt.title("Clicks Heatmap Log Normalized")plt.title("Clicks Heatmap Normalized")fig_size = (3.5, 3)plt.title("Clicks Heatmap Log Normalized")plt.title("Clicks Heatmap Normalized")plt.title("Clicks Heatm...
1,358
en
0.429278
google/dotty
efilter/stdlib/core.py
1
10013
# EFILTER Forensic Query Language # # Copyright 2015 Google 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 # # Un...
apache-2.0
3,722,554,393,945,833,500
24.478372
80
0.602517
false
Counts the number of elements in a tuple or of values in a repeated. Drop the first 'count' elements from 'x' (tuple or IRepeated). This implementation is lazy. Example: drop(2, (1, 2, 3, 4)) -> (3, 4) Arguments: count: How many elements to drop. x: The tuple or IRepeated to drop from. Returns: A la...
2,552
en
0.856482
endlessm/chromium-browser
third_party/chromite/lib/image_lib_unittest.py
1
25414
# -*- coding: utf-8 -*- # Copyright 2015 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Test the image_lib module.""" from __future__ import print_function import collections import gc import glob import os import...
bsd-3-clause
-1,855,077,315,737,941,500
42.074576
80
0.638939
false
BuildImagePath tests. Fake exception used for testing exception handling. Tests the GetImageDiskPartitionInfo function. Mocked loopback partition class to use in unit tests. Test the loopback partitions class Tests the various LSB utilities. SecurityTestConfig class tests. Stub out disable rw mount. Stub out enable rw ...
3,502
en
0.884359
pygeek/django
django/contrib/gis/db/backends/postgis/creation.py
1
3881
from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation class PostGISCreation(DatabaseCreation): geom_index_type = 'GIST' geom_index_opts = 'GIST_GEOMETRY_OPS' def sql_indexes_for_field(self, mode...
bsd-3-clause
-6,418,817,060,973,817,000
48.126582
99
0.509147
false
Return any spatial index creation SQL for the field. Geogrophy columns are created normally. Geometry columns are created by `AddGeometryColumn` stored procedure. Add a NOT NULL constraint to the field Spatial indexes created the same way for both Geometry and Geography columns. PostGIS 2.0 does not support GIST_GEOM...
480
en
0.829496
sciencewiz1/datahub
src/datahub/browser/views.py
1
1691
import json, sys, re, hashlib, smtplib, base64, urllib, os from auth import * from core.account import manager from django.http import * from django.shortcuts import render_to_response from django.views.decorators.csrf import csrf_exempt from django.core.context_processors import csrf from django.core.validators impor...
mit
-9,209,395,502,883,774,000
28.666667
121
0.752218
false
0
en
0.110449
mikister/webgen
tests/test_dom.py
1
25088
"""Unit tests for `dom.py`. Todo: * Add class methods to html tag tests * Ul (from_list, from_dict, ) * Ol (from_list, from_dict, ) * Table (from_list, ) * Pass an instance of same class as parameter to ElementHTML class (test) * """ import unittest import os # Allowing to import m...
mit
-2,836,461,636,050,776,000
40.813333
122
0.601044
false
Tests predefined css declarations from `dom.py`. Tests predefined css elements from `dom.py`. Tests predefined and custom html tags from `dom.py`. Tests infrastructure classes and functions from `dom.py`. These classes include: List, Dict, ElementHTML, ElementCSS, ElementJS, Functions are: compare_path, Unit tests for...
1,141
en
0.746046
downquark/algorithms
square_root.py
1
1141
from math import floor def sqrt(S): """Given an integer, return the square root. A continued fraction expansion implementation. https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Continued_fraction_expansion Args: S: Any natural number """ i = 0 s = 1 i...
gpl-2.0
7,549,270,143,950,171,000
24.377778
100
0.468887
false
Given an integer, return the square root. A continued fraction expansion implementation. https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Continued_fraction_expansion Args: S: Any natural number
227
en
0.525978
brucework/demo
src/python/hello/objvar.py
1
1332
#!/usr/bin/python #Filename: objvar.py class Person: "'Represents a person.'" population = 0 def __init__(self, name): ''''Initializes the person's data.''' self.name = name print '(Initializing %s)'% self.name #When this person is created, he/she #adds to the pop...
gpl-3.0
8,220,158,943,830,193,000
19.492308
69
0.583333
false
!/usr/bin/pythonFilename: objvar.pyWhen this person is created, he/sheadds to the populationswaroop.sayHi()swaroop.howMany()
124
en
0.689217
Southpaw-TACTIC/Team
src/python/Lib/site-packages/PySide/examples/tutorials/addressbook/part4.py
1
9061
#!/usr/bin/env python ############################################################################# ## ## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ## Contact: Qt Software Information (qt-info@nokia.com) ## ## This file is part of the example classes of the Qt Toolkit. ## ######################...
epl-1.0
8,617,441,876,815,813,000
32.684015
90
0.584152
false
!/usr/bin/env python Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). Contact: Qt Software Information (qt-info@nokia.com) This file is part of the example classes of the Qt Toolkit.
199
en
0.670376
kret0s/gnuhealth-live
tryton/server/trytond-3.8.3/trytond/ir/rule.py
1
10814
# This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. from ..model import ModelView, ModelSQL, fields, EvalEnvironment, Check from ..transaction import Transaction from ..cache import Cache from ..pool import Pool from .. import b...
gpl-3.0
1,320,602,009,460,516,000
35.657627
78
0.561309
false
Rule Rule group This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. TODO remove to only use groups Restart the cache on the domain_get method of ir.rule Restart the cache on the domain_get method of ir.rule Restart the cache on th...
777
en
0.779041
opnsense/core
src/opnsense/scripts/ipsec/list_status.py
1
3842
#!/usr/local/bin/python3 """ Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain th...
bsd-2-clause
-7,422,858,684,513,032,000
41.688889
101
0.640552
false
Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions...
1,533
en
0.841846
ddalex/p9
sign/migrations/0007_auto__add_field_channel_description.py
1
7738
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Channel.description' db.add_column(u'sign_channel', 'desc...
mit
-8,665,449,170,731,710,000
66.295652
187
0.544456
false
-*- coding: utf-8 -*- Adding field 'Channel.description' Deleting field 'Channel.description'
93
en
0.576928
Intel-Corporation/tensorflow
tensorflow/python/distribute/minimize_loss_test.py
1
22211
# Copyright 2018 The TensorFlow Authors. 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 by applica...
apache-2.0
2,174,429,013,716,935,700
41.14611
82
0.62397
false
A very simple model written by the user. Verifies that moving mean updates are reduced across replicas. Tests for running legacy optimizer code with DistributionStrategy. Copyright 2018 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this fi...
2,629
en
0.857319
portnov/sverchok
nodes/network/udp_client.py
1
3820
# ##### BEGIN GPL LICENSE BLOCK ##### # # 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 distrib...
gpl-3.0
7,752,315,496,420,771,000
32.517544
92
0.605236
false
BEGIN GPL LICENSE BLOCK 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 distributed in the hope that it wi...
764
en
0.890888
rlowrance/mlpack
minimize_1d_golden_section.py
1
1783
'''golden section search to minimize a function of one variable in [low,high] NOTE: the function fun is assumed to be unimodal RETURN low high, such that the minimizer is in [low,high] dict, dictionary with function evalutions dict[x] = f(x) ARGS fun(x) -> number low -> number high -> number tolerance -> number...
mit
3,258,253,841,374,939,000
22.773333
77
0.53281
false
from heath-02 p. 272
20
en
0.845598
jdepoix/goto_cloud
goto_cloud/status_model/models.py
1
2281
from abc import abstractmethod from django.db import models from enums.public import StringEnum from tracked_model.public import TrackedModel from .lifecycle_management import ObjectStatusLifecycleManager, StatusLifecycle class StatusModel(TrackedModel): """ This Model can be inherited by models which hav...
mit
7,181,498,220,778,321,000
31.126761
114
0.665498
false
raise if a status is invalid This Model can be inherited by models which have a status in a lifecycle. The property model.lifecycle_manager returns a ObjectStatusLifecycleManager containing the relevant lifecycle. decrements the status of this StatusModel :raises: ObjectStatusLifecycleManager.InvalidStatusException in...
565
en
0.640441
GorillaNation/pipestash
pipestash/__init__.py
1
3148
import socket import optparse def parseargs(): def parse_field_args(option, opt_str, value, parser): args=[] for arg in parser.rargs: if arg[0] != "-": args.append(arg) else: del parser.rargs[:len(args)] break if getatt...
bsd-3-clause
7,890,449,419,665,262,000
55.214286
269
0.645172
false
parse command line required fields validation set source parse out fields verbose output
88
en
0.403078
sfriesel/suds
suds/xsd/sxbuiltin.py
1
6653
# This program is free software; you can redistribute it and/or modify # it under the terms of the (LGPL) GNU Lesser 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 hope that it will b...
lgpl-3.0
-2,954,499,898,351,151,600
25.505976
76
0.563655
false
Represents an (xsd) <any/> node Represents an (xsd) boolean builtin type. Represents an (xsd) xs:date builtin type. Represents an (xsd) xs:datetime builtin type. Represents an (xsd) xs:float builtin type. Represents an (xsd) xs:int builtin type. Represents an (xsd) xs:long builtin type. Represents an (xsd) <xs:string/>...
1,659
en
0.765087
Bihaqo/t3f
t3f/__init__.py
1
3157
from t3f.tensor_train_base import TensorTrainBase from t3f.tensor_train import TensorTrain from t3f.tensor_train_batch import TensorTrainBatch from t3f.variables import assign from t3f.variables import get_variable from t3f.ops import add from t3f.ops import cast from t3f.ops import flat_inner from t3f.ops import fro...
mit
8,852,712,789,191,167,000
34.875
80
0.803928
false
0
en
0.110449
sporto/rails_go_to_spec
resolver_test.py
1
5072
# to run # python resolver_test.py import unittest try: from .resolver import * except ImportError: from resolver import * class ResolverTest(unittest.TestCase): def test_is_spec_returns_true(self): file = '/spec/foo/something_spec.rb' r = Resolver().is_spec(file) self.assertEqual(r, True) def test_is_sp...
mit
-3,987,177,846,458,583,600
31.935065
77
0.695386
false
to run python resolver_test.py get_source get_spec run returns either the source or spec depending on the given file
116
en
0.575837
openstack/os-net-config
os_net_config/validator.py
1
7202
# -*- coding: utf-8 -*- # Copyright 2017 Red Hat, Inc. # # 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 l...
apache-2.0
-4,055,297,311,342,866,400
38.790055
79
0.621772
false
Finds an object of a given type in an anyOf/oneOf array. Returns a tuple (`found`, `index`), where `found` indicates whether on object of type `type_to_find` was found in the `schemas` array. If so, `index` contains the object's position in the array. Returns error messages consistent across Python 2 and 3. jsonschem...
2,086
en
0.750471
datalyze-solutions/pandas-qt
pandasqt/views/DataTableView.py
1
13381
# -*- coding: utf-8 -*- from pandasqt.compat import QtCore, QtGui, Qt, Slot, Signal from pandasqt.models.DataFrameModel import DataFrameModel from pandasqt.views.EditDialogs import AddAttributesDialog, RemoveAttributesDialog from pandasqt.views.CustomDelegates import createDelegate from pandasqt.models.mime import Pan...
mit
1,387,420,655,620,008,400
33.312821
128
0.626112
false
A Custom widget with a TableView and a toolbar. This widget shall display all `DataFrameModels` and enable the editing of this (edit data, adding/removing, rows/columns). create a table view with the ability to start drag operations Constructs the object with the given parent. Args: parent (QObject, optional): Ca...
3,423
en
0.719212
PeteAndersen/swarfarm
bestiary/models/items.py
1
6510
from django.contrib.postgres.fields import ArrayField from django.contrib.staticfiles.templatetags.staticfiles import static from django.db import models from django.utils.safestring import mark_safe from django.utils.text import slugify from . import base ESSENCE_MAP = { 'magic': { 'low': 11006, ...
apache-2.0
-2,082,593,143,098,325,200
28.862385
145
0.601075
false
Abstract model for representing quantities of items for various purposes TODO: Replace these with base.Stats model
114
en
0.834289
explora26/zephyr
scripts/sanity_chk/harness.py
1
3312
import re from collections import OrderedDict class Harness: GCOV_START = "GCOV_COVERAGE_DUMP_START" GCOV_END = "GCOV_COVERAGE_DUMP_END" FAULTS = [ "Unknown Fatal Error", "MPU FAULT", "Kernel Panic", "Kernel OOPS", "BUS FAULT", "CPU Pa...
apache-2.0
3,593,360,791,085,379,000
29.109091
66
0.485809
false
check ordering
14
en
0.331402
LinkCareServices/period
docs/conf.py
1
8403
# -*- coding: utf-8 -*- # # period documentation build configuration file, created by # sphinx-quickstart on Tue Jul 10 18:37:45 2012. # # 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. # # All ...
artistic-2.0
6,534,941,978,792,994,000
30.829545
80
0.697132
false
-*- coding: utf-8 -*- period documentation build configuration file, created by sphinx-quickstart on Tue Jul 10 18:37:45 2012. 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. All configuration values h...
6,614
en
0.653981
alirizakeles/zato
code/zato-server/test/zato/server/service/internal/kvdb/__init__.py
1
2245
# -*- coding: utf-8 -*- """ Copyright (C) 2013 Dariusz Suchojad <dsuch at zato.io> Licensed under LGPLv3, see LICENSE.txt for terms and conditions. """ from __future__ import absolute_import, division, print_function, unicode_literals # stdlib from traceback import format_exc # Zato from zato.common import ZatoExc...
gpl-3.0
4,555,896,742,429,259,300
30.180556
100
0.621826
false
-*- coding: utf-8 -*- stdlib Zato The data browser will most likely be implemented in a future version
102
en
0.737406
semplice/quickstart
quickstart/builder.py
1
2423
# -*- coding: utf-8 -*- # # quickstart - Refreshing the GUI world. # Copyright (C) 2013 Eugenio "g7" Paolantonio # # 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...
lgpl-2.1
-5,219,807,691,265,484,000
27.505882
80
0.684276
false
A dynamic dictionary! builder.from_file is a class decorator that will automatically load the UI file specified in the arguments in a Gtk.Builder object. A Dynamic dictionary will be created in class.objects. This special dict gets the UI objects on-the-fly. The only required parameter is the UI file position. Usag...
1,559
en
0.814269
junmin-zhu/chromium-rivertrail
chrome/common/extensions/docs/server2/build_server.py
1
2634
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # This script is used to copy all dependencies into the local directory. # The package of files can then be uploaded to App Engine....
bsd-3-clause
5,980,907,068,329,087,000
35.583333
80
0.621868
false
!/usr/bin/env python Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. This script is used to copy all dependencies into the local directory. The package of files can then be uploaded to App Engine. To be able ...
382
en
0.902463
ddimensia/RaceCapture_App
autosportlabs/comms/comms.py
1
5498
import traceback import threading import multiprocessing from Queue import Empty from time import sleep from kivy.logger import Logger from autosportlabs.comms.commscommon import PortNotOpenException STAY_ALIVE_TIMEOUT = 4 COMMAND_CLOSE = 'CLOSE' COMMAND_KEEP_ALIVE = 'PING' def connection_process_message_reader(rx_qu...
gpl-3.0
-2,222,995,248,042,992,600
34.701299
160
0.631139
false
returns Empty object if timeout is hit
38
en
0.341588
franklingu/leetcode-solutions
questions/palindrome-linked-list/Solution.py
1
1513
""" Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Follow up: Could you do it in O(n) time and O(1) space? """ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val ...
mit
-2,569,556,633,888,039,400
23.403226
60
0.489095
false
:type head: ListNode :rtype: bool Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Follow up: Could you do it in O(n) time and O(1) space? Definition for singly-linked list. class ListNode(object): def __init__(self, x):...
366
en
0.497171
blckshrk/Weboob
modules/popolemploi/backend.py
1
17379
# -*- coding: utf-8 -*- # Copyright(C) 2013 Bezleputh # # This file is part of weboob. # # weboob 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 Foundation, either version 3 of the License, or # (at your opt...
agpl-3.0
5,952,296,868,497,060,000
48.070822
117
0.58163
false
-*- coding: utf-8 -*- Copyright(C) 2013 Bezleputh This file is part of weboob. weboob 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 Foundation, either version 3 of the License, or (at your option) any later vers...
694
en
0.895257
nelseric/qmk_firmware
lib/python/qmk/cli/new/keymap.py
16
1884
"""This script automates the copying of the default keymap into your own keymap. """ import shutil from pathlib import Path import qmk.path from qmk.decorators import automagic_keyboard, automagic_keymap from milc import cli @cli.argument('-kb', '--keyboard', help='Specify keyboard name. Example: 1upkeyboards/1up60h...
gpl-2.0
5,085,182,209,697,416,000
39.085106
122
0.706476
false
Creates a new keymap for the keyboard of your choosing. This script automates the copying of the default keymap into your own keymap. ask for user input if keyboard or keymap was not provided in the command line generate keymap paths check directories create user directory with default keymap files end message t...
326
en
0.786374
fivejjs/crosscat
crosscat/cython_code/test_sample.py
1
4283
# # Copyright (c) 2010-2014, MIT Probabilistic Computing Project # # Lead Developers: Dan Lovell and Jay Baxter # Authors: Dan Lovell, Baxter Eaves, Jay Baxter, Vikash Mansinghka # Research Leads: Vikash Mansinghka, Patrick Shafto # # Licensed under the Apache License, Version 2.0 (the "License"); # you may...
apache-2.0
8,966,423,893,119,867,000
35.29661
84
0.69951
false
Copyright (c) 2010-2014, MIT Probabilistic Computing Project Lead Developers: Dan Lovell and Jay Baxter Authors: Dan Lovell, Baxter Eaves, Jay Baxter, Vikash Mansinghka Research Leads: Vikash Mansinghka, Patrick Shafto Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file e...
1,272
en
0.706147
brahle/I-Rcbot
irc/mysocket.py
1
1895
#!/usr/bin/env python2.6 # Zeckviz IRC bot # Copyright (C) 2011 Bruno Rahle # # 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 Foundation, either version 3 of the License, or # (at your option) any la...
agpl-3.0
-2,516,814,916,496,474,000
34.092593
79
0.616359
false
Extends socket.socket class and adds the functionality to reads the data from socket line by line. Creates the socket. Reads the next line from the socket. NOTE: Ignores the timeout and blocking status. It just waits for the complete line to be sent to the socket and returns it. TODO: account for timeout and ...
1,066
en
0.873635
ctogle/dilapidator
src/dilap/BROKEN/generate/toremove/street.py
1
1258
import dilap.core.context as dgc import dilap.generate.landscape as dls import dilap.generate.lot as dlt import dilap.primitive.road as dr import dp_vector as dpv import dp_quaternion as dpq class street(dgc.context): def generate(self,worn = 0): start = dpv.vector(-100,-300, 20) end = dpv.vect...
mit
-4,722,324,031,005,298,000
30.45
66
0.605723
false
bbs = []lotspace = rd._lotspace(bbs)dlot = dlt.lot(lotspace[0],lotspace[1]).generate(worn)lsppos,lsprot = lotspace[2],lotspace[3]dlot._transform(lsppos,lsprot,dpv.one())self._consume(dlot)lotspace = rd._lotspace(bbs)dlot = dlt.lot(lotspace[0],lotspace[1]).generate(worn)lsppos,lsprot = lotspace[2],lotspace[3]dlot._trans...
400
en
0.233374
ninuxorg/netdiff
tests/test_cnml.py
1
4009
import os import libcnml import networkx from netdiff import CnmlParser, diff from netdiff.exceptions import ParserError from netdiff.tests import TestCase CURRENT_DIR = os.path.dirname(os.path.realpath(__file__)) cnml1 = '{0}/static/26494_detail_1.cnml'.format(CURRENT_DIR) cnml2 = '{0}/static/26494_detail_2.cnml'.f...
mit
-38,226,968,968,311,980
34.166667
79
0.59566
false
ensure there are differences ensure 1 link added ensure there are differences ensure 1 link removed ensure there are differences ensure 2 links added ensure 2 links removed
172
en
0.902578
jurcicek/ndm
ndm/model.py
1
19396
#!/usr/bin/env python3 from statistics import mean import tensorflow as tf import numpy as np from tfx.logging import LogMessage class BaseModel: def __init__(self, data, FLAGS): self.data = data self.FLAGS = FLAGS self.batch_idx = tf.placeholder("int32", name='batch_idx') self....
apache-2.0
-3,818,700,218,189,610,000
41.257081
139
0.562951
false
!/usr/bin/env python3 print('X1', predictions.shape) print('X1', predictions.shape) m.log(print_console=True, append=False) print('X1', predictions.shape) print('X1', predictions.shape) print(self.data.batch_histories.shape) print(self.data.batch_actions_template.shape) print(actions_template.shape) print(len(batch_ind...
655
en
0.322677
idlesign/django-etc
etc/admin/admins.py
1
2599
from django.contrib import admin from django.contrib import messages from django.db import models from django.http import HttpRequest, HttpResponse, HttpResponseRedirect from django.urls import path if False: # pragma: nocover from .models import CustomModelPage # noqa class EtcAdmin(admin.ModelAdmin): """...
bsd-3-clause
7,494,133,136,866,920,000
31.08642
97
0.643709
false
Base for admin pages with contents based on custom models. Base etc admin. Read-only etc admin base class. pragma: nocover noqa
129
en
0.73224
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/txclib/project.py
1
48650
# -*- coding: utf-8 -*- import getpass import os import re import fnmatch import datetime import time import ssl try: import configparser except ImportError: import ConfigParser as configparser from txclib.web import * from txclib.utils import * from txclib.packages import urllib3 from txclib.packages.urlli...
agpl-3.0
-8,030,408,997,415,867,000
37.611111
98
0.519301
false
Represents an association between the local and remote project instances. Initialize the Project attributes. Create a resource. Args: resource: The full resource name. pslug: The slug of the project. fileinfo: The information of the resource. filename: The name of the file. Raises: URLError, in cas...
6,245
en
0.789769
hmflash/Cura
cura/QualityManager.py
1
16324
# Copyright (c) 2016 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. # This collects a lot of quality and quality changes related code which was split between ContainerManager # and the MachineManager and really needs to usable from both. from typing import List from UM.Application i...
agpl-3.0
-6,735,441,099,129,865,000
55.076923
145
0.678878
false
Copyright (c) 2016 Ultimaker B.V. Cura is released under the terms of the AGPLv3 or higher. This collects a lot of quality and quality changes related code which was split between ContainerManager and the MachineManager and really needs to usable from both. Get the singleton instance for this class. Note: Explicit use...
5,491
en
0.689786
msyriac/orphics
bin/rot_recon.py
1
4352
from orphics.mpi import MPI import orphics.pipelines as utils import argparse from enlib import enmap # Parse command line parser = argparse.ArgumentParser(description='Run south rotation test.') parser.add_argument("-x", "--patch-width", type=float, default=40., help="Patch width in degrees.") parser.add_argument("-...
bsd-2-clause
4,958,113,471,433,312,000
41.252427
128
0.637638
false
Parse command line Intialize the rotation testing pipeline this will store CMB maps this will store input kappa maps e stands for patch native to equator, s for native to south, r for rotated from south to equator Check if a meanfield is provided Make CMB maps and kappa maps Rotate CMB map and kappa For each of e,s,r ...
630
en
0.796801
doozr/euler.py
p0013_large_sum_test.py
1
11957
""" Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629 91942213363574161572522430563301811072406154908250 23067588207539346171171...
gpl-3.0
8,063,223,558,314,383,000
54.356481
87
0.851133
false
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629 91942213363574161572522430563301811072406154908250 230675882075393461711719803...
5,212
ru
0.304368
gjhiggins/graphpath
graphpath/entail.py
1
8355
from __future__ import generators from expr import Step, Class, Property from util.anysets import Set, ImmutableSet empty_set = ImmutableSet() class RuleDict(dict): """A mapping of resources to GraphPath expressions. The expression for a given resource is the Union() of all the expressions assigned to th...
gpl-2.0
-8,830,023,813,209,567,000
31.134615
77
0.59234
false
A dictionary of class definitions and, simultaneously, the rule for rdf:type. As a mapping, the key is a class resource and the value is a GraphPath expression. As a GraphPath step, match every implied rdf:type path. A dictionary of property definitions. The key is a property resource and the value is a GraphPath e...
3,167
en
0.894226
Intel-Corporation/tensorflow
tensorflow/python/keras/optimizer_v2/ftrl.py
1
9853
# Copyright 2018 The TensorFlow Authors. 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 by applica...
apache-2.0
-5,455,901,851,465,060,000
41.106838
80
0.628134
false
Optimizer that implements the FTRL algorithm. See Algorithm 1 of this [paper]( https://www.eecs.tufts.edu/~dsculley/papers/ad-click-prediction.pdf). This version has support for both online L2 (the L2 penalty given in the paper above) and shrinkage-type L2 (which is the addition of an L2 penalty to the loss function)....
3,643
en
0.767554
faeli/joke
joke/fair/db_url.py
1
2442
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from urlparse import urlparse, parse_qsl except ImportError as e: from urllib.parse import urlparse, parse_qsl from .database import SQLiteDatabase schemes = { 'sqlite': SQLiteDatabase } def parseresult_to_dict(parsed): # urlparse in python 2.6 i...
mit
-5,027,614,411,988,602,000
29.5375
78
0.604013
false
!/usr/bin/env python -*- coding: utf-8 -*- urlparse in python 2.6 is broken so query will be empty and instead appended to path complete with '?' Adjust parameters for MySQL. Get additional connection args from the query string
227
en
0.638979
a-nai/django-wiki
wiki/plugins/images/models.py
1
5261
from __future__ import unicode_literals from __future__ import absolute_import import os.path from django.conf import settings as django_settings from django.core.exceptions import ImproperlyConfigured from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translat...
gpl-3.0
-3,529,403,965,202,404,400
32.08805
83
0.617943
false
Used to retrieve the file size and not cause exceptions. Inherit certain properties from predecessor because it's very convenient. Remember to always call this method before setting properties :) Has to match original extension filename The plugin system is so awesome that the inheritor doesn't need to do anything! :...
659
en
0.912441
fulfilio/trytond-gift-card
product.py
1
3978
# -*- coding: utf-8 -*- from trytond.model import fields, ModelSQL, ModelView from trytond.pool import PoolMeta from trytond.pyson import Eval, Bool __all__ = ['Product', 'GiftCardPrice'] __metaclass__ = PoolMeta class Product: "Product" __name__ = 'product.product' is_gift_card = fields.Boolean("Is Gif...
bsd-3-clause
-2,309,821,036,936,442,000
26.246575
74
0.565108
false
Gift Card Price Product Check minimum amount to be smaller than maximum amount Price can not be negative Type must be service only if delivery mode is virtual Type must be goods only if delivery mode is combined or physical Validates each product template Validate product price for gift card -*- coding: utf-8 -*-
317
en
0.804934
DavidCain/WinterSchool
ws/utils/ratings.py
1
7905
from datetime import timedelta from django.db.models import Case, F, IntegerField, Q, Sum, When import ws.utils.perms as perm_utils from ws import models from ws.utils.dates import local_date, local_now, ws_year def deactivate_ratings(participant, activity): """ Mark any existing ratings for the activity as ina...
gpl-3.0
-4,544,151,928,431,443,500
37.560976
96
0.651739
false
Leader applications for an activity, to be displayed to the chair. Some common tools for interacting with LeaderApplication objects. Requires self.activity Query tools for counting ratings & recs for LeaderApplications. Requires self.chair to to be a Participant object (that chairs the activity). Return if the chair...
3,126
en
0.945209
emanueldima/b2share
b2share/modules/deposit/fetchers.py
1
1411
# -*- coding: utf-8 -*- # # This file is part of EUDAT B2Share. # Copyright (C) 2016 CERN. # # B2Share 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...
gpl-2.0
-4,996,539,150,165,683,000
35.179487
76
0.736357
false
Fetch a deposit's identifiers. PID Fetchers. -*- coding: utf-8 -*- This file is part of EUDAT B2Share. Copyright (C) 2016 CERN. B2Share 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 Lic...
977
en
0.913697
suprzer0/aoc2016
day4/solve.py
1
1719
from collections import namedtuple, Counter from itertools import groupby import re from string import ascii_lowercase Room = namedtuple('Room', ['name', 'id', 'chksum']) def common_chars(text): chars = '' cnt = Counter(text) del cnt['-'] for group in groupby(cnt.most_common(), key=lambda c: c[1]): ...
mit
5,726,174,863,873,327,000
25.045455
65
0.601513
false
Converts the data from the input file into something usable by the solve functions.
84
en
0.926413
pschmitt/home-assistant
homeassistant/components/stream/__init__.py
2
7096
"""Provide functionality to stream video source.""" import logging import secrets import threading import voluptuous as vol from homeassistant.const import CONF_FILENAME, EVENT_HOMEASSISTANT_STOP from homeassistant.core import callback from homeassistant.exceptions import HomeAssistantError import homeassistant.helpe...
apache-2.0
-3,241,758,894,251,153,000
29.718615
91
0.628241
false
Represents a single stream. Initialize a stream. Stop worker thread. Add provider output stream. Reset access token if all providers are idle. Return stream outputs. Remove provider output stream. Set up stream with token. Stop all stream workers. Start a stream. Remove outputs and access token. Provide functionality t...
864
en
0.749346
robk5uj/invenio
modules/bibcirculation/lib/bibcirculation_utils.py
1
21415
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2008, 2009, 2010, 2011 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 2 of the ## License, or ...
gpl-2.0
-8,326,159,641,433,594,000
29.505698
118
0.543638
false
Verify if all copies of an item are missing @param recid: identify the record. Primary key of bibrec @type recid: int @return boolean Retrieve book's information from MARC @param recid: identify the record. Primary key of bibrec. @type recid: int @return tuple with title, year, author, isbn and editor. Retrieve boo...
4,195
en
0.705911
HiSPARC/publicdb
publicdb/raw_data/date_generator.py
1
1373
import datetime def daterange(start, stop): """Generator for date ranges This is a generator for date ranges. Based on a start and stop value, it generates one day intervals. :param start: a date instance, end of range :param stop: a date instance, end of range :yield date: dates with one da...
gpl-3.0
-3,784,288,338,580,211,700
27.604167
74
0.639476
false
Generator for date ranges This is a generator for date ranges. Based on a start and stop value, it generates one day intervals. :param start: a date instance, end of range :param stop: a date instance, end of range :yield date: dates with one day interval between start and stop Generate datetime ranges consisting of ...
711
en
0.876164
TileStache/TileStache
TileStache/Config.py
1
15616
""" The configuration bits of TileStache. TileStache configuration is stored in JSON files, and is composed of two main top-level sections: "cache" and "layers". There are examples of both in this minimal sample configuration: { "cache": {"name": "Test"}, "layers": { "example": { "...
bsd-3-clause
-1,455,473,924,395,118,800
32.367521
146
0.613473
false
Coordinate bounding box for tiles. Multiple coordinate bounding boxes for tiles. A complete site configuration, with a collection of Layer objects. Attributes: cache: Cache instance, e.g. TileStache.Caches.Disk etc. See TileStache.Caches for details on what makes a usable cache. layers: ...
5,150
en
0.732554
labcodes/django
tests/schema/models.py
1
4719
from django.apps.registry import Apps from django.db import models # Because we want to test creation and deletion of these as separate things, # these models are all inserted into a separate Apps so the main test # runner doesn't migrate them. new_apps = Apps() class Author(models.Model): name = models.CharFie...
bsd-3-clause
8,553,160,393,117,914,000
22.595
77
0.671117
false
Because we want to test creation and deletion of these as separate things, these models are all inserted into a separate Apps so the main test runner doesn't migrate them. tags = models.ManyToManyField("Tag", related_name="books") uppercase to ensure proper quoting Based on tests/reserved_names/models.py
305
en
0.920044
ddurieux/alignak
alignak/misc/termcolor.py
1
5121
#!/usr/bin/env python # -*- coding: utf-8 -*- # coding: utf-8 # Copyright (c) 2008-2011 Volvox Development Team # # 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, includin...
agpl-3.0
-3,544,723,343,725,155,000
28.096591
79
0.582894
false
Colorize text. Available text colors: red, green, yellow, blue, magenta, cyan, white. Available text highlights: on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white. Available attributes: bold, dark, underline, blink, reverse, concealed. Example: colored('Hello, World!', 'red', 'on_g...
1,682
en
0.736264
rsgemignani/dotfiles
root/usr/lib/gedit/plugins/smart_highlight/config_manager.py
1
2226
# -*- encoding:utf-8 -*- # config_manager.py is part of smart-highlighting-gedit. # # # Copyright 2010-2012 swatch # # smart-highlighting-gedit 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
8,742,912,433,380,789,000
30.352113
82
0.699461
false
-*- encoding:utf-8 -*- config_manager.py is part of smart-highlighting-gedit. Copyright 2010-2012 swatch smart-highlighting-gedit 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...
917
en
0.837249
jsidew/jakidy
src/food/models.py
1
1882
from django.db import models class Food(models.Model): name = models.CharField(max_length=45) protein = models.DecimalField(max_digits=4, decimal_places=2) carbs = models.DecimalField(max_digits=4, decimal_places=2) fat = models.DecimalField(max_digits=4, decimal_places=2) price = models.DecimalFie...
gpl-3.0
3,854,542,961,084,282,000
32.017544
69
0.565887
false
0
en
0.110449
netphi/deepin-ui
dtk/ui/scrolled_window.py
1
21880
#! /usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 ~ 2012 Deepin, Inc. # 2011 ~ 2012 Xia Bin # # Author: Xia Bin <xiabin@linuxdeepin.com> # Maintainer: Xia Bin <xiabin@linuxdeepin.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of th...
gpl-3.0
-7,670,683,437,124,144,000
40.596958
137
0.603016
false
! /usr/bin/env python -*- coding: utf-8 -*- Copyright (C) 2011 ~ 2012 Deepin, Inc. 2011 ~ 2012 Xia Bin Author: Xia Bin <xiabin@linuxdeepin.com> Maintainer: Xia Bin <xiabin@linuxdeepin.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public...
3,333
en
0.656794
golden-tech-native/gd_facerecognize
server/common/hanzi_to_pinyin/pinyin.py
1
2488
#!/usr/bin/env python # -*- coding:utf-8 -*- """ 原版代码:https://github.com/cleverdeng/pinyin.py 新增功能: 1、可以传入参数firstcode:如果为true,只取汉子的第一个拼音字母;如果为false,则会输出全部拼音; 2、修复:如果为英文字母,则直接输出; 3、修复:如果分隔符为空字符串,仍然能正常输出; 4、升级:可以指定词典的文件路径 """ __version__ = '0.9' __all__ = ["PinYin"] import os.path class PinYin(objec...
mit
-7,410,435,475,929,635,000
27.746667
87
0.551948
false
!/usr/bin/env python -*- coding:utf-8 -*-
41
en
0.321992
TheRook/nsshell
nsshell/__init__.py
1
31810
#!/usr/bin/env python #rook from __future__ import print_function import base64 import itertools import random import Queue import string import sys import subprocess import re import os import datetime from argparse import ArgumentParser, RawTextHelpFormatter from twisted.internet import defer, stdio from twisted.n...
gpl-3.0
-888,703,662,291,551,500
42.220109
174
0.536655
false
clear: Clears the console exit: exit this session, "exit all" will exit all sessions help [command]: List commands, or show help on the given command Run the server. !/usr/bin/env pythonrookLoad from the 'trusted' path that we load everything else from.This should rarely happenThe cwd could contain malicious python li...
4,715
en
0.858495
jaantollander/CrowdDynamics
crowddynamics/core/tests/test_quantities.py
1
1070
import numpy as np import pytest from hypothesis.control import assume from hypothesis.core import given from scipy.spatial.qhull import QhullError, Voronoi from crowddynamics.core.quantities import density_voronoi_1 from crowddynamics.testing import reals def all_unique(data: np.ndarray) -> bool: """Test that a...
gpl-3.0
-7,790,188,025,380,964,000
27.157895
60
0.696262
false
Test that all data rows have unique data Test that Voronoi tesselation does raise errors @given(points=reals(1, 10, shape=(3, 2))) @given(points=reals(1, 10, shape=(100, 2)))
176
en
0.626145
mivp/tessterrain
examples/geo_weather/fetch_weather_data.py
1
3521
#!/usr/bin/env python import csv import json import requests import numpy as np import sqlite3 csv_filename = "testdata/vic_usgs/south_west_stations.csv" db_filename = "testdata/vic_usgs/south_west_stations.db" # open database conn = sqlite3.connect(db_filename) c = conn.cursor() # Create stations table c.execute('...
gpl-3.0
-7,483,555,041,241,263,000
31.311927
140
0.575689
false
!/usr/bin/env python open database Create stations table Create observations table Create time point table stations Insert a row of data into stations Update observations table commit the change close database TESTING: print out to check
237
en
0.489935
eteq/ginga
ginga/qtw/GingaQt.py
1
27414
# # GingaQt.py -- Qt display handler for the Ginga reference viewer. # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # # stdlib imports import sys, os import traceback im...
bsd-3-clause
8,010,920,929,081,022,000
32.14873
92
0.546691
false
Toggle collapsing the left or right panes. Quit the application. Quit the application. GingaQt.py -- Qt display handler for the Ginga reference viewer. Eric Jeschke (eric@naoj.org) Copyright (c) Eric R. Jeschke. All rights reserved. This is open-source software licensed under a BSD license. Please ...
2,259
en
0.583959
mapgears/scribeui
scribeui_pyramid/modules/plugins/mapcache/models.py
1
1215
# -*- coding: utf-8 -*- from scribeui_pyramid.modules.app.sqla import Base, BaseMixin import sqlalchemy as sa #from . import ( # DBSession, # Base, # BaseMixin #) class Job(Base, BaseMixin): __tablename__ = 'jobs' id = sa.Column(sa.Integer, primary_key=True, autoincrement=True) title = sa.Colu...
mit
-287,510,345,046,188,900
27.255814
72
0.61893
false
-*- coding: utf-8 -*-from . import ( DBSession, Base, BaseMixin)
73
en
0.635814
barneygale/mcocr
app/server.py
1
2546
import StringIO import asyncore import socket import urlparse import re import settings as settings_herp import os import mimetypes import time import traceback import docs import http mimetypes.init() response_reasons = { 200: 'OK', 304: 'Not Modified', 404: 'Not Found', 500: 'Internal Server Error', 501: 'Not I...
bsd-3-clause
-3,733,676,247,853,530,600
23.018868
77
0.677141
false
Settings handlerDispatches incoming connections to a new handler.Error state: no handlers recognise the URL!
108
en
0.634025
google-research/google-research
caql/dual_method.py
1
5310
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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 applicab...
apache-2.0
5,858,996,064,217,988,000
31.181818
78
0.575706
false
Dual functions. coding=utf-8 Copyright 2021 The Google Research Authors. 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...
1,539
en
0.717621
googleapis/python-game-servers
samples/snippets/update_cluster.py
1
2348
#!/usr/bin/env python # Copyright 2020 Google 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 require...
apache-2.0
-2,334,753,272,189,716,500
38.79661
124
0.721039
false
Updates a game server cluster. Google Cloud Game Servers sample for updating a game server cluster. Example usage: python update_cluster.py --project-id <project-id> --location <location> --realm-id <realm-id> --cluster-id <cluster-id> !/usr/bin/env python Copyright 2020 Google Inc. All Rights Reserved. Licensed ...
915
en
0.722281
mclaughlin6464/pearce
bin/optimization/cosmo_hyperparams_mcmc.py
1
2197
import emcee as mc from pearce.emulator import OriginalRecipe, ExtraCrispy from pearce.mocks import cat_dict import numpy as np from os import path training_file = '/home/users/swmclau2/scratch/PearceRedMagicXiCosmo.hdf5' a = 1.0 z = 1./a-1.0 fixed_params = {'z':z, 'r':24.06822623} n_leaves, n_overlap = 10, 2 em_metho...
mit
4,898,353,105,985,238,000
32.287879
107
0.646791
false
TODO downsample sampling?p0 = emu._emulator.get_parameter_vector()p0 = np.array([ 0. , 10.6161248, 1.8339794, 7.342365 , 10.6371797, 2.2441632, 13.8155106, 11.3512804, 3.1795786, 4.6846614, 1. , 5.0188608, 3.7658774, -1.5383083])len(emu.get_param_names())+1
302
en
0.326837
Azure/azure-sdk-for-python
sdk/datalake/azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/job/models/job_state_audit_record.py
1
1805
# 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
-5,939,820,053,492,980,000
34.392157
81
0.584488
false
The Data Lake Analytics job state audit records for tracking the lifecycle of a job. Variables are only populated by the server, and will be ignored when sending a request. :ivar new_state: The new state the job is in. :vartype new_state: str :ivar time_stamp: The time stamp that the state change took place. :vartype...
954
en
0.749669
tcalmant/ipopo
tests/shell/test_eventadmin.py
1
5604
#!/usr/bin/env python # -- Content-Encoding: UTF-8 -- """ Tests the EventAdmin shell commands :author: Thomas Calmant """ # Standard library import threading try: import unittest2 as unittest except ImportError: import unittest # Pelix from pelix.ipopo.constants import use_ipopo import pelix.framework import...
apache-2.0
4,493,402,563,130,737,000
27.738462
80
0.544254
false
Dummy event handler Tests the EventAdmin shell commands Sets up members Registers an event handler :param topics: Event topics :param evt_filter: Event filter Runs the given shell command Handles an event received from EventAdmin Pops the list of events Prepares a framework and a registers a service to export Cleans u...
1,354
en
0.759702
Micronaet/micronaet-bom
order_bom_explode_report/report/originali/mrp_status_hw_component_parser.py
1
21833
#!/usr/bin/python # -*- coding: utf-8 -*- ############################################################################### # # Copyright (C) 2010-2012 Associazione OpenERP Italia # (<http://www.openerp-italia.org>). # Copyright(c)2008-2010 SIA "KN dati".(http://kndati.lv) All Rights Reserved. # G...
agpl-3.0
4,514,814,840,149,318,000
41.809804
95
0.373609
false
Get filter selected Get filter selected Search all mrp elements Utility for log in excel file: !/usr/bin/python -*- coding: utf-8 -*- Copyright (C) 2010-2012 Associazione OpenERP Italia (<http://www.openerp-italia.org>). Copyright(c)2008-2010 SIA "KN dati"....
6,176
en
0.471215
google/makani
analysis/control/dynamics.py
1
28331
# Copyright 2020 Makani Technologies LLC # # 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...
apache-2.0
-7,089,321,281,316,663,000
41.222057
80
0.614592
false
Model of tether force using catenary tension and rigid-rod drag. Simple model of tether force as constant in ground coordinates. Model the commanded thrust and moment by calling MixRotors. Model of tether force as a simple spring, including bridle interactions. Swig import of the simulator aerodynamics model. Simplifie...
8,164
en
0.762572
offlinehacker/sphinxcontrib.jinjadomain
sphinxcontrib/jinjadomain.py
1
3445
""" sphinxcontrib.jinjadomain ~~~~~~~~~~~~~~~~~~~~~~~~ The jinja domain for documenting jinja templates. :copyright: Copyright 2012 by Jaka Hudoklin :license: BSD, see LICENSE for details. """ import re import os from sphinx import addnodes from sphinx.domains import Domain, ObjType, Index from...
bsd-2-clause
4,406,314,289,829,284,400
27.708333
79
0.584906
false
path: (docname, synopsis)
25
en
0.349312
deuscoin-org/deuscoin-core
qa/rpc-tests/bip9-softforks.py
1
8792
#!/usr/bin/env python2 # Copyright (c) 2015 The Deuscoin Core developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # from test_framework.test_framework import ComparisonTestFramework from test_framework.util import * fro...
mit
258,358,214,866,683,870
38.968182
110
0.645018
false
Modify the signature in vin 0 of the tx to fail CSV Prepends -1 CSV DROP in the scriptSig itself. Modify the nLockTime to make it fails once MTP rule is activated Modify the nSequence to make it fails once sequence lock rule is activated (high timespan) !/usr/bin/env python2 Copyright (c) 2015 The De...
1,363
en
0.773135
gooftroop/Zeus
ef5/lib/handlers/authentication.py
1
5728
""" """ import logging import settings import tornado.gen as gen from lib.auth import login, logout, is_authenticated from lib.error.exceptions import AuthenticationError class LoginHandler(BaseHandler): """ TODO As designed, Tornado is stateless, which means that everything goes back to client This...
mit
-561,951,879,802,041,500
36.933775
112
0.516585
false
TODO As designed, Tornado is stateless, which means that everything goes back to client This can be unsecure, so in the future we might consider patching Tornado to check session if xsrf, element session id, and current user is not in a cookie(s) :return: Set client headers Get setup mode Get serial number Get h...
840
en
0.828014
jcshen007/cloudstack
systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
1
7368
# -- coding: utf-8 -- # 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 # "Li...
apache-2.0
-8,724,128,362,881,490,000
28.007874
173
0.588626
false
-- coding: utf-8 -- 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 m...
959
en
0.881734
ah744/ScaffCC_RKQC
rkqc/tools/embed_truth_table.py
1
1594
#!/home/adam/Documents/revkit-1.3/python #!/usr/bin/python # RevKit: A Toolkit for Reversible Circuit Design (www.revkit.org) # Copyright (C) 2009-2011 The RevKit Developers <revkit@informatik.uni-bremen.de> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Gener...
bsd-2-clause
4,276,062,404,617,988,000
36.952381
107
0.732748
false
!/home/adam/Documents/revkit-1.3/python!/usr/bin/python RevKit: A Toolkit for Reversible Circuit Design (www.revkit.org) Copyright (C) 2009-2011 The RevKit Developers <revkit@informatik.uni-bremen.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public Lice...
811
en
0.842076
contactless/mqtt-rpc
python/server.py
1
2415
#!/usr/bin/python import argparse try: import mosquitto except ImportError: import paho.mqtt.client as mosquitto import time, random import sys from mqttrpc import MQTTRPCResponseManager, dispatcher import logging logging.getLogger().setLevel(logging.DEBUG) @dispatcher.add_method def foobar(**kwargs): ...
mit
-7,693,251,067,194,599,000
24.691489
125
0.612422
false
!/usr/bin/python Dispatcher is dictionary {<method_name>: callable}
67
en
0.415973
muyeby/NLP
Tagger/PerceptronTagger/PerceptronClassifier.py
1
11234
#!/usr/bin/env python # encoding: utf-8 """ @version: V1.2 @author: muyeby @contact: bxf_hit@163.com @site: http://muyeby.github.io @software: PyCharm @file: assignment2.py @time: 16-7-7 下午8:44 """ from __future__ import print_function from copy import copy import time class PerceptronClassifier(object): # The per...
mit
1,610,744,026,520,288,800
34.539683
123
0.506343
false
Parameters ---------- max_iter: int The max number of iteration training_data: list The training data devel_data: list The development data, to determine the best iteration. Calcuate score from the given features and label t Parameters ---------- features: list(int) The hashed features t: int The i...
3,455
en
0.650024
PanDAWMS/panda-server
pandaserver/taskbuffer/ErrorCode.py
1
1738
############## errror code # killed EC_Kill = 100 # transfer timeout EC_Transfer = 101 # expire EC_Expire = 102 # aborted EC_Aborted = 103 # wait timeout EC_WaitTimeout = 104 # reassigned by rebrokeage EC_Reassigned = 105 # reassigned by server-side retry EC_Retried = 106 # retried by pilot EC_PilotRetried = 1...
apache-2.0
3,461,998,897,724,639,700
17.688172
53
0.758343
false
errror code killed transfer timeout expire aborted wait timeout reassigned by rebrokeage reassigned by server-side retry retried by pilot lost file (=dataservice.ErrorCode.EC_LostFile) retried for event service merge for event service merge job failed max attempt reached for Event Service do nothing since other consum...
840
en
0.954733
coteyr/home-assistant
homeassistant/components/rollershutter/demo.py
1
2390
""" Demo platform for the rollor shutter component. For more details about this platform, please refer to the documentation https://home-assistant.io/components/demo/ """ from homeassistant.components.rollershutter import RollershutterDevice from homeassistant.const import EVENT_TIME_CHANGED from homeassistant.helpers...
mit
-3,810,794,242,415,817,000
27.795181
77
0.593305
false
Represents a roller shutter. Listen for changes. Track time changes. Return the current position of the roller shutter. Move the roller shutter up. Move the roller shutter down. Returns the name of the roller shutter. Setup the Demo roller shutters. No polling needed for a demo roller shutter. Stops the roller shutter....
514
en
0.782347
osupython/pip2
tests/test_search.py
1
8658
import inspect import sys from io import StringIO import pip2.commands.freeze import pip2.commands.search import tests.log from pip2.compat import mock from pip2.compat import packaging @mock.patch.object(pip2.commands.freeze, 'freeze') @mock.patch.object(packaging.pypi.xmlrpc.Client, 'search_projects') class TestSe...
mit
8,237,081,458,629,602,000
41.234146
79
0.57161
false
System level test. Runs all previous tests at different terminal sizes. test case: 35 - too small must be min of 40 60 - small term 180 - large term
150
en
0.879621
System25/gecosws-config-assistant
firstboot/serverconf/ChefConf.py
1
3448
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # This file is part of Guadalinex # # This software 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, ...
gpl-2.0
-7,859,253,604,361,442,000
32.784314
185
0.619269
false
-*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- This file is part of Guadalinex This software 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 o...
870
en
0.91916
tovmeod/anaf
minidetector/__init__.py
1
2048
from useragents import search_strings class Middleware(object): @staticmethod def process_request(request): """Adds a "mobile" attribute to the request which is True or False depending on whether the request should be considered to come from a small-screen device such as a phone...
bsd-3-clause
6,936,481,703,161,349,000
36.925926
124
0.606445
false
View Decorator that adds a "mobile" attribute to the request which is True or False depending on whether the request should be considered to come from a small-screen device such as a phone or a PDA Adds a "mobile" attribute to the request which is True or False depending on whether the request should be considered to c...
769
en
0.923194
AstroHuntsman/POCS
pocs/images.py
1
7615
import os from astropy import units as u from astropy import wcs from astropy.coordinates import EarthLocation from astropy.coordinates import FK5 from astropy.coordinates import SkyCoord from astropy.io import fits from astropy.time import Time from collections import namedtuple from . import PanBase from .utils imp...
mit
-6,846,705,688,718,471,000
34.584112
98
0.562049
false
Object to represent a single image from a PANOPTES camera. Args: fits_file (str): Name of FITS file to be read (can be .fz) wcs_file (str, optional): Name of FITS file to use for WCS Get the pointing information from the header The header should contain the `RA-MNT` and `DEC-MNT` keywords, from which the head...
1,252
en
0.746329
pombredanne/django-rest-assured
docs/source/conf.py
1
8599
# -*- coding: utf-8 -*- # # django-rest-assured documentation build configuration file, created by # sphinx-quickstart on Fri Oct 24 10:48:27 2014. # # 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...
bsd-2-clause
9,114,272,420,712,339,000
30.966543
107
0.711362
false
-*- coding: utf-8 -*- django-rest-assured documentation build configuration file, created by sphinx-quickstart on Fri Oct 24 10:48:27 2014. 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. All configura...
7,065
en
0.668012
chop-dbhi/omop_harvest
fabfile.py
1
18855
from __future__ import print_function, with_statement import os import sys import stat import json import etcd from functools import wraps from fabric.api import * from fabric.colors import red, yellow, white, green from fabric.contrib.console import confirm from fabric.contrib.files import exists __doc__ = """\ Help...
bsd-2-clause
-3,427,390,257,368,080,400
42.146453
284
0.627208
false
Check the current Docker host for an existing instance of memcache. If found returns the container ID. Check the current Docker host for an existing instance of the specified database. If found returns the container ID. Copy down the production omop_harvest database to a fresh postgres container. Retrieves the applicat...
3,481
en
0.617888
jkriege2/JKQtPlotter
lib/jkqtmathtext/resources/xits/tools/copy-math-from-amiri.py
2
1252
import sys import fontforge amiri = fontforge.open(sys.argv[1]) xits = fontforge.open(sys.argv[2]) amiri.em = 1000 amiri.layers[1].is_quadratic = 0 amiri.selection.all() amiri.unlinkReferences() names = [] alts = [] for aglyph in amiri.glyphs(): u = aglyph.unicode if (u in range(0x1EE00, 0x1EF00) or ...
lgpl-2.1
-6,084,916,335,181,398,000
24.55102
76
0.640575
false
0
en
0.110449
pcdummy/wzlobbyserver-ng
wzlobby/protocol/protocol4.py
1
6682
# -*- coding: utf-8 -*- # vim: set et sts=4 sw=4 encoding=utf-8: # # This file is part of Warzone 2100. # Copyright (C) 2011 Warzone 2100 Project # # Warzone 2100 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 Foundatio...
gpl-2.0
7,357,415,535,087,798,000
29.372727
107
0.550883
false
-*- coding: utf-8 -*- vim: set et sts=4 sw=4 encoding=utf-8: This file is part of Warzone 2100. Copyright (C) 2011 Warzone 2100 Project Warzone 2100 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 ...
957
en
0.880972
RPGOne/Skynet
pytorch-master/torch/distributed/collectives.py
1
2102
import torch class reduce_op(object): SUM = object() PRODUCT = object() MAX = object() MIN = object() class group(object): WORLD = object() class _DistributedRequest(object): def __init__(self, request): self.request = request def is_completed(self): return torch._C._d...
bsd-3-clause
4,712,149,255,523,797,000
22.617978
70
0.685062
false
0
en
0.110449
getsentry/symsynd
symsynd/images.py
1
4038
import os import bisect from symsynd.libdebug import get_cpu_name, DebugInfo from symsynd.exceptions import DebugInfoError from symsynd.utils import timedsection, parse_addr from symsynd._compat import string_types, itervalues def get_image_cpu_name(image): cpu_name = image.get('cpu_name') if cpu_name is not...
bsd-3-clause
-2,597,764,121,753,902,000
34.113043
75
0.552006
false
Helper object to locate images. Given a list of paths and a list of binary images this returns a dictionary of image addresses to the locations on the file system for all found images. Given an instruction address this locates the image this address is contained in. Step one: load images that are named by their UUID ...
652
en
0.939269
quantopian/zipline
tests/pipeline/test_events.py
1
22248
""" Tests for setting up an EventsLoader and a BlazeEventsLoader. """ from datetime import time from itertools import product from unittest import skipIf import blaze as bz import numpy as np import pandas as pd import pytz from zipline.pipeline import Pipeline, SimplePipelineEngine from zipline.pipeline.common impor...
apache-2.0
8,105,170,151,466,807,000
35.834437
79
0.572726
false
Run the same tests as EventsLoaderTestCase, but using a BlazeEventsLoader. Check results for a single column. Check previous value results for a single column. Every event has at least three pieces of data associated with it: 1. sid : The ID of the asset associated with the event. 2. event_date : The date on which an ...
3,711
en
0.93186