content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
import structlog
from pathlib import Path
from typing import Any, Dict, Generator, Iterable, Optional, Tuple
from normality import normalize, WS
from followthemoney.schema import Schema
from followthemoney.types import registry
from opensanctions import settings
from nomenklatura.loader import Loader
from nomenklatura.... | 30.451613 | 77 | 0.774364 | [
"MIT"
] | alephdata/opensanctions | opensanctions/core/index.py | 944 | Python |
# coding: utf-8
from __future__ import unicode_literals
import base64
import datetime
import hashlib
import json
import netrc
import os
import random
import re
import socket
import ssl
import sys
import time
import math
from ..compat import (
compat_cookiejar_Cookie,
compat_cookies,
compat_etree_Element,
... | 46.903595 | 172 | 0.546574 | [
"Unlicense"
] | DevSecOpsGuy/youtube-dl-1 | youtube_dl/extractor/common.py | 143,548 | Python |
from django import forms
from django.apps import apps
from django.core.exceptions import PermissionDenied
from django.urls import reverse, NoReverseMatch
from django.template.context_processors import csrf
from django.db.models.base import ModelBase
from django.forms.forms import DeclarativeFieldsMetaclass
from django.... | 35.285075 | 134 | 0.609069 | [
"BSD-3-Clause"
] | edwardvon/xadmin-django3 | xadmin/views/dashboard.py | 23,641 | Python |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 51.014493 | 245 | 0.70767 | [
"Apache-2.0",
"BSD-3-Clause"
] | CentroidChef/oci-python-sdk | src/oci/dts/transfer_device_client_composite_operations.py | 3,520 | Python |
#!/usr/bin/env python
#
# Create daily QC HTML report
#
# USAGE : cbicqc_report.py <QA Directory>
#
# AUTHOR : Mike Tyszka
# PLACE : Caltech
# DATES : 09/25/2013 JMT From scratch
# 10/23/2013 JMT Add com external call
# 10/24/2013 JMT Move stats calcs to new cbicqc_stats.py
#
# This file is part of ... | 27.657277 | 109 | 0.529961 | [
"MIT"
] | jmtyszka/CBICQAlive | cbicqclive_report.py | 5,891 | Python |
from typing import Callable
import unittest
# test
from .pipe import pipe
class TestPipe(unittest.TestCase):
def test_pipe_should_return_a_function(self) -> None:
# given
def echo(x: str) -> str:
return f"echo {x}"
# when
output = pipe(echo)
# then
s... | 22.06383 | 69 | 0.555448 | [
"MIT"
] | romainPrignon/unshellPy | src/unshell/utils/test_pipe.py | 1,037 | Python |
# -*- coding: utf-8 -*-
# Author:Qiujie Yao
# Email: yaoqiujie@gscopetech.com
# @Time: 2019-06-26 14:15
| 20.8 | 33 | 0.653846 | [
"Apache-2.0"
] | iyaoqiujie/VehicleInspection | VehicleInspection/apps/appointment/permissions.py | 106 | Python |
default_ids = [
[0x0E8D, 0x0003, -1], # MTK Brom
[0x0E8D, 0x6000, 2], # MTK Preloader
[0x0E8D, 0x2000, -1], # MTK Preloader
[0x0E8D, 0x2001, -1], # MTK Preloader
[0x0E8D, 0x20FF, -1], # MTK Preloader
[0x1004, 0x6000, 2], # LG Preloader
[0x22d9, 0x0006, -1], # OPPO Preloader
[0x0FCE, 0xF2... | 31.181818 | 42 | 0.588921 | [
"MIT"
] | CrackerCat/mtkclient | mtkclient/config/usb_ids.py | 343 | Python |
########################################### Global Variables #################################
#sklearn pickled SGDClassifier where pre-trained clf.coef_ matrix is casted to a scipy.sparse.csr_matrix for efficiency and scalability
clf = None
#sklearn pickled TfidfVectorizer
vectorizer = None
#dictionary of labelid: (la... | 47.875 | 135 | 0.72846 | [
"Apache-2.0"
] | juanc5ibanez/WLM-WLMN | WLM-WLMN/TextAnalyzer/TextAnalyzer/Pigeo/pigeo-master/params.py | 766 | Python |
n = int(input())
arr = [[None for i in range(2*n+1)]for i in range(2*n+1)]
m = (2*n + 1) // 2
for i in range(n):
arr[i][m] = i
arr[n][m] = n
for i in range(n+1,2*n+1):
arr[i][m] = arr[i-1][m]-1
for y in range(1,m+1):
for x in range(len(arr[0])):
if x < m:
arr[y][x] = arr[y-1][x+1]
... | 21.833333 | 57 | 0.431298 | [
"MIT"
] | neshdev/competitive-prog | ao2j/lt1300/055/A.py | 786 | Python |
"""
We recover the original divergence-free velocity field via
Ud,new = Ustar - Gphi
"""
import numpy
import pylab
import operator
def do_plots_c(Ud, Unew):
""" plot Ud,new and Ud with zoom on the bug """
pylab.clf()
pylab.cla()
f = pylab.figure()
f.text(.5, .95, r"$U_{\rm d}... | 21.770492 | 103 | 0.579819 | [
"Apache-2.0"
] | aquario-crypto/Numerical_Methods_for_Physics | homework5_elliptic_PDES/part_c.py | 1,328 | Python |
"""Module containing sacred functions for handling ML models."""
import inspect
from sacred import Ingredient
from src import models
ingredient = Ingredient('model')
@ingredient.config
def cfg():
"""Model configuration."""
name = ''
parameters = {
}
@ingredient.named_config
def TopologicalSurroga... | 26.277533 | 79 | 0.619279 | [
"BSD-3-Clause"
] | BorgwardtLab/topo-ae-distances | exp/ingredients/model.py | 5,965 | Python |
from core.advbase import *
from module.bleed import Bleed
from slot.a import *
def module():
return Botan
class Botan(Adv):
a3 = [('prep',1.00), ('scharge_all', 0.05)]
conf = {}
conf['slots.a'] = RR() + United_by_One_Vision()
conf['acl'] = """
`dragon.act('c3 s end')
`s3, not self.... | 24.6 | 83 | 0.571138 | [
"Apache-2.0"
] | b1ueb1ues/dl | adv/botan.py | 984 | Python |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | 37.45098 | 85 | 0.63377 | [
"Apache-2.0"
] | CatarinaSilva/airflow | airflow/contrib/hooks/gcp_translate_hook.py | 3,820 | Python |
from os import path as op
import numpy as np
from numpy.polynomial import legendre
from numpy.testing import (assert_allclose, assert_array_equal, assert_equal,
assert_array_almost_equal)
from scipy.interpolate import interp1d
import pytest
import mne
from mne.forward import _make_surface_... | 41.195652 | 79 | 0.652858 | [
"BSD-3-Clause"
] | 0reza/mne-python | mne/forward/tests/test_field_interpolation.py | 11,370 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from targets.firefox.fx_testcase import *
class Test(FirefoxTest):
@pytest.mark.details(
description='Bro... | 44.125 | 116 | 0.679037 | [
"MPL-2.0"
] | mwxfr/mattapi | tests/firefox/toolbars_window_controls/browser_controls_upper_corner.py | 3,530 | Python |
from typing import Tuple
from chiavdf import prove
from apple.consensus.constants import ConsensusConstants
from apple.types.blockchain_format.classgroup import ClassgroupElement
from apple.types.blockchain_format.sized_bytes import bytes32
from apple.types.blockchain_format.vdf import VDFInfo, VDFProof
from apple.ut... | 33.7 | 113 | 0.771513 | [
"Apache-2.0"
] | Apple-Network/apple-blockchain | apple/util/vdf_prover.py | 1,011 | Python |
# Copyright (c) 2020, The InferLO authors. All rights reserved.
# Licensed under the Apache License, Version 2.0 - see LICENSE file.
from __future__ import annotations
import random
import time
from dataclasses import dataclass
from typing import TYPE_CHECKING, List, Callable, Dict
import numpy as np
from inferlo.ba... | 35.932384 | 79 | 0.561305 | [
"Apache-2.0"
] | InferLO/inferlo | inferlo/generic/libdai_bp.py | 20,194 | Python |
import os
import shutil
def setup_vscode():
def _get_vscode_cmd(port):
executable = "code-server"
if not shutil.which(executable):
raise FileNotFoundError("Can not find code-server in PATH")
# Start vscode in CODE_WORKINGDIR env variable if set
# If not, start ... | 28.666667 | 81 | 0.554506 | [
"BSD-3-Clause"
] | sylus/vscode-binder | jupyter_vscode_proxy/__init__.py | 1,376 | Python |
import time
import logging
import os
import openpathsampling as paths
from .path_simulator import PathSimulator, MCStep
from ..ops_logging import initialization_logging
logger = logging.getLogger(__name__)
init_log = logging.getLogger('openpathsampling.initialization')
class PathSampling(PathSimulator):
"""
... | 34.326087 | 80 | 0.5774 | [
"MIT"
] | bolhuis/openpathsampling | openpathsampling/pathsimulators/path_sampling.py | 11,053 | Python |
"""
WSGI config for rush00 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | 22.882353 | 78 | 0.784062 | [
"MIT"
] | 42bbichero/MovieMon | rush00/wsgi.py | 389 | Python |
"""
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | 28.306122 | 72 | 0.645999 | [
"BSD-3-Clause"
] | vgno/webpagetest | agent/webdriver/recorder.py | 2,774 | Python |
import urllib.request
from urllib.parse import urlencode
import json
import pprint
import socket
import struct
#from src import etri2conll
def getETRI_rest(text):
url = "http://143.248.135.20:31235/etri_parser"
contents = {}
contents['text'] = text
contents = json.dumps(contents).encode('ut... | 27.42236 | 116 | 0.495583 | [
"Apache-2.0"
] | shingiyeon/KoreanCoreferenceResolution | etri.py | 4,415 | Python |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__version__ = '4.7.3'
| 23 | 59 | 0.717391 | [
"BSD-3-Clause"
] | flowcommerce/integrations-core | gitlab/datadog_checks/gitlab/__about__.py | 138 | Python |
from django.contrib.auth import models as auth_models
from django.core.mail import send_mail
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_random_string
from django.utils.translation import gettext_lazy as _
from oscar.core.compat imp... | 34.531646 | 97 | 0.633065 | [
"BSD-3-Clause"
] | Abirami15/django-oscar | src/oscar/apps/customer/abstract_models.py | 8,184 | Python |
"""A training script of TD3 on OpenAI Gym Mujoco environments.
This script follows the settings of http://arxiv.org/abs/1802.09477 as much
as possible.
"""
import argparse
import logging
import sys
import gym
import gym.wrappers
import numpy as np
import torch
from torch import nn
import pfrl
from pfrl import exper... | 30.400881 | 88 | 0.60542 | [
"MIT"
] | toslunar/pfrl | examples/mujoco/reproduction/td3/train_td3.py | 6,901 | Python |
from django import forms
from django.contrib.auth.models import User
from django.forms import ModelForm
from artapp.models import Artist, Art
from django.template.defaultfilters import slugify
class RegistrationForm(ModelForm):
username = forms.CharField(label=(u'User Name'))
email = forms.EmailField(label=(u'Em... | 34.385714 | 107 | 0.750312 | [
"Apache-2.0"
] | khenness/asciiartdatabase | artapp/forms.py | 2,407 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: release-1.16
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import... | 23.034091 | 124 | 0.692649 | [
"Apache-2.0"
] | ACXLM/python | kubernetes/test/test_discovery_v1alpha1_api.py | 2,027 | Python |
numero = int(input("Digite um número: "))
if ((numero % 2) == 0):
print("par")
else:
print("impar") | 21.8 | 41 | 0.550459 | [
"MIT"
] | valdirsjr/learning.data | python/paridade.py | 110 | Python |
# -*- coding:utf-8 -*-
"""
Sections organize movement between pages in an experiment.
.. moduleauthor:: Johannes Brachem <jbrachem@posteo.de>, Paul Wiemann <paulwiemann@gmail.com>
"""
import time
import typing as t
from ._core import ExpMember
from ._helper import inherit_kwargs
from .page import _PageCore, _DefaultF... | 31.623327 | 105 | 0.607231 | [
"MIT"
] | ctreffe/alfred | src/alfred3/section.py | 33,080 | Python |
import bottle, logging, argparse, json, sys
from beaker.middleware import SessionMiddleware
from . import database, processing, routing
logger = logging.getLogger("snuggle.api.server")
def load_config(filename):
try:
f = open(filename)
return json.load(f)
except Exception as e:
raise Exception("Could not loa... | 21.56383 | 65 | 0.690183 | [
"MIT"
] | wikimedia/analytics-snuggle | snuggle/api/server.py | 2,027 | Python |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from registration.backends.simple.views import RegistrationView... | 37.622951 | 96 | 0.754684 | [
"Apache-2.0"
] | smhilde/dhhd_project | dhhd/dhhd/views.py | 2,295 | Python |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 35.181818 | 87 | 0.67991 | [
"Apache-2.0"
] | 233-puchi/mindspore | tests/st/control/inner/test_111_if_after_if_in_while.py | 3,096 | Python |
import re
from datetime import date, datetime, time, timedelta, timezone
ISO_8601_DATETIME_REGEX = re.compile(
r"^(\d{4})-?([0-1]\d)-?([0-3]\d)[t\s]?([0-2]\d:?[0-5]\d:?[0-5]\d|23:59:60|235960)(\.\d+)?(z|[+-]\d{2}:\d{2})?$",
re.I,
)
ISO_8601_DATE_REGEX = re.compile(r"^(\d{4})-?([0-1]\d)-?([0-3]\d)$", re.I)
ISO_... | 33.567251 | 152 | 0.612369 | [
"MIT"
] | kodemore/chili | chili/iso_datetime.py | 5,740 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('report', '0003_auto_20151015_1921'),
]
operations = [
migrations.AlterField(
mo... | 32.146341 | 148 | 0.611533 | [
"BSD-3-Clause"
] | MatPerowicz/pola-backend | report/migrations/0004_auto_20151031_0721.py | 1,318 | Python |
# 导入需要的包
import matplotlib.pyplot as plt
import numpy as np
import sklearn.datasets
import sklearn.linear_model
import matplotlib
# Display plots inline and change default figure size
matplotlib.rcParams['figure.figsize'] = (10.0, 8.0) # 生成数据集并绘制出来
np.random.seed(0)
X, y = sklearn.datasets.make_moons(200, noise=0.20)... | 35.106383 | 100 | 0.655152 | [
"MIT"
] | vuhe/LearnPython | artificial_intelligence/experiment_7.py | 5,000 | Python |
# Distributed DL Client runs on the master node
# @author: Trung Phan
# @created date: 2021-06-28
# @last modified date:
# @note:
from ddlf.cluster import *
async def main():
cluster = Cluster()
await cluster.connect()
await cluster.show_data()
await cluster.clean()
await cluster.show_data()
aw... | 20.111111 | 47 | 0.685083 | [
"Apache-2.0"
] | trungphansg/DDLF | examples/task-clean.py | 362 | Python |
from django import forms
from django.db.models.loading import get_model
from django.utils.translation import ugettext_lazy as _
from oscar.forms import widgets
Voucher = get_model('voucher', 'Voucher')
Benefit = get_model('offer', 'Benefit')
Range = get_model('offer', 'Range')
class VoucherForm(forms.Form):
"""... | 35.102273 | 78 | 0.609582 | [
"BSD-3-Clause"
] | Idematica/django-oscar | oscar/apps/dashboard/vouchers/forms.py | 3,089 | Python |
import collections
import itertools
import string
import unittest
# noinspection PyUnusedLocal
# skus = unicode string
def getItemPrices():
itemPrices = {}
itemPrices['A'] = {1:50, 3:130, 5:200}
itemPrices['B'] = {1:30, 2:45}
itemPrices['C'] = {1:20}
itemPrices['D'] = {1:15}
itemPrices['E'] = {... | 33.486381 | 132 | 0.622821 | [
"Apache-2.0"
] | DPNT-Sourcecode/CHK-dykz01 | lib/solutions/CHK/checkout_solution.py | 8,606 | Python |
from .backend import BackendTest
from .field_db_conversion import FieldDBConversionTest
from .field_options import FieldOptionsTest
from .filter import FilterTest
from .order import OrderTest
from .not_return_sets import NonReturnSetsTest
from .decimals import DecimalTest
| 34.125 | 54 | 0.871795 | [
"BSD-3-Clause"
] | aprefontaine/TMScheduler | djangoappengine/tests/__init__.py | 273 | Python |
import pdb
if __name__ == "__main__":
with open("21input.txt") as f:
data = f.read().split("\n")
data.pop(-1)
print(data)
all_food = []
for food in data:
allergens = False
ings = []
alle = []
for ingredient in food.split(" "):
if "(contain... | 26.820513 | 53 | 0.494264 | [
"MIT"
] | dxkkxn/advent-of-code | 2020/21day.py | 2,092 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.db.models import Q
def update_upload_to_ia_field(apps, schema_editor):
Link = apps.get_model('perma', 'Link')
Link.objects.filter(uploaded_to_internet_archive=True).update(internet_archive_upl... | 50.627119 | 246 | 0.73619 | [
"Unlicense",
"MIT"
] | peterk/perma | perma_web/perma/migrations/0006_add_internetarchive_status.py | 2,987 | Python |
import os
import numpy
from numpy import *
import math
from scipy import integrate, linalg
from matplotlib import pyplot
from pylab import *
class Freestream:
"""
Freestream conditions.
"""
def __init__(self, u_inf=1.0, alpha=0.0):
"""
Sets the freestream speed and angle (in degrees).
... | 23.25 | 62 | 0.574501 | [
"MIT"
] | Sparsh-Sharma/SteaPy | steapy/freestream.py | 651 | Python |
from decimal import Decimal
from pytest import raises
from typedpy import Structure, Positive, DecimalNumber
class PositiveDecimal(DecimalNumber, Positive): pass
class Foo(Structure):
_required = []
a = DecimalNumber
b = DecimalNumber(maximum=100, multiplesOf=5)
c = PositiveDecimal
def test_not_... | 23.031746 | 74 | 0.669883 | [
"MIT"
] | reesmanp/typedpy | tests/test_decimal.py | 1,451 | Python |
#!/usr/bin/python
"""
IO Module
"""
import sys
import logging
from time import time as _time
import threading
import cPickle
from bisect import bisect_left
from collections import deque
from bacpypes.debugging import bacpypes_debugging, DebugContents, ModuleLogger
from bacpypes.core import deferred
from bacpypes... | 30.422958 | 121 | 0.584137 | [
"MIT"
] | DB-CL/bacpypes | sandbox/io.py | 39,489 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from cli.output import CLIOutput
from cli.user_input import CLIUserInput
class CLIDay():
# constants
INTRO_TE... | 32.690411 | 165 | 0.570399 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | sunarch/woyo | cli/day.py | 11,932 | Python |
from __future__ import absolute_import
from desicos.abaqus.abaqus_functions import create_sketch_plane
from desicos.abaqus.utils import cyl2rec
class Imperfection(object):
"""Base class for all imperfections
This class should be sub-classed when a new imperfection is created.
"""
def __init__(self):... | 30.137931 | 72 | 0.614416 | [
"BSD-3-Clause"
] | saullocastro/desicos | desicos/abaqus/imperfections/imperfection.py | 874 | Python |
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
#
"""Code to interact with the primersearch program from EMBOSS."""
class InputRecord(object):
"""Represent the input file into the primersearch ... | 30.012987 | 72 | 0.626136 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | EnjoyLifeFund/macHighSierra-py36-pkgs | Bio/Emboss/PrimerSearch.py | 2,311 | Python |
# Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 31.268293 | 78 | 0.723869 | [
"Apache-2.0"
] | VirtueQuantumCloud/Ex | projectq/setups/decompositions/entangle.py | 1,282 | Python |
import re
import json
from math import log, sqrt
from jinja2 import Markup
from sklearn import cluster
from sklearn.decomposition import PCA
from scipy import stats
from sklearn import metrics
import numpy
from db import export_sql
from werkzeug.wrappers import Response
# create higher order transformations
def x2fs... | 37.037209 | 246 | 0.540374 | [
"MIT"
] | garthee/gnot | modules/ml_kmeans.py | 7,963 | Python |
# From http://rodp.me/2015/how-to-extract-data-from-the-web.html
import time
import sys
import uuid
import json
import markdown
from collections import Counter
from requests import get
from lxml import html
from unidecode import unidecode
import urllib
import lxml.html
from readability.readability import Document
de... | 40.188571 | 169 | 0.54358 | [
"MIT"
] | schollz/justread | parseDoc.py | 7,033 | Python |
# -*- coding: utf-8 -*-
"""Identity Services Engine deleteDeviceAdminLocalExceptionById data model.
Copyright (c) 2021 Cisco and/or its affiliates.
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... | 36.190476 | 81 | 0.694298 | [
"MIT"
] | oianson/ciscoisesdk | tests/models/validators/v3_0_0/jsd_c7d6bb4abf53f6aa2f40b6986f58a9.py | 2,280 | Python |
# -*- coding: utf-8 -*-
u"""
Beta regression for modeling rates and proportions.
References
----------
Grün, Bettina, Ioannis Kosmidis, and Achim Zeileis. Extended beta regression
in R: Shaken, stirred, mixed, and partitioned. No. 2011-22. Working Papers in
Economics and Statistics, 2011.
Smithson, Michael, and Jay ... | 33.704972 | 79 | 0.577812 | [
"BSD-3-Clause"
] | EC-AI/statsmodels | statsmodels/othermod/betareg.py | 30,504 | Python |
from sys import exit
def gold_room():
print("This room is full of gold. How much do you t ake?")
choice = input("> ")
if "0" in choice or "1" in choice:
how_much = int(choice)
else:
dead("Man, learn to type a number.")
if how_much < 50:
print("Nice, you're not gre... | 25.025 | 83 | 0.564935 | [
"MIT"
] | Eithandarphyo51/python-exercises | ex35.py | 2,002 | Python |
import serial
import csv
import os
serialPort = serial.Serial("COM10", baudrate=115200)
try:
os.rename('output.csv', 'ALTERAR_MEU_NOME.csv')
except IOError:
print('')
finally:
while(True):
arduinoData = serialPort.readline().decode("ascii")
print(arduinoData)
#a... | 24.619048 | 68 | 0.624758 | [
"MIT"
] | yaguts1/Receiver | receiveGeneratorData.py | 517 | Python |
from nonebot.default_config import *
SUPERUSERS = {513673369}
COMMAND_START = {'', '/', '!', '/', '!'} | 25.75 | 40 | 0.61165 | [
"MIT"
] | liangshicheng-daniel/Saren | Saren_bot/config.py | 107 | Python |
###############################################################################
#
# DONE:
#
# 1. READ the code below.
# 2. TRACE (by hand) the execution of the code,
# predicting what will get printed.
# 3. Run the code and compare your prediction to what actually was printed.
# 4. Decide whether you are... | 28.808511 | 79 | 0.5 | [
"MIT"
] | ColinBalitewicz/03-AccumulatorsAndFunctionsWithParameters | src/m1r_functions.py | 1,354 | Python |
from . import db
class Account(db.Model):
__tablename__ = 'account'
account_id = db.Column(db.Integer, primary_key=True)
account_name = db.Column(db.String(16), unique=True)
account_pwd = db.Column(db.String(16), unique=True)
account_nick = db.Column(db.String(16), unique=True)
account_email =... | 33.333333 | 58 | 0.677273 | [
"MIT"
] | Justyer/NightHeartDataPlatform | firefly/app/models.py | 1,100 | Python |
"""
Django settings for YoutubeFun project.
Generated by 'django-admin startproject' using Django 1.8.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build p... | 25.855856 | 71 | 0.705575 | [
"MIT"
] | dimemp/YoutubeFun | YoutubeFun/settings.py | 2,870 | Python |
import urllib.request
import os
import random
import socket
def url_open(url):
#代理
iplist=['60.251.63.159:8080','118.180.15.152:8102','119.6.136.122:80','183.61.71.112:8888']
proxys= random.choice(iplist)
print (proxys)
proxy_support = urllib.request.ProxyHandler({'http': proxys})
opener = urllib.req... | 23.461538 | 144 | 0.594848 | [
"Apache-2.0"
] | dodopeng/Pythons | mmParse.py | 2,181 | Python |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | 25.221095 | 112 | 0.536995 | [
"BSD-3-Clause"
] | AzureTech/bokeh | bokeh/plotting/glyph_api.py | 24,868 | Python |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown copyright. The Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are me... | 30.660279 | 98 | 0.663504 | [
"BSD-3-Clause"
] | anja-bom/improver | improver/cli/__init__.py | 17,599 | Python |
"""
input: image
output: little squares with faces
"""
import face_recognition
image = face_recognition.load_image_file("people.png")
face_locations = face_recognition.face_locations(image)
print(face_locations) | 21.3 | 55 | 0.812207 | [
"Apache-2.0"
] | sebastianmihai01/CG-FaceRecognition | Features/face_extraction.py | 213 | Python |
import main
main.recover_unseeded_items() | 20.5 | 29 | 0.878049 | [
"MIT"
] | maziara/deluge-feed-innoreader | recover_unseeded.py | 41 | Python |
# --------------------------------------------------------
# Deep Iterative Matching Network
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by Yi Li
# --------------------------------------------------------
from __future__ import print_function, division
import numpy as np
class Symbol:
... | 35.072464 | 84 | 0.554132 | [
"Apache-2.0"
] | 571502680/mx-DeepIM | lib/utils/symbol.py | 2,420 | Python |
__author__ = 'Eugene'
class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new")) > 0):
wd.find_element_by_link_text("groups").click()
d... | 29.851351 | 100 | 0.640109 | [
"Apache-2.0"
] | eugene1smith/homeworks | fixture/group.py | 2,209 | Python |
vet = []
i = 1
while(i <= 100):
valor = int(input())
vet.append(valor)
i = i + 1
print(max(vet))
print(vet.index(max(vet)) + 1)
| 9.733333 | 30 | 0.513699 | [
"MIT"
] | AndreAlbu/Questoes---URI---Python | 1080.py | 146 | Python |
import unittest
from creds3 import paddedInt
class TestPadLeft(unittest.TestCase):
def test_zero(self):
i = 0
self.assertEqual(paddedInt(i), "0" * 19)
def test_ten(self):
i = 10
self.assertEqual(paddedInt(i), str(i).zfill(19))
def test_arbitrary_number(self):
i = ... | 24.52381 | 56 | 0.640777 | [
"Apache-2.0"
] | romanrev/creds3 | tests/pad_left_tests.py | 515 | Python |
from typing import List
from pdip.data import Entity
from sqlalchemy import Column, String, Integer, ForeignKey
from sqlalchemy.orm import relationship
from process.domain.base import Base
from process.domain.base.operation.DataOperationBase import DataOperationBase
from process.domain.operation.DataOperationContact ... | 53.44 | 112 | 0.747754 | [
"MIT"
] | ahmetcagriakca/pythondataintegrator | src/process/process/domain/operation/DataOperation.py | 1,336 | Python |
import pandas as pd
import numpy as np
import os
import json
import requests
from dotenv import load_dotenv
from PIL import Image
from io import BytesIO
from IPython.core.display import display, HTML
def art_search(art):
'''
Function to retrieve the information about collections in the Art institute of Chicago... | 37.609959 | 281 | 0.629523 | [
"MIT"
] | nicolewang97/AICAPI_YW3760 | src/aicapi_yw3760/aicapi_yw3760.py | 9,068 | Python |
import argparse
import sys
from typing import List, Sequence
from exabel_data_sdk import ExabelClient
from exabel_data_sdk.scripts.base_script import BaseScript
class ListTimeSeries(BaseScript):
"""
Lists all time series.
"""
def __init__(self, argv: Sequence[str], description: str):
super()... | 32.216667 | 92 | 0.590274 | [
"MIT"
] | Exabel/python-sdk | exabel_data_sdk/scripts/list_time_series.py | 1,933 | Python |
from typing import List, Dict
import os
import json
import argparse
import sys
from string import Template
from common import get_files, get_links_from_file, get_id_files_dict, get_id_title_dict
FORCE_GRAPH_TEMPLATE_NAME = "force_graph.html"
OUTPUT_FILE_NAME = "output.html"
def generate_force_graph(id_files_dict: ... | 29.481928 | 118 | 0.651819 | [
"MIT"
] | joashxu/zetteltools | zettvis.py | 2,447 | Python |
import os
import sys
import math
import copy
from binary_tree import BinaryTreeNode, BinaryTree, BinarySearchTree
from graph import GraphNode, Graph
# 4.6 find the next node (in-order) of a given node in a Binary Tree
# -> back to root and using in-order travelsal until meet the current node. get the next
def get_ne... | 22.042453 | 88 | 0.682217 | [
"MIT"
] | tranquan/coding-dojo | cracking-the-coding-interview/1-chapter4_1.py | 4,673 | Python |
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
"""
Built-in value transformers.
"""
import datetime as dt
from typing import Any, Sequence
from datadog_checks.base import AgentCheck
from datadog_checks.base.types import ServiceCheckStatus
from datadog... | 25.833333 | 65 | 0.748387 | [
"BSD-3-Clause"
] | 0gajun/integrations-core | rethinkdb/datadog_checks/rethinkdb/document_db/transformers.py | 775 | Python |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 41.825397 | 113 | 0.718406 | [
"Apache-2.0"
] | Angzz/DeformableV2 | benchmark/opperf/nd_operations/unary_operators.py | 2,635 | Python |
from http import HTTPStatus
from src.app.post.enum import PostStatus
from src.app.post.model import PostModel
from src.common.authorization import Authorizer
from src.common.decorator import api_response
from src.common.exceptions import (ExceptionHandler, ItemNotFoundException)
class GetService(object):
def __i... | 35.722222 | 84 | 0.716952 | [
"MIT"
] | Thiqah-Lab/aws-serverless-skeleton | src/app/post/get.py | 1,286 | Python |
from utils.compute import get_landmark_3d, get_vector_intersection
from utils.visualize import HumanPoseVisualizer
from utils.OakRunner import OakRunner
from utils.pose import getKeypoints
from utils.draw import displayFPS
from pathlib import Path
import depthai as dai
import numpy as np
import cv2
fps_limit = 3
fra... | 50.092784 | 236 | 0.659189 | [
"MIT"
] | Ikomia-dev/ikomia-oakd | _examples/pose_estimation.py | 4,859 | Python |
import sys
import numpy as np
import pandas as pd
from pandas.api.types import is_list_like, is_scalar
from dask.dataframe import methods
from dask.dataframe.core import DataFrame, Series, apply_concat_apply, map_partitions
from dask.dataframe.utils import has_known_categories
from dask.utils import M
##############... | 31.416438 | 118 | 0.588297 | [
"BSD-3-Clause"
] | Kirito1397/dask | dask/dataframe/reshape.py | 11,467 | Python |
import json
from sqlalchemy.orm import subqueryload
from werkzeug.exceptions import BadRequest, NotFound, PreconditionFailed
from rdr_service import clock
from rdr_service.code_constants import PPI_EXTRA_SYSTEM
from rdr_service.dao.base_dao import BaseDao, UpdatableDao
from rdr_service.lib_fhir.fhirclient_1_0_6.model... | 44.664452 | 117 | 0.675841 | [
"BSD-3-Clause"
] | all-of-us/raw-data-repository | rdr_service/dao/questionnaire_dao.py | 13,444 | Python |
import json
import os
from urllib import request
from flask import current_app
from elastichq.model import ClusterDTO
from elastichq.vendor.elasticsearch.exceptions import NotFoundError
from .ConnectionService import ConnectionService
from ..globals import CACHE_REGION, LOG
class HQService:
def get_status(self... | 46.027523 | 118 | 0.612318 | [
"Apache-2.0"
] | AdvancedThreatAnalytics/elasticsearch-HQ | elastichq/service/HQService.py | 5,017 | Python |
import unittest
import os
from web3 import Web3
proxy_url = os.environ.get('PROXY_URL', 'http://localhost:9090/solana')
proxy = Web3(Web3.HTTPProvider(proxy_url))
eth_account = proxy.eth.account.create('web3_clientVersion')
proxy.eth.default_account = eth_account.address
neon_revision = os.environ.get('NEON_REVISION'... | 35.064516 | 83 | 0.734131 | [
"BSD-3-Clause"
] | neonlabsorg/proxy-model.py | proxy/testing/test_web3_clientVersion.py | 1,087 | Python |
def palindrome(str):
end = len(str)
middle = end >> 1
for i in range(middle):
end -= 1
if(str[i] != str[end]):
return False
return True
while True:
word = input('Enter word: ')
if word == 'done' : break
palindrome(word)
if palindrome(word) == True:
pri... | 22.235294 | 32 | 0.531746 | [
"MIT"
] | jmbohan/python | mid/mid_3.py | 378 | Python |
# -*- coding: utf-8 -*-
import scrapy
import json
from locations.items import GeojsonPointItem
class NoodlesAndCompanySpider(scrapy.Spider):
name = "noodles_and_company"
item_attributes = { 'brand': "Noodles and Company" }
allowed_domains = ["locations.noodles.com"]
start_urls = (
'https://lo... | 42.291339 | 131 | 0.548501 | [
"MIT"
] | Darknez07/alltheplaces | locations/spiders/noodles_and_company.py | 5,371 | Python |
#!/usr/bin/env python
from __future__ import print_function
import numpy as np
import scipy as sp
from PIL import Image
import six
import networkx
for m in (np, sp, Image, six, networkx):
if not m is None:
if m is Image:
# Pillow 6.0.0 and above have removed the 'VERSION' attribute
... | 28.782609 | 95 | 0.611782 | [
"BSD-3-Clause"
] | JDWarner/scikit-fuzzy | tools/build_versions.py | 662 | Python |
from .base import SimIRExpr
from ... import s_options as o
from ...s_action import SimActionData
class SimIRExpr_RdTmp(SimIRExpr):
def _execute(self):
if (o.SUPER_FASTPATH in self.state.options
and self._expr.tmp not in self.state.scratch.temps):
self.expr = self.state.se.BVV(0,... | 40.388889 | 139 | 0.664374 | [
"BSD-2-Clause"
] | praetorian-code/simuvex | simuvex/vex/expressions/rdtmp.py | 727 | Python |
# coding: utf-8
# # Load and preprocess 2012 data
#
# We will, over time, look over other years. Our current goal is to explore the features of a single year.
#
# ---
# In[1]:
get_ipython().magic('pylab --no-import-all inline')
import pandas as pd
# ## Load the data.
#
# ---
#
# If this fails, be sure that yo... | 20.027027 | 108 | 0.654521 | [
"MIT"
] | aryamccarthy/ANES | notebooks/as_script/1.0-adm-load-data-2012-Copy1.py | 3,705 | Python |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 33.5 | 74 | 0.758898 | [
"Apache-2.0"
] | KaranToor/MA450 | google-cloud-sdk/.install/.backup/lib/surface/compute/machine_types/__init__.py | 871 | Python |
"""
WSGI config for rara_api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETT... | 23.117647 | 78 | 0.78626 | [
"MIT"
] | lcbiplove/rara-api | rara_api/wsgi.py | 393 | Python |
import random
from string import Template
import tinydb
from flask import Flask, redirect, url_for, abort
app = Flask(__name__)
db = tinydb.TinyDB('./db.json')
HTML = """<!DOCTYPE html>
<html>
<head>
<title>Dulux Swatch</title>
<link rel="StyleSheet" href="/static/main.css" type="text/css">
</head>
<bo... | 24.173913 | 114 | 0.65018 | [
"MIT"
] | leohemsted/duluxswatch | duluxswatch/app.py | 1,112 | Python |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... | 30.048544 | 94 | 0.581583 | [
"MIT"
] | ALT-F1/azure-cli | src/azure-cli-core/setup.py | 3,095 | Python |
# -*- coding: utf-8 -*-
#
import re
from collections import OrderedDict
from copy import deepcopy
from ._http import HTTPStatus
#copied from sanic router
REGEX_TYPES = {
'string': (str, r'[^/]+'),
'int': (int, r'\d+'),
'number': (float, r'[0-9\\.]+'),
'alpha': (str, r'[A-Za-z]+'),
}
FIRST_CAP_RE = re.... | 31.707182 | 97 | 0.646628 | [
"MIT"
] | oliverpain/sanic-restplus | sanic_restplus/utils.py | 5,739 | Python |
import asyncio
import io
import userbot.plugins.sql_helper.pmpermit_sql as pmpermit_sql
from telethon.tl.functions.users import GetFullUserRequest
from telethon import events, errors, functions, types
from userbot import ALIVE_NAME, LESS_SPAMMY
from userbot.utils import admin_cmd
PM_WARNS = {}
PREV_REPLY_MESSAGE = {}
... | 37.315789 | 178 | 0.573625 | [
"Apache-2.0"
] | Maxpayne7000/X-tra-Telegram | userbot/plugins/pmpermit.py | 7,096 | Python |
''' Frsutum PointNets v1 Model.
'''
from __future__ import print_function
import sys
import os
import tensorflow as tf
import numpy as np
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'utils'))
import tf_util
... | 41.308017 | 101 | 0.591624 | [
"Apache-2.0"
] | BPMJG/annotated-F-pointnet | models/frustum_pointnets_v1.py | 9,914 | Python |
from configparser import SafeConfigParser
import logging
import os
class Config:
def __init__(self, configFile):
if os.path.isfile(configFile):
self.Config = SafeConfigParser()
self.Config.read(configFile)
logging.info(self.Config.sections())
else:
p... | 29.517241 | 64 | 0.546729 | [
"BSD-3-Clause"
] | ponder-lab/gitcproc | src/util/Config.py | 856 | Python |
import asyncio
import discord
from discord import Member, Role, TextChannel, DMChannel
from discord.ext import commands
from typing import Union
from profanity_check import predict
class ProfanityFilter:
"""
A simple filter that checks for profanity in a message and
then deletes it. Many profanity detec... | 29.734513 | 86 | 0.59881 | [
"MIT"
] | officialpiyush/modmail-plugins-2 | profanity-filter/profanity-filter.py | 3,360 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Author: vs@webdirect.md
Description: Very simple reminder
'''
from core.people.person import Profile, Session
from core.utils.utils import text2int
import re
from crontab import CronTab
from getpass import getuser
from core.config.settings import logger, ROBOT_DIR
c... | 39.460177 | 178 | 0.365665 | [
"MIT"
] | vsilent/smarty-bot | core/brain/remind/me/every/reaction.py | 17,836 | Python |
import cv2
class SimplePreprocessor:
def __init__(self, width, height, inter=cv2.INTER_AREA):
# store the target image width, height, and interpolation
# method used when resizing
self.width = width
self.height = height
self.inter = inter
def preprocess(self, image):
... | 34.5 | 85 | 0.660455 | [
"MIT"
] | Akshat4112/Machine-Learning-Case-Studies | 22. Neural Networks from Scratch/preprocessing/simplepreprocessor.py | 483 | Python |
"""Define endpoints related to user reports."""
import logging
from typing import Any, Dict
from .helpers.report import Report
_LOGGER: logging.Logger = logging.getLogger(__name__)
class UserReport(Report):
"""Define a user report object."""
async def status_by_coordinates(
self, latitude: float, l... | 30.774194 | 78 | 0.634172 | [
"MIT"
] | bachya/pyflunearyou | pyflunearyou/user.py | 954 | Python |
import re
from .reports import BaseReport
from .utils import get_pacer_doc_id_from_doc1_url, reverse_goDLS_function
from ..lib.log_tools import make_default_logger
from ..lib.string_utils import force_unicode
logger = make_default_logger()
class AttachmentPage(BaseReport):
"""An object for querying and parsing ... | 38.112903 | 85 | 0.589223 | [
"BSD-2-Clause"
] | johnhawkinson/juriscraper | juriscraper/pacer/attachment_page.py | 7,089 | Python |
# System
import json
# SBaaS
from .stage02_physiology_pairWiseTest_query import stage02_physiology_pairWiseTest_query
from SBaaS_base.sbaas_template_io import sbaas_template_io
# Resources
from io_utilities.base_importData import base_importData
from io_utilities.base_exportData import base_exportData
from ddt_python.d... | 61.165803 | 248 | 0.61313 | [
"MIT"
] | dmccloskey/SBaaS_COBRA | SBaaS_COBRA/stage02_physiology_pairWiseTest_io.py | 11,805 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.