repo_name
stringlengths
7
65
path
stringlengths
5
185
copies
stringlengths
1
4
size
stringlengths
4
6
content
stringlengths
977
990k
license
stringclasses
14 values
hash
stringlengths
32
32
line_mean
float64
7.18
99.4
line_max
int64
31
999
alpha_frac
float64
0.25
0.95
ratio
float64
1.5
7.84
autogenerated
bool
1 class
config_or_test
bool
2 classes
has_no_keywords
bool
2 classes
has_few_assignments
bool
1 class
spesmilo/electrum
electrum/interface.py
2
50001
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 thomasv@gitorious # # 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 witho...
mit
fc629cb481802bc381a37c28dd9a2c3c
41.699402
119
0.607968
4.01905
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/release/tests.py
2
139157
# -*- coding: utf-8 -*- # # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # import json import time from rest_framework.test import APITestCase from rest_framework import status from django.urls import reverse from django.test.client import Client from pdc.apps...
mit
e130bd544f2173479d2acbdce94449d5
51.001868
119
0.596765
3.873111
false
true
false
false
product-definition-center/product-definition-center
pdc/apps/repository/views.py
2
13569
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # import json from rest_framework import mixins, viewsets, status from rest_framework.response import Response from django.shortcuts import get_object_or_404 from . import models from . import serializers from ....
mit
df32541f4b345ce82af8dab658b70cb8
27.26875
106
0.558626
4.339303
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/auth/middleware.py
2
2657
# -*- coding: utf-8 -*- # # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # from django.contrib import auth from django.conf import settings from django.contrib.auth import load_backend from django.contrib.auth.middleware import RemoteUserMiddleware from django...
mit
4614226f01be29290554fbc5399fa4f8
43.283333
85
0.659767
4.822142
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/contact/views.py
2
13697
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # from django.views.decorators.cache import never_cache from pdc.apps.common import viewsets from pdc.apps.common.constants import PUT_OPTIONAL_PARAM_WARNING from .models import (Person, Maillist, ContactRole, ...
mit
d21c2c69cb72bb47e349ffbbc4220325
22.656304
137
0.517486
4.04997
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/auth/permissions.py
3
3111
import re from restfw_composed_permissions.base import BasePermissionComponent, BaseComposedPermision from restfw_composed_permissions.generic.components import AllowAll from django.conf import settings from pdc.apps.auth.models import Resource, GroupResourcePermission from pdc.apps.utils.utils import read_permission_...
mit
6e168364790d0c5758df1c9929bbaabb
39.402597
116
0.614915
4.406516
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/osbs/views.py
2
2581
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # from rest_framework import mixins from rest_framework import viewsets from pdc.apps.common import viewsets as common_viewsets from pdc.apps.auth.permissions import APIPermission from . import filters from . imp...
mit
d1fcb49aed43a88b2e960148dc5b6b6f
25.885417
105
0.620302
4.123003
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/auth/backends.py
2
4142
# -*- coding: utf-8 -*- # # Copyright (c) 2015-2016 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # import ldap from django.conf import settings from django.contrib.auth.backends import RemoteUserBackend from django.contrib.auth.models import Group def get_ldap_groups(l, login)...
mit
2c076c60597c71379a1f47bb14747826
28.375887
85
0.626026
3.579948
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/changeset/views.py
2
6605
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # from django.conf import settings from django.core.exceptions import FieldError, ValidationError from django.views.generic import ListView, DetailView from rest_framework import viewsets, status from rest_framew...
mit
316c1165f2b174bc680d889966c8b8a1
33.581152
110
0.479788
4.558316
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/contact/migrations/0003_auto_20151001_1309.py
6
3413
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('contact', '0002_auto_20151001_1239'), ] operations = [ migrations.AlterField( m...
mit
225f68cd3098732c5d986eccc3f5f99e
37.348315
114
0.608849
4.746871
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/contact/serializers.py
2
4777
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # import json from django.contrib.contenttypes.models import ContentType from rest_framework import serializers from pdc.apps.common.serializers import StrictSerializerMixin from pdc.apps.component.models import...
mit
fd396c35f7b4baa26a34dae398e2f4fd
36.912698
94
0.622985
4.502356
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/componentbranch/models.py
2
2274
# # Copyright (c) 2017 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # from django.db import models from pdc.apps.component.models import GlobalComponent, ReleaseComponentType class ComponentBranch(models.Model): global_component = models.ForeignKey(GlobalComponent) nam...
mit
977e3cf12e1fdea415b9f58a6a20e4ee
28.921053
79
0.585312
3.73399
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/compose/lib.py
2
17655
# -*- coding: utf-8 -*- # # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # import os import json import productmd from productmd.rpms import Rpms from django.db import transaction, connection from django.db.models import Q from rest_framework import serialize...
mit
aac3e7c2c547c4ec2b98268258db64e7
42.272059
119
0.599037
3.836375
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/component/migrations/0002_auto_20150525_1410.py
8
2168
# -*- coding: utf-8 -*- # # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # from __future__ import unicode_literals from django.db import models, migrations import mptt.fields class Migration(migrations.Migration): dependencies = [ ('contact', '00...
mit
06755e540dc8c4b402a8500ebda78cfa
31.848485
127
0.582565
4.632479
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/common/hacks.py
2
3348
# -*- coding: utf-8 -*- # # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # import re from django.db import connection from django.conf import settings from django.core.exceptions import ValidationError from rest_framework import serializers from pkg_resources ...
mit
104439739f6d023c7ba568216d693bc1
27.862069
105
0.629331
3.795918
false
false
false
false
product-definition-center/product-definition-center
pdc/settings_common.py
2
12352
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # """ Move the settings generated by 'django-admin startproject' using Django 1.8.1 to this common file, this common file doesn't include settings_local's settings. The benefit is other file like settings_test.py ...
mit
8b6888fb5db419d0a47139108e8f675e
28.692308
129
0.653416
3.418766
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/compose/views.py
2
82602
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # from itertools import groupby import json import os.path from productmd.rpms import Rpms from productmd.images import Images, Image from django.conf import settings from kobo.django.views.generic import Detail...
mit
8aedf6b4606200ebb1c4b034874889ac
38.750722
142
0.552081
4.291905
false
false
false
false
product-definition-center/product-definition-center
pdc/scripts/create_release_components.py
3
3266
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # import argparse from beanbag import BeanBagException from pdc_client import PDCClient RELEASES_RESOURCE = 'releases' RPMS_RESOURCE = 'rpms' GLOBAL_COMPONENTS_RESOURCE = 'global-components' RELEASE_COMPONENTS_...
mit
63bca48bfd775faf021f45f4f8ebc05e
36.54023
109
0.659522
3.561614
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/common/renderers.py
2
10795
# # Copyright (c) 2018 Red Hat # Licensed under The MIT License (MIT) # https://opensource.org/licenses/MIT # from collections import OrderedDict import logging import re import sys import inspect from django.conf import settings from django.utils.encoding import smart_text from contrib import drf_introspection from...
mit
515cb6bab733961cab6352c41592a441
28.097035
113
0.575174
3.960015
false
false
false
false
product-definition-center/product-definition-center
pdc/apps/osbs/tests.py
2
7347
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # from rest_framework.test import APITestCase from rest_framework import status from django.urls import reverse from pdc.apps.common.test_utils import TestCaseWithChangeSetMixin from . import models from pdc.apps...
mit
aa86e996d96890ce14f6ab21e704d2b9
47.655629
96
0.608412
3.967063
false
true
false
false
product-definition-center/product-definition-center
pdc/apps/auth/signals.py
2
1939
# # Copyright (c) 2018 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # def update_resources(sender, **kwargs): """Updates list of resources for which permissions can be created""" import inspect from django.conf import settings from django.utils.module_loading im...
mit
6f297e1518b1930ee74afbfb0fc98067
41.152174
92
0.636411
4.252193
false
false
false
false
webcomics/dosage
scripts/mklanguages.py
1
1323
#!/usr/bin/env python3 # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2020 Tobias Gruetzmacher '''update languages.py from pycountry''' import os import codecs from dosagelib.scraper import scrapers def ...
mit
b2aea50bb5087e1a30e000ddec619814
29.767442
73
0.643235
3.349367
false
false
false
false
kivy/pyjnius
setup.py
1
2955
''' Setup.py for creating a binary distribution. ''' from __future__ import print_function from setuptools import setup, Extension from setuptools.command.build_ext import build_ext try: import subprocess32 as subprocess except ImportError: import subprocess from os import environ from os.path import dirname,...
mit
91eb571a7f35e47748283e22c7b23e5c
25.383929
85
0.653807
3.170601
false
false
false
false
webcomics/dosage
dosagelib/plugins/q.py
1
1082
# SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring from ..scraper import ParserScraper class QuantumVibe(ParserScraper): url = 'https://www.q...
mit
042ad2d95f42a8d467c37ff161ab6ddf
32.8125
64
0.660813
2.956284
false
false
false
false
webcomics/dosage
scripts/webcomicfactory.py
1
1470
#!/usr/bin/env python3 # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2016 Tobias Gruetzmacher """ Script to get WebComicFactory comics and save the info in a JSON file for further processing. """ from scri...
mit
6b5617396b0a22949b66017128198d3a
31.622222
73
0.613079
3.359268
false
false
false
false
sendgrid/sendgrid-python
sendgrid/helpers/mail/html_content.py
2
1434
from .content import Content from .validators import ValidateApiKey class HtmlContent(Content): """HTML content to be included in your email.""" def __init__(self, content): """Create an HtmlContent with the specified MIME type and content. :param content: The HTML content. :type con...
mit
ef93b3aca655656c62f67549a8df18f1
23.305085
74
0.572524
4.625806
false
false
false
false
mrkipling/maraschino
modules/couchpotato.py
3
14369
from flask import render_template, request, jsonify, json, send_file from jinja2.filters import FILTERS from maraschino.tools import get_setting_value, requires_auth from maraschino import logger, app, WEBROOT import urllib2 import StringIO import base64 import re def couchpotato_http(): if get_setting_value('cou...
mit
85851ec8ee4b2a867d1a3ac01d6c72b0
29.314346
138
0.596492
3.660892
false
false
false
false
mrkipling/maraschino
lib/apscheduler/job.py
29
4675
""" Jobs represent scheduled tasks. """ from threading import Lock from datetime import timedelta from apscheduler.util import to_unicode, ref_to_obj, get_callable_name,\ obj_to_ref class MaxInstancesReachedError(Exception): pass class Job(object): """ Encapsulates the actual Job along with its me...
mit
e9079fd63e82f3e6b9bc6a0d569f153a
33.88806
79
0.606203
4.108084
false
false
false
false
mrkipling/maraschino
modules/weather.py
8
3625
from flask import render_template from maraschino import app, WEBROOT from maraschino.tools import requires_auth, get_setting_value from weatherfeed.weatherfeed import Weather from jinja2.filters import FILTERS import datetime def meridian(): meridian = get_setting_value('weather_time') == '0' return meridian...
mit
d3b15c476c07ab6166560cb415c29eae
24.173611
103
0.525517
3.59623
false
false
false
false
california-civic-data-coalition/django-calaccess-campaign-browser
calaccess_campaign_browser/models/filers.py
3
8245
from .filings import Filing from django.db import models from django.template.defaultfilters import slugify from calaccess_campaign_browser.utils.models import AllCapsNameMixin import time class Filer(AllCapsNameMixin): """ An entity that files campaign finance disclosure documents. That includes candida...
mit
a708c49d58cc241c5849fc25722762ce
29.091241
79
0.561431
3.630559
false
false
false
false
mrkipling/maraschino
maraschino/models.py
6
5319
# -*- coding: utf-8 -*- """Class that represent the database structure""" from sqlalchemy import Column, Integer, String, Boolean, PickleType from maraschino.database import Base class Module(Base): """Table for one Maraschino module""" __tablename__ = 'modules' id = Column(Integer, primary_key=True) ...
mit
8db32392fcf27414d7accba95d5bfbad
25.595
111
0.599549
3.865552
false
false
false
false
mrkipling/maraschino
lib/werkzeug/exceptions.py
84
16350
# -*- coding: utf-8 -*- """ werkzeug.exceptions ~~~~~~~~~~~~~~~~~~~ This module implements a number of Python exceptions you can raise from within your views to trigger a standard non-200 response. Usage Example ------------- :: from werkzeug.wrappers import BaseRequest ...
mit
d111c7da7827e59133e7c8d35dd79e84
29.503731
82
0.635841
4.440521
false
false
false
false
mrkipling/maraschino
lib/sqlalchemy/events.py
14
15648
# sqlalchemy/events.py # Copyright (C) 2005-2011 the SQLAlchemy authors and contributors <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Core event interfaces.""" from sqlalchemy import event, exc, util engine = ut...
mit
04d8bddfb63ffc68a218cd32fef54c49
35.138568
119
0.619888
4.754786
false
false
false
false
mrkipling/maraschino
lib/jinja2/nodes.py
122
28750
# -*- coding: utf-8 -*- """ jinja2.nodes ~~~~~~~~~~~~ This module implements additional nodes derived from the ast base node. It also provides some node tree helper functions like `in_lineno` and `get_nodes` used by the parser and translator in order to normalize python and jinja nodes. :...
mit
da1402c6f9aff67a9ba767982264013c
30.593407
81
0.600243
4.027739
false
false
false
false
mikedh/trimesh
tests/test_base.py
1
3393
""" Test the base trimesh.Trimesh object. """ try: from . import generic as g except BaseException: import generic as g class MeshTests(g.unittest.TestCase): def test_vertex_neighbors(self): m = g.trimesh.primitives.Box() neighbors = m.vertex_neighbors assert len(neighbors) == len...
mit
1491cd10c9bd74166e8e602d9533f815
30.71028
76
0.563218
3.945349
false
true
false
false
mikedh/trimesh
trimesh/base.py
1
97401
""" github.com/mikedh/trimesh ---------------------------- Library for importing, exporting and doing simple operations on triangular meshes. """ from . import ray from . import util from . import units from . import poses from . import graph from . import sample from . import repair from . import convex from . impor...
mit
95ebaec02c4cd858558096ccb690509c
31.039803
86
0.559163
4.682065
false
false
false
false
smarkets/smk_python_sdk
smarkets/errors.py
1
1918
from __future__ import absolute_import, division, print_function, unicode_literals import sys as _sys from collections import namedtuple as _namedtuple from contextlib import contextmanager as _contextmanager import decorator as _decorator import six as _six def reraise(exception): prev_cls, prev, tb = _sys.exc...
mit
c0e3529a44854b64ebf22813518dddf9
23.589744
82
0.613139
4.419355
false
false
false
false
kapsiry/sikteeri
membership/management/commands/procountor.py
2
1992
# encoding: utf-8 import argparse from datetime import datetime, timedelta from django.conf import settings from django.core.management import BaseCommand, CommandError from procountor.procountor_api import ProcountorAPIClient from membership.billing.payments import process_payments from procountor.models import APIT...
mit
6e5d0cec58517ae3c21656e29c6030d6
37.307692
108
0.626506
4.220339
false
false
false
false
kapsiry/sikteeri
membership/decorators.py
2
1735
# encoding: utf-8 """ decorators.py """ from django.contrib.auth import authenticate from django.http import HttpResponse, HttpResponseForbidden from django.conf import settings from membership.utils import get_client_ip from sikteeri.iptools import IpRangeList import base64 def trusted_host_required(view_func):...
mit
1b0ecbca0778c8a3839b6d6fe1acfe0a
31.12963
80
0.622478
4.170673
false
false
false
false
mikedh/trimesh
tests/test_graph.py
1
10535
try: from . import generic as g except BaseException: import generic as g class GraphTest(g.unittest.TestCase): def setUp(self): self.engines = ['scipy', 'networkx'] def test_soup(self): # a soup of random triangles, with no adjacent pairs soup = g.get_mesh('soup.stl') ...
mit
471a7b6b6bbbb3793784ab94bb8b1655
37.309091
78
0.529378
3.967985
false
true
false
false
mikedh/trimesh
examples/outlined.py
2
1159
""" outlined.py -------------- Show a mesh with edges highlighted using GL_LINES """ import trimesh import numpy as np if __name__ == '__main__': mesh = trimesh.load('../models/featuretype.STL') # get edges we want to highlight by finding edges # that have sharp angles between adjacent faces edges =...
mit
8edbde8e2ebded589491bd1ef79e4b0e
32.114286
82
0.664366
3.599379
false
false
false
false
mikedh/trimesh
trimesh/intersections.py
1
27708
""" intersections.py ------------------ Primarily mesh-plane intersections (slicing). """ import numpy as np from . import util from . import geometry from . import grouping from . import triangles as tm from . import transformations as tf from .constants import tol def mesh_plane(mesh, plane_normal...
mit
606feae38be79e43a54547306d042ef6
34.79845
83
0.582287
3.948133
false
false
false
false
smarkets/smk_python_sdk
smarkets/uuid.py
1
8456
from __future__ import absolute_import """ Utility methods for dealing with Smarkets UUIDS. There are 3 main representations of IDs used in Smarkets: - Integers (as in the API) - Tagged UUIDs (used mostly on non-user-facing bits of the site) - "Friendly" IDs/slugs (used on user-facing bits of the site) """ import l...
mit
bb365cbb9331a0c3e5aba832e53e4178
31.152091
89
0.594134
3.402817
false
false
false
false
mikedh/trimesh
trimesh/scene/transforms.py
1
26298
import numpy as np import collections from copy import deepcopy from .. import util from .. import caching from .. import transformations from ..caching import hash_fast # we compare to identity a lot _identity = np.eye(4) _identity.flags['WRITEABLE'] = False class SceneGraph(object): """ Hold data about ...
mit
85afdd219aa750abadf54a692c371346
30.799274
85
0.529774
4.680192
false
false
false
false
mikedh/trimesh
trimesh/path/exchange/load.py
1
2598
import os from .dxf import _dxf_loaders from .svg_io import svg_to_path from ..path import Path from . import misc from ... import util def load_path(file_obj, file_type=None, **kwargs): """ Load a file to a Path file_object. Parameters ----------- file_obj : One of the following: - Pa...
mit
af6daaa8e8cd5fb38a78277f4827af7b
29.928571
74
0.617398
3.776163
false
false
false
false
mikedh/trimesh
trimesh/viewer/notebook.py
1
3052
""" notebook.py ------------- Render trimesh.Scene objects in HTML and jupyter notebooks using three.js """ import os import base64 # for our template from .. import util from .. import resources def scene_to_html(scene): """ Return HTML that will render the scene using GLTF/GLB encoded to base64 loaded...
mit
1f460602c985bc80879417b8baee8bb0
26.495495
71
0.624181
4.118758
false
false
false
false
kapsiry/sikteeri
procountor/procountor_api.py
2
12672
import random import string from datetime import datetime, timedelta from decimal import Decimal import requests import logging logger = logging.getLogger("ProcountorAPI") class ProcountorAPIException(Exception): pass class ProcountorBankStatement(object): def __init__(self, row): self.id = row.ge...
mit
51f7eed73de4f8b4cac3bd6a3b8b61e6
37.277946
117
0.54562
4.014575
false
false
false
false
mikedh/trimesh
trimesh/geometry.py
1
14644
import numpy as np from . import util from .constants import log try: import scipy.sparse except BaseException as E: from . import exceptions # raise E again if anyone tries to use sparse scipy = exceptions.ExceptionModule(E) def plane_transform(origin, normal): """ Given the origin and norm...
mit
85ec9b531c62f9fb584046a8ff47e56e
30.62851
87
0.556474
3.621167
false
false
false
false
neuroailab/tfutils
tfutils/imagenet_data.py
1
14375
""" This script contains class method `dataset_func` which will return dataset elements The data format structure of ImageNet required for `dataset_func` is similar as data structure generated by following structure: https://github.com/tensorflow/models/blob/master/research/inception/inception/data/build_imagenet_...
mit
da6bd0cb567142e914f5201c903479e1
34.146699
109
0.539687
3.919029
false
false
false
false
braintree/braintree_python
braintree/us_bank_account.py
1
1519
import braintree from braintree.resource import Resource from braintree.configuration import Configuration from braintree.ach_mandate import AchMandate from braintree.us_bank_account_verification import UsBankAccountVerification class UsBankAccount(Resource): @staticmethod def find(token): return Conf...
mit
c09cc1ff96ee115879d652ae336a25a5
32.755556
100
0.638578
4.402899
false
true
false
false
braintree/braintree_python
braintree/util/crypto.py
1
1224
import hashlib import hmac import sys text_type = str class Crypto: @staticmethod def sha1_hmac_hash(secret_key, content): if isinstance(secret_key, text_type): secret_key = secret_key.encode('ascii') if isinstance(content, text_type): content = content.encode('ascii') ...
mit
f6cdb3190c14bf0520878766d1845de1
31.210526
97
0.617647
3.948387
false
false
false
false
braintree/braintree_python
braintree/test/nonces.py
1
5118
class Nonces(object): Transactable = "fake-valid-nonce" Consumed = "fake-consumed-nonce" PayPalOneTimePayment = "fake-paypal-one-time-nonce" PayPalFuturePayment = "fake-paypal-future-nonce" PayPalBillingAgreement = "fake-paypal-billing-agreement-nonce" ApplePayVisa = "fake-apple-pay-visa-nonce" ...
mit
b898319464e6a079d24947fde61915d9
64.615385
137
0.782141
3.15342
false
false
false
false
braintree/braintree_python
tests/integration/test_exchange_rate_quote.py
1
4968
from tests.test_helper import * from braintree.exchange_rate_quote_request import ExchangeRateQuoteRequest class TestExchangeRateQuote(unittest.TestCase): @staticmethod def get_gateway(): config = Configuration("development", "integration_merchant_id", public_key="integra...
mit
0de6b40ac1a3b971a6f45b36afb634fc
45.009259
85
0.613527
3.81274
false
true
false
false
eggpi/citationhunt
handlers/citationhunt.py
2
5738
import chdb import config from . import database from utils import * from .common import * import collections import datetime import urllib.request, urllib.parse, urllib.error import urllib.parse now = datetime.datetime.now Category = collections.namedtuple('Category', ['id', 'title']) CATEGORY_ALL = Category('all',...
mit
a01c434e5a3a056c63c1f4cef9db3ba5
33.987805
77
0.61694
3.713916
false
false
false
false
istresearch/scrapy-cluster
kafka-monitor/plugins/action_handler.py
1
1457
from __future__ import absolute_import from .base_handler import BaseHandler import tldextract import redis import sys from redis.exceptions import ConnectionError class ActionHandler(BaseHandler): schema = "action_schema.json" def setup(self, settings): ''' Setup redis and tldextract ...
mit
825453ccbb5b4d68287ea9ea44c55cac
28.734694
76
0.560741
4.323442
false
false
false
false
istresearch/scrapy-cluster
utils/scutils/redis_queue.py
1
4196
from future import standard_library standard_library.install_aliases() from builtins import object try: import pickle as pickle except ImportError: import pickle class Base(object): ''' Queue/Stack base class ''' def __init__(self, server, key, encoding=pickle): '''Initialize the redi...
mit
d3e3063223de5c7120348c2892ba8b2d
23.114943
76
0.545043
4.325773
false
false
false
false
ydkhatri/mac_apt
plugins/terminalstate.py
1
10842
''' Copyright (c) 2017 Yogesh Khatri This file is part of mac_apt (macOS Artifact Parsing Tool). Usage or distribution of this software/code is subject to the terms of the MIT License. terminalstate.py --------------- This plugin reads Terminal Saved State information which includes full text ...
mit
654c001f72acb9d5bf09477098b7fc8f
41.190661
180
0.589375
3.850142
false
false
false
false
hungpham2511/toppra
toppra/utils.py
1
5642
""" Some utility functions need to generate PathConstraints. Most are specific to different scenarios. """ import logging import functools import warnings import numpy as np logger = logging.getLogger(__name__) def deprecated(func): """This is a decorator which can be used to mark functions as deprecated. ...
mit
78b688d12f200ef15ccc41aae64d0e4d
29.497297
91
0.620525
3.450765
false
false
false
false
ydkhatri/mac_apt
plugins/helpers/disk_report.py
1
7200
''' Copyright (c) 2017 Yogesh Khatri This file is part of mac_apt (macOS Artifact Parsing Tool). Usage or distribution of this software/code is subject to the terms of the MIT License. ''' import pytsk3 from plugins.helpers.apfs_reader import ApfsSysDataLinkedVolume import plugins.helpers...
mit
0a9463b42fae2716fc0a97505cc2c1b6
51.731343
177
0.550139
3.742204
false
false
false
false
ydkhatri/mac_apt
plugins/screentime.py
1
8675
''' Copyright (c) 2019 Yogesh Khatri This file is part of mac_apt (macOS Artifact Parsing Tool). Usage or distribution of this software/code is subject to the terms of the MIT License. ''' from plugins.helpers.macinfo import * from plugins.helpers.writer import * from plugins.helpers.common import * impo...
mit
bd34654f6ff5566049400040ea39e44f
41.738916
134
0.620058
3.465841
false
false
false
false
ydkhatri/mac_apt
plugins/safari.py
1
32974
''' Copyright (c) 2017 Yogesh Khatri This file is part of mac_apt (macOS Artifact Parsing Tool). Usage or distribution of this software/code is subject to the terms of the MIT License. ''' import io import os import logging import nska_deserialize as nd from plugins.helpers import macinfo import plu...
mit
e931c2462a8d17c6358c545d4d2c56ea
48.736048
180
0.58816
3.988147
false
false
false
false
hungpham2511/toppra
toppra/algorithm/reachabilitybased/time_optimal_algorithm.py
1
3023
from .reachability_algorithm import ReachabilityAlgorithm import logging import numpy as np logger = logging.getLogger(__name__) class TOPPRA(ReachabilityAlgorithm): """Time-Optimal Path Parameterization based on Reachability Analysis (TOPPRA). Examples ----------- >>> instance = algo.TOPPRA([pc...
mit
dbca400b757f50203b62a48b95fc8320
31.858696
84
0.631161
4.090663
false
false
false
false
hungpham2511/toppra
examples/plot_straight_line.py
1
1994
""" Retime a straight path =============================== """ import toppra as ta import toppra.constraint as constraint import toppra.algorithm as algo import numpy as np import matplotlib.pyplot as plt import time time.sleep(0.1) ################################################################################ way_...
mit
e36f69d72c37aac9f422c445b61ca11b
35.925926
115
0.611836
3.252855
false
false
false
false
hungpham2511/toppra
tests/tests/solverwrapper/test_basic_can_linear.py
1
8575
"""A test suite for solverwrappers that implement solve methods for canonical linear constraints. Wrapppers considered include: 'cvxpy', 'qpOASES', "ecos", 'hotqpOASES', 'seidel'. """ import pytest import numpy as np import numpy.testing as npt import toppra import toppra.constraint as constraint import cvxpy from .....
mit
213549fde43ca418910a584b64fdb729
43.201031
112
0.668105
3.199627
false
true
false
false
ydkhatri/mac_apt
plugins/helpers/hfs_alt.py
1
22333
''' Copyright 2011 Jean-Baptiste B'edrune, Jean Sigwald Using New BSD License: 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 conditio...
mit
9270e420ea4fdde70b2c5bbee01a2f13
46.927039
755
0.62889
3.870537
false
false
false
false
hungpham2511/toppra
tests/tests/interpolators/test_find_gridpoints.py
1
1640
import toppra import toppra.interpolator import numpy as np import matplotlib.pyplot as plt import pytest @pytest.fixture(params=[[0, 1], [1.5, 2.7]]) def path(request): start, end = request.param waypoints = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2], [0, 0.5, 0]] ss = np.linspace(start, end, len(waypoin...
mit
93a1d42c3f1c277478ee2f2131cb655f
35.444444
106
0.635366
3.065421
false
true
false
false
ydkhatri/mac_apt
plugins/dockitems.py
1
6877
''' Copyright (c) 2018 Yogesh Khatri This file is part of mac_apt (macOS Artifact Parsing Tool). Usage or distribution of this software/code is subject to the terms of the MIT License. dockitems.py --------------- Reads the dock plist file for each user. ''' import logging from plugins.helpers....
mit
b00170f83420fcd32826bed0a673495c
41.9875
180
0.58732
3.887507
false
false
false
false
hungpham2511/toppra
setup.py
1
4039
from setuptools import setup, Extension from distutils.command.install import install from Cython.Distutils import build_ext from Cython.Build import cythonize import numpy as np import sys NAME = "toppra" with open("VERSION", "r", encoding='UTF-8') as file_: VERSION = file_.read() DESCR = "toppra: time-optimal pa...
mit
e6b6c8f9107467d8f2915fbcff9e9746
33.228814
97
0.572419
3.628931
false
false
false
false
ebmdatalab/openprescribing
openprescribing/pipeline/management/commands/fetch_prescribing_data.py
2
1255
import os import requests from django.conf import settings from django.core.management import BaseCommand from openprescribing.utils import mkdir_p class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument("year", type=int) parser.add_argument("month", type=int) def ...
mit
93fad071cfdd24aa7f11dfa0edac52a5
30.375
99
0.587251
3.535211
false
false
false
false
ebmdatalab/openprescribing
openprescribing/matrixstore/build/sort_and_merge_gzipped_csv_files.py
2
4179
import csv import os from pipes import quote import subprocess class InvalidHeaderError(Exception): pass def sort_and_merge_gzipped_csv_files( # CSV files to sort (which may or may not be gzipped) input_filenames, # Output file output_filename, # Column names to sort by sort_columns, ): ...
mit
ab1b792b85f0e5df0d3e794b4674e3de
34.117647
88
0.652309
3.931326
false
false
false
false
html5lib/html5lib-python
html5lib/treebuilders/etree_lxml.py
42
14754
"""Module for supporting the lxml.etree library. The idea here is to use as much of the native library as possible, without using fragile hacks like custom element names that break between releases. The downside of this is that we cannot represent all possible trees; specifically the following are known to cause proble...
mit
be6dbfb52903223ac5b519d2213857a5
36.637755
121
0.559374
4.579143
false
false
false
false
pytorch/fairseq
fairseq/benchmark/dummy_lm.py
1
2757
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from dataclasses import dataclass, field from typing import Optional import torch from .dummy_dataset import DummyDataset from...
mit
05a54fb37928834c79c0d581b092fe58
32.216867
84
0.606456
3.745924
false
false
false
false
pytorch/fairseq
tests/test_sequence_scorer.py
1
4150
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import unittest import tests.utils as test_utils import torch from fairseq.sequence_scorer import SequenceScorer class Test...
mit
dff053c46d83fc9f6ad7a78a9d46e5ae
33.583333
76
0.479759
3.540956
false
true
false
false
pytorch/fairseq
examples/speech_synthesis/utils.py
1
3357
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from scipy.interpolate import interp1d import torchaudio from fairseq.tasks.text_to_speech import ( batch...
mit
ff1914efc5354b73f935fe0bffdff812
32.237624
78
0.645815
2.837701
false
false
false
false
pytorch/fairseq
examples/MMPT/mmpt/utils/shardedtensor.py
1
1410
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import pickle import numpy as np class ShardedTensor(object): def __init__(self, data, starts): self.data = data ...
mit
f240e4fc1b4ebe06f60d2856d011221f
29.652174
65
0.584397
3.439024
false
false
false
false
pytorch/fairseq
fairseq/modules/quantization/pq/utils.py
1
13493
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import re from operator import attrgetter, itemgetter import torch import numpy as np import torch.distributed as dist import t...
mit
29731f637b83185323ff97530532a55e
34.885638
100
0.584674
4.128825
false
false
false
false
pytorch/fairseq
examples/MMPT/mmpt/tasks/retritask.py
1
8413
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import torch import pickle import random from tqdm import tqdm from torch.utils.data import DataLoader from torch.utils.data.distrib...
mit
50ecdec595bc228c32be58024e8cf554
32.252964
82
0.582907
3.838047
false
true
false
false
ic-labs/django-icekit
glamkit_collections/contrib/work_creator/migrations/0004_auto_20161026_1828.py
2
2607
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('icekit_plugins_image', '0008_auto_20160920_2114'), ('gk_collections_work_creator', '0003_auto_20161026_1606'), ] operations ...
mit
8d2aa09354806dc07800fa9932275735
39.107692
133
0.559264
4.426146
false
false
false
false
ic-labs/django-icekit
glamkit_collections/contrib/work_creator/plugins/artwork/models.py
2
1766
from glamkit_collections.contrib.work_creator.models import WorkBase from django.db import models class Artwork(WorkBase): medium_display = models.CharField( blank=True, max_length=255, help_text='A display field for information concerning the ' 'material/media & support o...
mit
f572841f7ba5b2a98d06ae60950bce8e
34.34
79
0.61325
4.069124
false
false
false
false
ic-labs/django-icekit
glamkit_collections/migrations/0001_initial.py
2
2089
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django_countries.fields class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Country', fields=[ ...
mit
766a374f06f51e653d3c4d3269b2af09
49.95122
424
0.564385
3.697345
false
false
false
false
thorrak/fermentrack
brewpi-script/scriptlibs/pinList.py
1
11009
# Copyright 2013 BrewPi # This file is part of BrewPi. # BrewPi 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. # BrewPi is distribut...
mit
60cecad4e42760b0ab1bb4d0b9479a0c
56.041451
80
0.39068
3.277464
false
false
false
false
thorrak/fermentrack
firmware_flash/models.py
1
20289
from __future__ import unicode_literals from django.db import models from django.core.validators import MinValueValidator, MaxValueValidator from django.utils import timezone import os.path import requests import logging from . import fhash from constance import config try: from fermentrack_django import setti...
mit
26692e6053ab1e45047ccfd4bf1ef4d1
43.010846
139
0.590369
4.107085
false
false
false
false
thorrak/fermentrack
app/udev_integration.py
1
1892
from __future__ import print_function try: import pyudev pyudev_available = True except: pyudev_available = False import sys def get_platform(): platforms = { 'linux': 'Linux', 'linux1': 'Linux', 'linux2': 'Linux', 'darwin': 'OS X', 'win32': 'Windows' } ...
mit
5ac91bccd535c7a82329c28dcfe13215
27.238806
159
0.632135
3.60381
false
false
false
false
thorrak/fermentrack
app/decorators.py
1
3846
from functools import wraps from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME from django.core.exceptions import PermissionDenied from django.shortcuts import resolve_url import urllib.parse from constance import config # For the explicitly user-configurable stuff from django.contr...
mit
019f5235479b92cca398ce5fc05a9d1a
38.244898
112
0.682007
4.157838
false
true
false
false
thorrak/fermentrack
external_push/migrations/0006_Grainfather_Support.py
1
1953
# -*- coding: utf-8 -*- # Generated by Django 1.11.27 on 2019-12-23 13:58 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('gravity', '0004_BrewersFriend_Support'), ('externa...
mit
1972c2be8389fd78434bd97a18933b54
56.441176
255
0.62468
3.953441
false
false
false
false
thorrak/fermentrack
app/api/clog.py
1
4679
import os from django.http import HttpResponse from django.conf import settings from app.models import BrewPiDevice from pathlib import Path def get_filepath_to_log(device_type, logfile="", device_id=None) -> Path or None: # get_filepath_to_log is being broken out so that we can use it in help/other templates to ...
mit
bbb5671ee940bc8e020d10dfd244f1b0
41.153153
117
0.645223
3.825838
false
false
false
false
thorrak/fermentrack
gravity/tilt/TiltHydrometer.py
1
11713
import datetime from typing import List, Dict, TYPE_CHECKING from collections import deque from gravity.models import TiltConfiguration, GravityLogPoint, GravitySensor # from asgiref.sync import sync_to_async class TiltHydrometer(object): # These are all the UUIDs currently available as Tilt colors tilt_col...
mit
5262c17012e6807dea6cb5b3fa5d3d5a
42.546468
122
0.61086
3.659169
false
false
false
false
pycassa/pycassa
ez_setup.py
73
8596
#!python """Bootstrap setuptools installation If you want to use setuptools in your package's setup.py, just include this file in the same directory with it, and add this to the top of your setup.py:: from ez_setup import use_setuptools use_setuptools() If you want to require a specific version of setuptools...
mit
f875f3d1c93a33701fad72b117b0cff7
32.317829
78
0.616799
4.031895
false
false
false
false
pycassa/pycassa
pycassa/logging/pool_stats_logger.py
1
3708
import pycassa_logger import logging import threading import functools def sync(lock_name): def wrapper(f): @functools.wraps(f) def wrapped(self, *args, **kwargs): lock = getattr(self, lock_name) try: lock.acquire() return f(self, *args, **kwa...
mit
db1fb511ba9117c8cf3f68ba87eaec19
25.869565
115
0.507012
3.961538
false
false
false
false
pycassa/pycassa
pycassa/types.py
1
8980
""" Data type definitions that are used when converting data to and from the binary format that the data will be stored in. In addition to the default classes included here, you may also define custom types by creating a new class that extends :class:`~.CassandraType`. For example, IntString, which stores an arbitrary...
mit
d7b4fa3811e0589e40188de65829a499
29.753425
88
0.653786
4.072562
false
false
false
false
pycassa/pycassa
pycassa/columnfamilymap.py
1
11089
""" Provides a way to map an existing class of objects to a column family. This can help to cut down boilerplate code related to converting objects to a row format and back again. ColumnFamilyMap is primarily useful when you have one "object" per row. .. seealso:: :mod:`pycassa.types` for selecting data types for ob...
mit
a46a010f13016d0588fc5e46f14465b5
39.619048
118
0.593651
4.421451
false
false
false
false
jungmannlab/picasso
picasso/gaussmle.py
1
22027
""" picasso/gaussmle ~~~~~~~~~~~~~~~~ Maximum likelihood fits for single particle localization :authors: Joerg Schnitzbauer, Maximilian Thomas Strauss, 2016-2018 :copyright: Copyright (c) 2016-2018 Jungmann Lab, MPI of Biochemistry """ import numpy as _np import numba as _numba import math as _ma...
mit
cfa1c392905be78a2b66ccb514143f59
31.062591
87
0.471467
3.095854
false
false
false
false
jungmannlab/picasso
picasso/gui/render.py
1
419669
""" gui/render ~~~~~~~~~~~~~~~~~~~~ Graphical user interface for rendering localization images :author: Joerg Schnitzbauer & Maximilian Strauss & Rafal Kowalewski, 2017-2022 :copyright: Copyright (c) 2017 Jungmann Lab, MPI of Biochemistry """ import os import sys import traceback import cop...
mit
6da063298bdf8582876bcc1d2a7c8bfc
34.902986
84
0.519884
4.17631
false
false
false
false
openforcefield/openff-toolkit
openff/toolkit/topology/molecule.py
1
217774
""" Molecular chemical entity representation and routines to interface with cheminformatics toolkits .. todo:: * Our main philosophy here is to keep the object contents of topology objects easily serializable/deserializable * Have ``Molecule`` raise an exception if loading/creating molecules with unspecified s...
mit
25d1c3c23fbc06801f6f9e2574e92859
36.410754
158
0.595138
4.317196
false
false
false
false
openforcefield/openff-toolkit
openff/toolkit/utils/viz.py
1
1579
import uuid from io import StringIO from typing import TYPE_CHECKING, Dict from openff.units import unit try: from nglview import Trajectory as _NGLViewTrajectory except ImportError: # pragma: no cover _NGLViewTrajectory = object if TYPE_CHECKING: from openff.toolkit.topology.molecule import Molecule ...
mit
e7ac6b3412521246ac4b3fa30ed4f25b
28.240741
85
0.642179
3.823245
false
false
false
false
evansd/whitenoise
src/whitenoise/media_types.py
1
5195
from __future__ import annotations import os class MediaTypes: __slots__ = ("types_map",) def __init__(self, *, extra_types: dict[str, str] | None = None) -> None: self.types_map = default_types() if extra_types is not None: self.types_map.update(extra_types) def get_type(se...
mit
7be74d997bac42f714c0c0a5754b1e93
36.919708
93
0.546679
3.259097
false
false
false
false
pypa/pip
src/pip/_internal/models/wheel.py
4
3600
"""Represents a wheel file and provides access to the various parts of the name that have meaning. """ import re from typing import Dict, Iterable, List from pip._vendor.packaging.tags import Tag from pip._internal.exceptions import InvalidWheelFilename class Wheel: """A wheel file""" wheel_file_re = re.co...
mit
234541de53061bd3b28b46962d870bed
38.130435
89
0.611667
3.947368
false
false
false
false
pypa/pip
src/pip/_vendor/packaging/utils.py
37
4200
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import re from typing import FrozenSet, NewType, Tuple, Union, cast from .tags import Tag, parse_tag from .version import InvalidVersion, ...
mit
023f906dc28eda2631ea4250197d4e92
29.882353
88
0.630714
3.839122
false
false
false
false
pypa/pip
src/pip/_internal/commands/hash.py
9
1703
import hashlib import logging import sys from optparse import Values from typing import List from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES from pip._internal.utils.misc import read_chunks,...
mit
a3e9aea0d3dc8b8bed57d4892cef9b2e
27.864407
84
0.602466
3.969697
false
false
false
false
pypa/pip
src/pip/_internal/utils/filesystem.py
4
5122
import fnmatch import os import os.path import random import sys from contextlib import contextmanager from tempfile import NamedTemporaryFile from typing import Any, BinaryIO, Generator, List, Union, cast from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed from pip._internal.utils.compat import get_...
mit
bc3808cff923c0249196cf476f08815a
32.477124
85
0.634713
3.927914
false
false
false
false