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
django-extensions/django-extensions
tests/management/commands/test_print_settings.py
1
1674
# -*- coding: utf-8 -*- import pytest from django.core.management import CommandError, call_command def test_without_args(capsys): call_command('print_settings') out, err = capsys.readouterr() assert 'DEBUG' in out assert 'INSTALLED_APPS' in out def test_with_setting_args(capsys): call_command...
mit
97b03d7c53f85c2314e8cbdbee519bab
21.621622
84
0.626045
3.502092
false
true
false
false
django-extensions/django-extensions
django_extensions/management/commands/export_emails.py
1
5565
# -*- coding: utf-8 -*- import sys import csv from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from django.core.management.base import BaseCommand, CommandError from django_extensions.management.utils import signalcommand FORMATS = [ 'a...
mit
d85c166783bd2b8637b92e41e9ba28c7
34.44586
112
0.563702
3.809035
false
false
false
false
django-extensions/django-extensions
django_extensions/admin/widgets.py
1
3191
# -*- coding: utf-8 -*- import urllib from django import forms from django.contrib.admin.sites import site from django.contrib.admin.widgets import ForeignKeyRawIdWidget from django.template.loader import render_to_string from django.templatetags.static import static from django.urls import reverse from django.utils.s...
mit
abd233c5d54e3cf6a4d3c47a33d43f39
34.455556
100
0.607333
3.978803
false
false
false
false
django-extensions/django-extensions
django_extensions/management/commands/shell_plus.py
1
22891
# -*- coding: utf-8 -*- import inspect import os import sys import traceback import warnings from django.db import connections from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.utils.datastructures import OrderedSet from django_extensions.management.shells ...
mit
6eeedf4170fe19560f04ef4ec292579a
38.331615
184
0.570748
4.502557
false
false
false
false
django-extensions/django-extensions
django_extensions/management/commands/create_jobs.py
1
2457
# -*- coding: utf-8 -*- import os import sys import shutil from typing import List from django.core.management.base import AppCommand from django.core.management.color import color_style from django_extensions.management.utils import _make_writeable, signalcommand class Command(AppCommand): help = "Creates a Dj...
mit
ae5e5b35deb6364c64142c6097f815d5
36.8
156
0.614571
3.9312
false
false
false
false
django-extensions/django-extensions
django_extensions/management/email_notifications.py
1
5360
# -*- coding: utf-8 -*- import sys import traceback from django.conf import settings from django.core.mail import send_mail from django.core.management import BaseCommand class EmailNotificationCommand(BaseCommand): """ A BaseCommand subclass which adds sending email fuctionality. Subclasses will have a...
mit
c9c91b32a2c69729469ea7fc528ec555
37.285714
98
0.573694
4.828829
false
false
false
false
django-extensions/django-extensions
tests/management/commands/test_set_default_site.py
1
3980
# -*- coding: utf-8 -*- from io import StringIO from django.conf import settings from django.contrib.sites.models import Site from django.core.management import call_command from django.core.management.base import CommandError from django.test import TestCase from django.test.utils import override_settings from unitt...
mit
3b97f8c31d1fdbc6e74014c42124c24a
42.736264
111
0.682663
3.644689
false
true
false
false
beancount/fava
tests/test_core_watcher.py
2
1123
# pylint: disable=missing-docstring from __future__ import annotations import time from pathlib import Path from fava.core.watcher import Watcher def test_watcher_file(tmp_path: Path) -> None: file1 = tmp_path / "file1" file2 = tmp_path / "file2" file1.write_text("test") file2.write_text("test") ...
mit
e7154944bf3773c2ac59395024a8a258
19.796296
54
0.634016
3.245665
false
true
false
false
beancount/fava
src/fava/core/query_shell.py
2
7023
"""For using the Beancount shell from Fava.""" from __future__ import annotations import contextlib import io import textwrap from typing import TYPE_CHECKING from beancount.core.data import Entries from beancount.core.data import Query from beancount.parser.options import OPTIONS_DEFAULTS from beancount.query import...
mit
01d54c7f6da8b6bff228168e2f3c6818
32.127358
78
0.593194
4.190334
false
false
false
false
jswhit/pygrib
test/test_ndfd_conus.py
1
1827
import pygrib, sys import pytest import numpy as np import matplotlib import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cfeature grbs = pygrib.open('../sampledata/ds.maxt.bin') grb = grbs.message(1) lats, lons = grb.latlons() data = grb.values globe = ccrs.Globe(ellipse='sphere', se...
mit
133aa22f57afc8621d350bf81c4b7631
41.488372
108
0.645868
2.942029
false
true
false
false
beancount/fava
src/fava/core/number.py
2
3087
"""Formatting numbers.""" from __future__ import annotations import copy from typing import Callable from typing import TYPE_CHECKING from babel.core import Locale # type: ignore from beancount.core.display_context import Precision from beancount.core.number import Decimal from fava.core.module_base import FavaModu...
mit
f342b89e581fa276c650449b254c9142
30.5
78
0.635569
4.051181
false
false
false
false
beancount/fava
src/fava/core/budgets.py
2
5871
"""Parsing and computing budgets.""" from __future__ import annotations import datetime from collections import Counter from collections import defaultdict from typing import Dict from typing import List from typing import NamedTuple from typing import TYPE_CHECKING from beancount.core.data import Custom from beancou...
mit
4eb9256e56a9c062c904e0961636c3a0
26.693396
79
0.607733
3.966892
false
false
false
false
qxf2/qxf2-page-object-model
endpoints/API_Player.py
1
8763
""" API_Player class does the following: a) serves as an interface between the test and API_Interface b) contains several useful wrappers around commonly used combination of actions c) maintains the test context/state """ from base64 import b64encode from .API_Interface import API_Interface from utils.results import Re...
mit
975c3b483351973d1cf521020be61a97
36.131356
106
0.606299
4.180821
false
false
false
false
qxf2/qxf2-page-object-model
utils/setup_testrail.py
1
6905
""" One off utility script to setup TestRail for an automated run This script can: a) Add a milestone if it does not exist b) Add a test run (even without a milestone if needed) c) Add select test cases to the test run using the setup_testrail.conf file d) Write out the latest run id to a 'latest_test_run.txt' file Th...
mit
3ca9ebc40ad27c6e73906ebf9ce51fff
42.702532
315
0.584794
3.80022
false
true
false
false
qxf2/qxf2-page-object-model
utils/Image_Compare.py
1
4039
""" Qxf2 Services: Utility script to compare images * Compare two images(actual and expected) smartly and generate a resultant image * Get the sum of colors in an image """ from PIL import Image, ImageChops import math, os def rmsdiff(im1,im2): "Calculate the root-mean-square difference between two images" h ...
mit
ba932bdf9817d919f09847cf1555a52d
37.836538
160
0.653132
3.813975
false
false
false
false
cebrusfs/217gdb
pwndbg/abi.py
3
6452
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import functools import re import gdb import pwndbg.arch import pwndbg.color.message as M class ABI(object): """ Encapsulates informat...
mit
e72b60bb9ee973f911cf59d786ef141e
36.045977
161
0.596649
3.07979
false
false
false
false
cebrusfs/217gdb
pwndbg/color/__init__.py
3
2813
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import re import pwndbg.memoize from . import theme as theme NORMAL = "\x1b[0m" BLACK = "\x1b[...
mit
34e277f69afc5ffa9235ad8777ac0284
29.576087
135
0.648774
2.850051
false
false
false
false
cebrusfs/217gdb
pwndbg/net.py
5
7301
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Re-implements some psutil functionality to be able to get information from remote debugging sessions. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import binasci...
mit
a2290c456c5e53d33e8d834e863b91ed
32.95814
112
0.444597
3.780943
false
false
false
false
cebrusfs/217gdb
pwndbg/commands/dumpargs.py
1
1781
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import pwndbg.arguments import pwndbg.chain import pwndbg.commands import pwndbg.commands.telescope import ...
mit
e87f32f7c3569300b930f40ce1861989
29.186441
200
0.685008
3.765328
false
false
false
false
cebrusfs/217gdb
pwndbg/android.py
4
2776
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import gdb import pwndbg.color.message as message import pwndbg.events import pwndbg.file import pwndbg.memoize import pwnd...
mit
d278de10429e3260ee39dca282a3bd06
20.858268
78
0.648415
2.236906
false
false
false
false
python-attrs/cattrs
tests/test_factory_hooks.py
1
1560
"""Tests for the factory hooks documentation.""" from attr import define, fields, has from cattrs.gen import make_dict_structure_fn, make_dict_unstructure_fn, override def to_camel_case(snake_str): components = snake_str.split("_") return components[0] + "".join(x.title() for x in components[1:]) def test_...
mit
c417999ea709853456448a7d95a6e44a
27.888889
85
0.633333
3.577982
false
false
false
false
python-attrs/cattrs
src/cattrs/converters.py
1
37598
from collections import Counter from collections.abc import MutableSet as AbcMutableSet from dataclasses import Field from enum import Enum from functools import lru_cache from typing import ( Any, Callable, Dict, Iterable, List, NoReturn, Optional, Tuple, Type, TypeVar, Unio...
mit
4986ea1628dec184ee54a49989cd4d6b
36.90121
98
0.572557
4.103241
false
false
false
false
gae-init/gae-init-babel
main/control/user.py
1
12104
# coding: utf-8 import copy from flask_babel import gettext as __ from flask_babel import lazy_gettext as _ from google.appengine.ext import ndb from webargs import fields as wf from webargs.flaskparser import parser import flask import flask_login import flask_wtf import wtforms import auth import cache import conf...
mit
bd0124a202711c07307e9355a7000d4e
31.277333
98
0.61649
3.62721
false
false
false
false
auth0/auth0-python
auth0/v3/management/logs.py
1
3770
from ..rest import RestClient class Logs(object): """Auth0 logs endpoints Args: domain (str): Your Auth0 domain, e.g: 'username.auth0.com' token (str): Management API v2 Token telemetry (bool, optional): Enable or disable Telemetry (defaults to True) timeout (fl...
mit
d3f7ab93908b9e33c70f58da40555a4e
32.070175
94
0.566313
4.363426
false
false
false
false
auth0/auth0-python
auth0/v3/test/management/test_log_streams.py
1
2783
import unittest import mock from ...management.log_streams import LogStreams class TestLogStreams(unittest.TestCase): def test_init_with_optionals(self): t = LogStreams( domain="domain", token="jwttoken", telemetry=False, timeout=(10, 2) ) self.assertEqual(t.client.options.ti...
mit
01ad3f44b179ace54ea38760563cfb08
31.741176
79
0.61193
3.567949
false
true
false
false
auth0/auth0-python
auth0/v3/authentication/database.py
1
4138
import warnings from .base import AuthenticationBase class Database(AuthenticationBase): """Database & Active Directory / LDAP Authentication. Args: domain (str): Your auth0 domain (e.g: username.auth0.com) """ def login( self, client_id, username, password, ...
mit
80652d422541d2af128140f5265b843d
28.985507
102
0.561141
4.572376
false
false
false
false
auth0/auth0-python
auth0/v3/management/actions.py
1
7936
from ..rest import RestClient class Actions(object): """Auth0 Actions endpoints Args: domain (str): Your Auth0 domain, e.g: 'username.auth0.com' token (str): Management API v2 Token telemetry (bool, optional): Enable or disable Telemetry (defaults to True) timeo...
mit
ac3466af28611ed33e4b7175d267db89
30.61753
92
0.580015
4.144125
false
false
false
false
jrief/djangocms-cascade
cmsplugin_cascade/generic/text_image.py
1
4716
from django.forms import widgets, ChoiceField, MultipleChoiceField from django.utils.html import format_html_join from django.utils.translation import gettext_lazy as _ from cms.plugin_pool import plugin_pool from cmsplugin_cascade.fields import SizeField from cmsplugin_cascade.image import ImageFormMixin, ImageProper...
mit
8d29b338e7868209c787d6be7b2245e6
37.341463
109
0.636344
4.051546
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/norway.py
1
3800
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
1e4d2f7f2edf44d13346a0fb4d951349
36.166667
120
0.63598
3.177703
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/madagascar.py
1
2186
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
46b81ddce3019e9450f98356bbfd7a1f
31.147059
78
0.598811
2.883905
false
false
false
false
jrief/djangocms-cascade
cmsplugin_cascade/migrations/0002_auto_20150530_1018.py
1
1288
from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cmsplugin_cascade', '0001_initial'), ] operations = [ migrations.CreateModel( name='Segmentation', fields=[ ('id', models.AutoField(verbose_name='ID'...
mit
aa494a7c793a4f07603563364980e78b
30.414634
114
0.534938
4.735294
false
false
false
false
dr-prodigy/python-holidays
test/test_holiday_base.py
1
28132
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
2694551c12a8e48a989312e459d8b502
37.326975
79
0.585205
3.541735
false
true
false
false
dr-prodigy/python-holidays
test/countries/test_austria.py
1
3161
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
a9e5682bffaacabf489cc52d7129f2c0
34.47191
78
0.579031
3.603881
false
true
false
false
jrief/djangocms-cascade
cmsplugin_cascade/bootstrap4/utils.py
1
7432
import logging from django.utils.translation import gettext_lazy as _ from cmsplugin_cascade import app_settings from cmsplugin_cascade.utils import (compute_aspect_ratio, get_image_size, parse_responsive_length, compute_aspect_ratio_with_glossary) logger = logging.getLogger('cascade') IMAGE_RESIZE_OPTIONS = [ ...
mit
9c0c72acb06886fd2f5f0e0553098efd
46.948387
111
0.620694
3.747857
false
false
false
false
dr-prodigy/python-holidays
test/countries/test_japan.py
1
21637
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
e16d014462baa45cc0bfcf266472d654
29.304102
78
0.381704
3.224229
false
false
false
false
jrief/djangocms-cascade
cmsplugin_cascade/migrations/0028_cascade_clipboard.py
1
1135
from django.conf import settings from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('cmsplugin_cascade', '0027_version_1'), ] operations = [ migr...
mit
5af5d076de7a5102570528495bd9c952
35.612903
165
0.637004
4.283019
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/luxembourg.py
1
1748
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
21a1193f9ff5386d7d6ffd0d5db04ef5
31.867925
78
0.65729
2.967632
false
false
false
false
jrief/djangocms-cascade
cmsplugin_cascade/models.py
1
12117
import json import os import shutil from collections import OrderedDict from urllib.parse import urljoin from pathlib import Path from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.db import models from django.utils.functional import...
mit
cedd936ec078f2fba9f7aacd323157fc
27.510588
129
0.614509
4.022908
false
false
false
false
jrief/djangocms-cascade
cmsplugin_cascade/sphinx/cms_apps.py
1
1950
import io import mimetypes import os from django.conf import settings from django.core.exceptions import ViewDoesNotExist from django.http.response import HttpResponse from django.views.generic import TemplateView from django.urls import re_path from django.utils.cache import patch_cache_control from django.utils.safes...
mit
f8a99e97a909e666b7458c100a44236a
38
96
0.664615
3.816047
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/nigeria.py
1
3886
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
3d5dfa87aa840abc3c7ec514563863fd
33.087719
79
0.533711
3.608171
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/canada.py
1
10225
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
67ee9de232a8499b4ec38719c3bba5c5
36.454212
283
0.525868
3.212378
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/ukraine.py
1
5815
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
ebe8fb7a6ed4e78d5d29ce324bcb3574
28.010989
79
0.538447
2.723053
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/austria.py
1
2152
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
9db28efa789cee2f3119a940f82df9ec
34.213115
78
0.617784
2.979196
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/botswana.py
1
3875
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
e4410ea0cdb019d42cf5d6bb0ba76ff7
34.227273
78
0.548903
3.423145
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/estonia.py
1
1876
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
568bb7bf797ff91b371b5166fd3796f8
24.805556
78
0.623251
2.935229
false
false
false
false
dr-prodigy/python-holidays
holidays/financial/ny_stock_exchange.py
1
11711
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
454f1f297f0368ebe8a57eb5662d62b9
37.906977
79
0.523354
3.313809
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/india.py
1
8232
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
220e638722f8cff2accc00131d419e3d
31.537549
79
0.505588
3.037638
false
false
false
false
dr-prodigy/python-holidays
holidays/countries/slovakia.py
1
2396
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201...
mit
d7099eb9a9c89e73b71bac8294b34808
28.708861
78
0.614827
2.622346
false
false
false
false
rlabbe/filterpy
filterpy/common/helpers.py
1
14251
# -*- coding: utf-8 -*- # pylint: disable=invalid-name, bare-except """Copyright 2015 Roger R Labbe Jr. FilterPy library. http://github.com/rlabbe/filterpy Documentation at: https://filterpy.readthedocs.org Supporting book at: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python This is licensed under a...
mit
3a35b3a7e4dce93364713c72e13cbc63
26.093156
88
0.556593
3.719916
false
false
false
false
rlabbe/filterpy
filterpy/kalman/square_root.py
1
10556
# -*- coding: utf-8 -*- # pylint: disable=invalid-name, too-many-instance-attributes """Copyright 2015 Roger R Labbe Jr. FilterPy library. http://github.com/rlabbe/filterpy Documentation at: https://filterpy.readthedocs.org Supporting book at: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python This is...
mit
4529e2d1a16ee14786b291e7a6988a9e
28.322222
79
0.571618
3.487281
false
false
false
false
rlabbe/filterpy
filterpy/common/tests/test_discretization.py
1
2662
# -*- coding: utf-8 -*- """Copyright 2015 Roger R Labbe Jr. FilterPy library. http://github.com/rlabbe/filterpy Documentation at: https://filterpy.readthedocs.org Supporting book at: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python This is licensed under an MIT license. See the readme.MD file for mor...
mit
0994bc0f66537266d8663ca7ffcd233f
21.567797
77
0.463186
2.574468
false
false
false
false
rlabbe/filterpy
filterpy/discrete_bayes/discrete_bayes.py
3
3420
# -*- coding: utf-8 -*- """Copyright 2015 Roger R Labbe Jr. FilterPy library. http://github.com/rlabbe/filterpy Documentation at: https://filterpy.readthedocs.org Supporting book at: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python This is licensed under an MIT license. See the readme.MD file for mor...
mit
7454b396071748989fded0b7f00168ee
25.71875
82
0.652924
4.076281
false
false
false
false
django-salesforce/django-salesforce
tests/test_mixin/models.py
2
2469
"""Demonstrate that a Model can inherite from more abstract models.""" from django.conf import settings import salesforce from salesforce import models from salesforce.models import SalesforceModel # All demo models simplified for readability, except tested features class User(SalesforceModel): username = model...
mit
d894bbd35b1ba6c3ffe560359d4fbcd4
27.709302
91
0.714459
3.833851
false
false
false
false
django-salesforce/django-salesforce
salesforce/backend/schema.py
2
1395
""" Minimal code to support ignored makemigrations (like django.db.backends.*.schema) without interaction to SF (without migrate) """ from django.db import NotSupportedError from django.db.backends.base.schema import BaseDatabaseSchemaEditor from salesforce.backend import log class DatabaseSchemaEditor(BaseDatabas...
mit
61f158e38813312b7169e7bc0ab4cc57
33.875
82
0.660215
4.067055
false
false
false
false
django-salesforce/django-salesforce
salesforce/tests/test_utils.py
2
2731
""" Tests for `salesforce.utils` """ # pylint:disable=protected-access from unittest import skipUnless from django.test import TestCase from salesforce.dbapi.driver import beatbox from salesforce.testrunner.example.models import Account, Lead from salesforce.utils import convert_lead class UtilitiesTest(TestCase):...
mit
6a400f37b6383e4e423827ace759b20a
43.770492
98
0.600146
4.280564
false
true
false
false
django-salesforce/django-salesforce
tests/test_compatibility/models.py
2
1930
"""Backward compatible behaviour with primary key 'Id' and upper-case field names""" import datetime from salesforce import models from salesforce.models import SalesforceModel class User(SalesforceModel): Username = models.CharField(max_length=80) Email = models.CharField(max_length=100) class Lead(Salesf...
mit
bb95dab3715c6e8d9c1b3896aacf0f43
35.415094
117
0.727979
3.541284
false
false
false
false
django-salesforce/django-salesforce
salesforce/backend/base.py
2
4465
# django-salesforce # # by Phil Christensen # (c) 2012-2013 Freelancers Union (http://www.freelancersunion.org) # See LICENSE.md for details # """ Salesforce database backend for Django. (like django,db.backends.*.base) """ from typing import Any, Dict, Optional, TYPE_CHECKING from django.conf import settings from ...
mit
9ba861563e36d0c8187d421391dd021c
33.346154
119
0.671221
4.055404
false
false
false
false
urllib3/urllib3
src/urllib3/_base_connection.py
1
5651
from __future__ import annotations import typing from .util.connection import _TYPE_SOCKET_OPTIONS from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT from .util.url import Url _TYPE_BODY = typing.Union[bytes, typing.IO[typing.Any], typing.Iterable[bytes], str] class ProxyConfig(typing.NamedTuple): ssl_c...
mit
f0d857789594c87d850e1f8aa554a27c
31.66474
94
0.556716
4.31374
false
false
false
false
urllib3/urllib3
src/urllib3/util/util.py
1
1146
from __future__ import annotations import typing from types import TracebackType def to_bytes( x: str | bytes, encoding: str | None = None, errors: str | None = None ) -> bytes: if isinstance(x, bytes): return x elif not isinstance(x, str): raise TypeError(f"not expecting type {type(x).__...
mit
afa72bff8f09c0dd0ed7cca5006b9cab
26.285714
74
0.612565
3.745098
false
false
false
false
urllib3/urllib3
src/urllib3/filepost.py
1
2395
from __future__ import annotations import binascii import codecs import os import typing from io import BytesIO from .fields import _TYPE_FIELD_VALUE_TUPLE, RequestField writer = codecs.lookup("utf-8")[3] _TYPE_FIELDS_SEQUENCE = typing.Sequence[ typing.Union[typing.Tuple[str, _TYPE_FIELD_VALUE_TUPLE], RequestFi...
mit
d7f68e40992951d591bd90cc88989c85
25.910112
85
0.650522
3.801587
false
false
false
false
phfaist/pylatexenc
tools/make_transcryptable_lib.py
1
10464
import re import os import os.path source_dir = os.path.join(os.path.dirname(__file__), '..') target_dir = os.path.join(os.path.dirname(__file__), 'transcryptable_output') if not os.path.isdir(target_dir): os.makedirs(target_dir) # # Process our source files to make them usable with Transcrypt (-> to create...
mit
180261f1ba4fbeb44b570c0b744d44af
25.43038
92
0.519349
3.429698
false
false
false
false
phfaist/pylatexenc
pylatexenc/_util.py
1
3932
# -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2019 Philippe Faist # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation t...
mit
11112026dc6046c8f8d188733b2d4a87
32.322034
86
0.592319
4.130252
false
false
false
false
phfaist/pylatexenc
tools/gen_xml_dic.py
1
2236
# # mini-script to generate the pylatexenc.latexencode._uni2latexmap_xml dict mapping # import re import sys if sys.version_info.major > 2: # python 3 unichr = chr from xml.etree import ElementTree as ET e = ET.parse('unicode.xml') d = {} dnames = {} for chxml in e.find('charlist').iter('character'): U...
mit
5f41f33cff36699ee5a138d966580c58
26.268293
83
0.630143
3.347305
false
false
false
false
tobgu/pyrsistent
tests/hypothesis_vector_test.py
1
8835
""" Hypothesis-based tests for pvector. """ import gc from collections.abc import Iterable from functools import wraps from pyrsistent import PClass, field from pytest import fixture from pyrsistent import pvector, discard from hypothesis import strategies as st, assume from hypothesis.stateful import RuleBasedSta...
mit
1c9c533c9131d8d954937b101172fefc
28.0625
74
0.59253
3.746819
false
false
false
false
tobgu/pyrsistent
benchmarks/pmap.py
1
6371
from pyperform import BenchmarkedFunction from pyrsistent import pmap #! class Benchmarked(BenchmarkedFunction): def __init__(self, scale=1, *args, **kwargs): super(Benchmarked, self).__init__(*args, timeit_number=scale*1000, **kwargs) ################# Create ################### @Benchmarked() def crea...
mit
3b19fcf509a7744f7c6684d52f08cdf5
22.772388
84
0.616858
2.862084
false
false
false
false
phfaist/pylatexenc
pylatexenc/latexwalker/_defaultspecs.py
1
17330
# -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2019 Philippe Faist # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation t...
mit
0141f2b3bc94ec469df61bb3f7adb066
36.755991
102
0.505309
3.935059
false
false
false
false
tobgu/pyrsistent
pyrsistent/_precord.py
3
7032
from pyrsistent._checked_types import CheckedType, _restore_pickle, InvariantException, store_invariants from pyrsistent._field_common import ( set_fields, check_type, is_field_ignore_extra_complaint, PFIELD_NO_INITIAL, serialize, check_global_invariants ) from pyrsistent._pmap import PMap, pmap class _PRecordMet...
mit
3bac5bb94542f23954e8f52c1180ca00
41.107784
133
0.607651
4.07416
false
false
false
false
gwu-libraries/social-feed-manager
sfm/ui/migrations/0009_auto__add_rule.py
2
3722
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Rule' db.create_table('ui_rule', ( ('id', self.gf('django.db.models.fields.AutoF...
mit
6b6ded71c810d3f852de6a5857b5f652
53.75
103
0.537346
3.674235
false
false
false
false
gwu-libraries/social-feed-manager
sfm/ui/migrations/0017_auto__del_trendweekly__del_trenddaily.py
2
7557
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting model 'TrendWeekly' db.delete_table(u'ui_trendweekly') # Deleting model 'TrendDaily' ...
mit
36d97e0c5ef91c05a0ef22152414b945
64.155172
187
0.55485
3.620987
false
false
false
false
choderalab/perses
perses/analysis/extract_trajectory.py
1
1648
""" Functions to extract trajectory from a perses relative calculation """ import numpy as np import mdtraj as md from perses.analysis.utils import open_netcdf def get_hybrid_topology(file): """ Extracts hybrid_topology object from the .npy file generated by relative calculations Parameters ----------...
mit
e811eafb5d4046e0271808a74c101dd2
22.542857
96
0.651699
3.933174
false
false
false
false
choderalab/perses
perses/rjmc/geometry.py
1
142485
""" This contains the base class for the geometry engine, which proposes new positions for each additional atom that must be added. """ from simtk import unit import numpy as np import networkx as nx from perses.storage import NetCDFStorageView ########################################################################...
mit
60d95a9af6baf5d85aa3a19ac9e7311d
51.596899
327
0.633372
4.065773
false
false
false
false
choderalab/perses
perses/app/relative_hydration.py
1
5178
import simtk.openmm as openmm import simtk.unit as unit from perses.annihilation.relative import HybridTopologyFactory import numpy as np from perses.tests.utils import generate_solvated_hybrid_test_topology kB = unit.BOLTZMANN_CONSTANT_kB * unit.AVOGADRO_CONSTANT_NA temperature = 300.0 * unit.kelvin kT = kB * tempera...
mit
1805e1bef1d432f7f8733dae33069782
42.889831
176
0.72557
3.51289
false
false
false
false
vmalloc/dessert
dessert/rewrite.py
1
38778
"""Rewrite assertion AST to produce nice error messages""" # pylint: disable=protected-access,unused-import,logging-not-lazy,duplicate-string-formatting-argument,logging-format-interpolation,too-many-lines import ast import errno import functools import importlib.abc import importlib.machinery import importlib.util imp...
mit
e216ebb0c5900e58bd743a428271a7ee
37.394059
146
0.583501
4.012624
false
false
false
false
vmalloc/dessert
dessert/util.py
1
14757
"""Utilities for assertion debugging""" import attr import pprint import logging from collections.abc import Sequence from typing import Callable from typing import List from typing import Optional _logger = logging.getLogger(__name__) from .conf import conf from .saferepr import saferepr if getattr(attr, "__version...
mit
8dee54d0f5a2359cd3194bc8f50adacb
32.462585
127
0.576133
3.998103
false
false
false
false
learningequality/ricecooker
tests/test_pdfutils.py
1
12165
import os import re from tempfile import TemporaryDirectory import pytest import requests from PyPDF2 import PdfFileReader from ricecooker.utils.pdf import PDFParser # SIT # Fixtures ################################################################################ @pytest.fixture def downloads_dir(): with Tem...
mit
79eaa0459fa8d477b49dbeb30208e9a4
38.496753
132
0.573942
3.362355
false
true
false
false
learningequality/ricecooker
ricecooker/utils/corrections.py
1
25289
#!/usr/bin/env python import argparse import copy import csv import json import os from datetime import datetime import dictdiffer import requests from ricecooker.config import LOGGER from ricecooker.utils.libstudio import StudioApi # CONFIG CONSTANTS for data directories ###########################################...
mit
a5c986c58a574e8e55e4b341b9e7a1d0
34.568214
100
0.573055
3.821823
false
false
false
false
learningequality/ricecooker
ricecooker/utils/html_writer.py
1
4419
import os import zipfile from ricecooker.utils.downloader import read class HTMLWriter: """ Class for writing zipfiles """ zf = None # Zip file to write to write_to_path = None # Where to write zip file def __init__(self, write_to_path, mode="w"): """Args: write_to_path: (str) whe...
mit
3f4e8896ed2c46fac89ce57a791082b6
34.352
102
0.586332
4.353695
false
false
false
false
joeyespo/grip
tests/test_cli.py
1
1732
""" Tests the Grip command-line interface. """ from __future__ import print_function, unicode_literals import sys from subprocess import PIPE, STDOUT, CalledProcessError, Popen import pytest from grip.command import usage, version if sys.version_info[0] == 2 and sys.version_info[1] < 7: class CalledProcessErr...
mit
b4c63facdb15f4f638ed2bac27562a39
27.393443
71
0.651848
3.685106
false
true
false
false
jhpyle/docassemble
docassemble_webapp/docassemble/webapp/app_object.py
1
2070
# import sys try: from werkzeug.middleware.proxy_fix import ProxyFix proxyfix_version = 15 except ImportError: from werkzeug.contrib.fixers import ProxyFix proxyfix_version = 14 from flask import Flask from flask_wtf.csrf import CSRFProtect from flask_babel import Babel from flask_cors import CORS impor...
mit
098015aa696b5009bc5d4c120de58484
43.042553
103
0.719324
3.344103
false
true
false
false
jhpyle/docassemble
docassemble_demo/docassemble/demo/random-test.py
1
5854
#! /usr/bin/env python import json import sys import random import string import requests root = 'http://localhost' key = 'H3PLMKJKIVATLDPWHJH3AGWEJPFU5GRT' i = 'docassemble.demo:data/questions/questions.yml' iterations = 100 while iterations: r = requests.get(root + '/api/session/new', params={'key': key, 'i': i...
mit
98aa1008f68f5447d96f1bd42d86194f
49.465517
231
0.554151
3.784098
false
false
false
false
jhpyle/docassemble
docassemble_webapp/docassemble/webapp/files.py
1
36027
import datetime import json import mimetypes import os import re import shutil import subprocess # import sys import tempfile import zipfile from packaging import version from flask import url_for from flask_login import current_user try: import zoneinfo except ImportError: from backports import zoneinfo import...
mit
fd52128d039db2a874f2627df2c8ded2
45.546512
404
0.579371
3.887666
false
false
false
false
jhpyle/docassemble
docassemble_base/docassemble/base/mako/filters.py
10
4658
# mako/filters.py # Copyright 2006-2022 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import codecs from html.entities import codepoint2name from html.entities import name2codepoint impor...
mit
dc3a0fb0959fc9d60c58b5f63c65963e
27.576687
77
0.592958
3.884904
false
false
false
false
jhpyle/docassemble
docassemble_webapp/docassemble/webapp/listlog.py
1
1921
import os import subprocess import time from packaging import version from flask import Flask, abort, make_response, render_template, request app = Flask(__name__) LOG_DIRECTORY = '/var/www/html/log' version_file = '/usr/share/docassemble/webapp/VERSION' if os.path.isfile(version_file) and os.access(version_file, os...
mit
76d476eeea640fe2e385c0c7e0af2ad6
39.87234
174
0.668402
3.234007
false
false
false
false
fedora-python/pyp2rpm
pyp2rpm/module_runners.py
1
2763
import os import sys import logging import json import runpy from subprocess import Popen, PIPE from abc import ABCMeta from pyp2rpm import utils from pyp2rpm import main_dir from pyp2rpm.exceptions import ExtractionError from pyp2rpm.command import extract_dist logger = logging.getLogger(__name__) class ModuleRunn...
mit
1abb1031265a564374a42dbaa6fca582
31.892857
80
0.5751
4.442122
false
false
false
false
trungdong/prov
src/prov/tests/examples.py
1
19911
from prov.model import ProvDocument, Namespace, Literal, PROV, Identifier import datetime def primer_example(): # https://github.com/lucmoreau/ProvToolbox/blob/master/prov-n/src/test/resources/prov/primer.pn # =========================================================================== # document g = P...
mit
859711ec898a4db3153e923321106390
35.260474
121
0.602351
2.878814
false
false
false
false
trungdong/prov
src/prov/dot.py
1
13274
"""Graphical visualisation support for prov.model. This module produces graphical visualisation for provenanve graphs. Requires pydot module and Graphviz. References: * pydot homepage: https://github.com/erocarrera/pydot * Graphviz: http://www.graphviz.org/ * DOT Language: http://www.graphviz.org/doc/info/la...
mit
62b5fe3b5cf15c742a15bfbf0bbebb02
32.0199
110
0.514012
3.818757
false
false
false
false
fedora-python/pyp2rpm
tests/test_package_getters.py
1
6925
import json import os import tempfile import shutil import pytest from flexmock import flexmock from pyp2rpm.convertor import PyPIClient from pyp2rpm.package_getters import LocalFileGetter, PypiDownloader, get_url from pyp2rpm.exceptions import MissingUrlException, NoSuchPackageException tests_dir = os.path.split(o...
mit
2035cc8d7ad0d5ee430e43935e787c81
38.346591
143
0.578339
3.23296
false
true
false
false
nvbn/thefuck
tests/rules/test_sed_unterminated_s.py
4
1186
import pytest from thefuck.rules.sed_unterminated_s import match, get_new_command from thefuck.types import Command @pytest.fixture def sed_unterminated_s(): return "sed: -e expression #1, char 9: unterminated `s' command" def test_match(sed_unterminated_s): assert match(Command('sed -e s/foo/bar', sed_unte...
mit
df47a297ca4aa96a1dbf1f3eea0d86d5
41.357143
89
0.642496
2.817102
false
true
false
false
nvbn/thefuck
thefuck/entrypoints/shell_logger.py
4
2009
import array import fcntl from functools import partial import mmap import os import pty import signal import sys import termios import tty from .. import logs, const def _read(f, fd): data = os.read(fd, 1024) try: f.write(data) except ValueError: position = const.LOG_SIZE_IN_BYTES - const...
mit
cc419f780109d61f0b53a15adc4cc683
24.43038
85
0.633649
3.153846
false
false
false
false
nvbn/thefuck
tests/rules/test_composer_not_command.py
2
2444
import pytest from thefuck.rules.composer_not_command import match, get_new_command from thefuck.types import Command @pytest.fixture def composer_not_command(): # that weird spacing is part of the actual command output return ( '\n' '\n' ' \n' ...
mit
e00cc20d10a5f9d1974695ba58ffce76
36.030303
118
0.51964
4.142373
false
true
false
false
nvbn/thefuck
tests/functional/test_fish.py
6
2095
import pytest from tests.functional.plots import with_confirmation, without_confirmation, \ refuse_with_confirmation, select_command_with_arrows containers = (('thefuck/python3-fish', u'''FROM python:3 # Use jessie-backports since it has the fish package. See here for details: ...
mit
a0115acda8e152d2b2680901bf3d46b5
39.288462
141
0.651551
3.526936
false
true
false
false
nvbn/thefuck
thefuck/rules/path_from_history.py
5
1493
from collections import Counter import re from thefuck.system import Path from thefuck.utils import (get_valid_history_without_current, memoize, replace_argument) from thefuck.shells import shell patterns = [r'no such file or directory: (.*)$', r"cannot access '(.*)': No such fi...
mit
1f763da0f4b6e904b47f8973d76084d9
27.169811
63
0.616209
4.057065
false
false
false
false
nvbn/thefuck
thefuck/rules/no_command.py
1
1254
from thefuck.utils import get_all_executables, get_close_matches, \ get_valid_history_without_current, get_closest, which from thefuck.specific.sudo import sudo_support @sudo_support def match(command): return (not which(command.script_parts[0]) and ('not found' in command.output ...
mit
1452025fa1e4f2a2a5171471d3a0e83a
29.585366
76
0.613238
3.8
false
false
false
false
nvbn/thefuck
thefuck/const.py
2
2944
# -*- encoding: utf-8 -*- class _GenConst(object): def __init__(self, name): self._name = name def __repr__(self): return u'<const: {}>'.format(self._name) KEY_UP = _GenConst('↑') KEY_DOWN = _GenConst('↓') KEY_CTRL_C = _GenConst('Ctrl+C') KEY_CTRL_N = _GenConst('Ctrl+N') KEY_CTRL_P = _GenCo...
mit
ad09d1e4ef07637864470d0ed9c5295f
31.307692
88
0.542517
3.406721
false
false
false
false
nvbn/thefuck
thefuck/rules/apt_get.py
4
1386
from types import ModuleType from thefuck.specific.apt import apt_available from thefuck.utils import memoize, which from thefuck.shells import shell try: from CommandNotFound import CommandNotFound enabled_by_default = apt_available if isinstance(CommandNotFound, ModuleType): # For ubuntu 18.04+...
mit
a3d5891baa3819f6b055ee67889070c2
26.72
74
0.689033
4.040816
false
false
false
false
nvbn/thefuck
release.py
3
1024
#!/usr/bin/env python from subprocess import call import os import re version = None def get_new_setup_py_lines(): global version with open('setup.py', 'r') as sf: current_setup = sf.readlines() for line in current_setup: if line.startswith('VERSION = '): major, minor = re.fi...
mit
aaa6c2f2a9b06cb44103f66ce0f91ff7
26.675676
75
0.615234
3.190031
false
false
false
false
nvbn/thefuck
tests/rules/test_git_add.py
5
1353
import pytest from thefuck.rules.git_add import match, get_new_command from thefuck.types import Command @pytest.fixture(autouse=True) def path_exists(mocker): return mocker.patch('thefuck.rules.git_add.Path.exists', return_value=True) @pytest.fixture def output(target): return ("err...
mit
7c985f52f77a1fe57cb660fef0137ac3
32.825
66
0.675536
3.789916
false
true
false
false
honeynet/droidbot
droidbot/adapter/user_input_monitor.py
2
2065
import subprocess import logging from .adapter import Adapter class UserInputMonitor(Adapter): """ A connection with the target device through `getevent`. `getevent` is able to get raw user input from device. """ def __init__(self, device=None): """ initialize connection :...
mit
8a70e5c2e765cee71fe2f05d7459e7b7
28.927536
102
0.540436
4.548458
false
false
false
false
honeynet/droidbot
droidbot/input_manager.py
2
6468
import json import logging import subprocess import time from .input_event import EventLog from .input_policy import UtgBasedInputPolicy, UtgNaiveSearchPolicy, UtgGreedySearchPolicy, \ UtgReplayPolicy, \ ManualPolicy, \ POLICY_NAIVE_DFS, POLICY...
mit
5011e386583bb87a98335f2722bd2040
37.5
113
0.551948
4.205462
false
false
false
false
honeynet/droidbot
droidbot/adapter/telnet.py
2
2897
import logging import threading from .adapter import Adapter class TelnetException(Exception): """ Exception in telnet connection """ pass class TelnetConsole(Adapter): """ interface of telnet console, see: http://developer.android.com/tools/devices/emulator.html """ def __init__...
mit
a146498f8a5e6b6ca456278c07236d87
27.97
89
0.557818
4.402736
false
false
false
false