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 xml.etree.ElementTree as ET from .. import NAMESPACE class ServerResponseError(Exception): def __init__(self, code, summary, detail): self.code = code self.summary = summary self.detail = detail super(ServerResponseError, self).__init__(str(self)) def __str__(self): ...
33.962963
99
0.642312
[ "MIT" ]
reevery/server-client-python
tableauserverclient/server/endpoint/exceptions.py
917
Python
import csv from convertextract.parsers.csv_parser import Parser as BaseParser class Parser(BaseParser): """Extract text from tab separated values files (.tsv). """ delimiter = '\t'
21.666667
66
0.717949
[ "MIT" ]
roedoejet/convertextract
convertextract/parsers/tsv_parser.py
195
Python
#!/usr/bin/env python3 from Crypto.PublicKey import RSA, ECC import json from hashlib import sha256 from Crypto.Cipher import AES, PKCS1_OAEP from base64 import b64decode from Crypto.Signature import DSS from Crypto.Hash import SHA256 import socket from base64 import * from server import * # key = R...
44.7
761
0.683166
[ "MIT" ]
hacmao/hacmao.github.io
ctf/2020/nullcon/msg/solve.py
3,576
Python
#!/usr/bin/env python from distutils.core import setup setup( name='tweepy_crawler', version='0.1', license='MIT', long_description=open('README.md').read(), )
16.181818
46
0.657303
[ "MIT" ]
MCardus/GuruFinder
twitter_crawlers/tweepy_crawler/setup.py
178
Python
from django.contrib import admin from .. import models @admin.register(models.Code) class CodeAdmin(admin.ModelAdmin): """ 코드 정보 """ list_display = ['id', 'author', 'problem', 'language', 'name', 'available_game', 'date' ] class Meta: model = models.Code
18
93
0.628472
[ "MIT" ]
Capstone-onepanman/api-server
onepanman_api/admin/code.py
296
Python
from .euro import api as euro_ns
16.5
32
0.787879
[ "MIT" ]
erkandem/rates_app
app/api/rates/__init__.py
33
Python
""" strings and logic related to composing notifications """ HELLO_STATUS = "Hello! I'm Vaccination Notifier" HELLO_MESSAGE = ( "Hello there!\n" "\n" "I'm Vaccination Notifier. This is just a message to let you know I'm running and " "to test our notification configuration. I'll check for changes to yo...
30.714286
90
0.675969
[ "MIT" ]
Cedric0303/Vaccination-Notifier
messages.py
1,290
Python
from __future__ import print_function """ A script to batch render and update interactive viewer. """ import os import sys import argparse import pyexr import numpy as np import json import subprocess as sp from analyze import update_stats, compute_stats, write_data if __name__ == '__main__': # Parse arguments ...
38.931818
127
0.590193
[ "MIT" ]
beltegeuse/interactive-viewer
tools/render.py
3,426
Python
import json import time from dataclasses import dataclass from logging import Logger import requests from insightconnect_plugin_runtime.exceptions import PluginException from insightconnect_plugin_runtime.helper import clean from requests.auth import HTTPBasicAuth @dataclass class AlertParams: alert_type: [str] ...
39.642487
120
0.606065
[ "MIT" ]
ax-zyoutz/insightconnect-plugins
plugins/rapid7_intsights/icon_rapid7_intsights/util/api.py
7,651
Python
# PuLP : Python LP Modeler # Version 1.4.2 # Copyright (c) 2002-2005, Jean-Sebastien Roy (js@jeannot.org) # Modifications Copyright (c) 2007- Stuart Anthony Mitchell (s.mitchell@auckland.ac.nz) # $Id:solvers.py 1791 2008-04-23 22:54:34Z smit023 $ # Permission is hereby granted, free of charge, to any person obtaining...
41.512968
112
0.567581
[ "MIT" ]
KCachel/pulp
pulp/apis/gurobi_api.py
14,405
Python
import os, sys from base64 import decodebytes from wptserve.utils import isomorphic_decode import importlib subresource = importlib.import_module("common.security-features.subresource.subresource") def generate_payload(request, server_data): data = (u'{"headers": %(headers)s}') % server_data if b"id" in requ...
56.714286
89
0.651477
[ "BSD-3-Clause" ]
2901Naim/wpt
common/security-features/subresource/font.py
4,367
Python
from pathlib import Path data_path = Path(Path(__file__).parent) __all__ = ['data_path']
16
40
0.708333
[ "MIT" ]
tranandrew0421/Rin-Bot
data/__init__.py
96
Python
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import io import json import logging import os import warnings from builtins import str from typing import Any from rasa_core import utils from rasa_core.domain import ...
37.363128
77
0.612141
[ "Apache-2.0" ]
AdrianAdamiec/rasa_core
rasa_core/policies/keras_policy.py
6,688
Python
config = { "interfaces": { "google.ads.googleads.v1.services.CustomerFeedService": { "retry_codes": { "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], "non_idempotent": [] }, "retry_params": { "default": { ...
35.029412
67
0.438287
[ "Apache-2.0" ]
BenRKarl/google-ads-python
google/ads/google_ads/v1/services/customer_feed_service_client_config.py
1,191
Python
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import os from textwrap import dedent import pytest from pants.backend.jvm.artifact import Artifact from pants.backend.jvm.repository import Repository from pants.backend.jvm.scala_artif...
31.774194
101
0.494585
[ "Apache-2.0" ]
rahuliyer95/pants
tests/python/pants_test/backend/graph_info/tasks/test_list_targets.py
5,910
Python
from typing import Any, Dict from .base import Presenter from .presenter import register_presenter @register_presenter("initial-data") class InitialData(Presenter): """ Initial data for setup """ @property def data(self) -> Dict[Any, Any]: return { "privacy_policy": "The PP",...
22.869565
42
0.587452
[ "MIT" ]
ThomasJunk/openslides-backend
openslides_backend/presenter/initial_data.py
526
Python
from data_common.config.configurer import get_conf from data_common.provision.gs_buckets import confirm_bucket def init_namespace_poc(): conf = get_conf() project_id = conf.cloud.gcp.project namespaces = conf.namespaces for namespace, v in namespaces.items(): print(f'namespace: {namespace}...
22.047619
59
0.678186
[ "Apache-2.0" ]
hamshif/dags
provision/onboarding/onboard_namespaces.py
463
Python
# -*- coding:utf-8 -*- import functools import six from flask import current_app, g, request from flask import session, abort from api.extensions import cache def get_access_token(): return class AccessTokenCache(object): @classmethod def get(cls): if cache.get("AccessToken") is not None: ...
29.785714
89
0.622302
[ "MIT" ]
Lancger/cmdb-1
api/lib/perm/acl.py
4,170
Python
import sqlite3 import logging DOOR_OPENED = 'door opened' DOOR_CLOSED = 'door closed' class DataStore: def __init__(self, setup=False): self.connection = sqlite3.connect('db/app.sqlite3.db') self.connection.row_factory = sqlite3.Row if setup: self.setup() def record_doo...
33.866667
112
0.546752
[ "Apache-2.0" ]
gurumitts/garage-butler
garage/datastore.py
4,064
Python
import torch import torch.nn as nn #from .utils import load_state_dict_from_url from .utils import zerocenter __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d', 'wide_resnet50_2', 'wide_resnet101_2'] model_urls = { 'res...
38.396277
107
0.626377
[ "MIT" ]
vinnamkim/segmentation_models.pytorch
segmentation_models_pytorch/encoders/zerocenter.py
14,437
Python
from collections import defaultdict import requests from logger import logger from perfrunner.helpers.misc import pretty_dict from perfrunner.helpers.remote import RemoteHelper from perfrunner.tests import PerfTest class FIOTest(PerfTest): TRACKER = 'fio.sc.couchbase.com' TEMPLATE = { 'group': '{}...
28.783333
80
0.600463
[ "Apache-2.0" ]
agyryk/perfrunner
perfrunner/tests/fio.py
1,727
Python
#!/usr/bin/env python3 """ Possible string formats: <author(s)> <title> <source> <year> """ import re import pdf CRED = '\033[91m' CGREEN = '\33[32m' CYELLOW = '\33[33m' CBLUE = '\33[34m' CVIOLET = '\33[35m' CBEIGE = '\33[36m' CWHITE = '\33[37m' CEND = '\033[0m' def extract_references_list_by_keyword(text, keyw...
22.768293
71
0.528656
[ "MIT" ]
Dewdis/scholar_tree
parse_reference.py
1,867
Python
import unittest import datetime from unittest.mock import Mock, patch from types import MethodType from serverobjects.ban import BanInstance class TestCheckIfMessageInfringes(unittest.TestCase): def test_check_if_message_infringes__exact_match(self): test_ban = BanInstance( { 'rowid': 1, 'banned_word':...
28.450382
90
0.635632
[ "MIT" ]
matthew-robertson/banned-word-tracker
tests/serverobjects/test_ban.py
3,732
Python
# Copyright 2019-2020 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" fil...
38.866834
107
0.739156
[ "Apache-2.0" ]
AWS-Bassem/sagemaker-python-sdk
tests/integ/test_auto_ml.py
15,469
Python
from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import torch import torch.nn as nn import torch.nn.functional as F from lib.models.decode import mot_decode from lib.models.losses import FocalLoss from lib.models.losses import RegL1Loss, RegLoss,...
42.483871
120
0.579157
[ "MIT" ]
CaptainEven/FairMOTVehicle
src/lib/trains/mot.py
5,548
Python
from typing import Any, Dict, List import pandas from dagster import AssetKey, AssetMaterialization, EventMetadataEntry from dagster_dbt import DbtOutput from .snowflake_io_manager import connect_snowflake class DbtAssetResource: """ This class defines a resource that is capable of producing a list of Asset...
43.795455
100
0.674364
[ "Apache-2.0" ]
AndreaGiardini/dagster
examples/hacker_news/hacker_news/resources/dbt_asset_resource.py
3,854
Python
# *************************************************************************************** # *************************************************************************************** # # Name : importcode.py # Author : Paul Robson (paul@robsons.org.uk) # Date : 12th March 2019. # Purpose : Import code into buffer ...
31.956522
121
0.591837
[ "MIT" ]
paulscottrobson/flat
scripts/importcode.py
2,940
Python
# -*- coding: utf-8 -*- import os from O365 import Account, Connection, FileSystemTokenBackend from datetime import datetime as dt from datetime import timedelta from conf.conf import CONFIG as conf from fritzhome import FritzBox import logging class Core: @staticmethod def get_credentials(): return...
35.658537
146
0.632695
[ "Apache-2.0" ]
ykorzikowski/python-fritz-office-365-sync
radiator_fritz_o365_sync/core.py
5,848
Python
from wagtailstreamforms.models import Form def get_form_instance_from_request(request): """ Get the form class from the request. """ form_id = request.POST.get("form_id") if form_id and form_id.isdigit(): try: return Form.objects.get(pk=int(form_id)) except Form.DoesNotExist: ...
25.214286
52
0.657224
[ "MIT" ]
AsankaL/wagtailstreamforms
wagtailstreamforms/utils/requests.py
353
Python
# define BipIdb and some helper functions for easier scripting (at the end). import ida_kernwin import idaapi import idc class BipIdb(object): """ Class for representing the idb loaded by IDA, this has the goal to provide access to things specific to the IDB. Currently this conta...
24.791667
78
0.558319
[ "BSD-3-Clause" ]
BrunoPujos/bip
bip/base/bipidb.py
2,975
Python
from hog_cpp.fhog import fhog import numpy as np ''' https://github.com/lawpdas/fhog-python ''' def get_hog(img): M = np.zeros(img.shape[:2], dtype='float32') O = np.zeros(img.shape[:2], dtype='float32') H = np.zeros([img.shape[0] // 4, img.shape[1] // 4, 32], dtype='float32') # python3 fhog.gradient...
21
88
0.599343
[ "MIT" ]
ElnuraMusaoglu/KernelizedCorrelationFilter
hog_cpp/fhog/get_hog.py
609
Python
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. # # Modifications copyright (c) 2021 DocYard Authors. All Rights Reserve. # # 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 # # ...
33.620482
201
0.613241
[ "Apache-2.0" ]
DocYard-ai/UCR
ucr/core/architecture/head/rec_srn_head.py
11,162
Python
classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Intended Audience :: End Users/Desktop', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: Apache Software License', 'Operating System :: MacOS :: M...
30.04
57
0.624501
[ "Apache-2.0" ]
GFTwrt/amuse
support/classifiers.py
751
Python
import torch import torch.nn as nn from model.modules.stage_backbone import StageBackbone from model.modules.feature_pyramid_net import FeaturePyramidNet from model.modules.polar_head import PolarHead class PolarInst(nn.Module): def __init__(self, num_polars, num_channels, num_classes): super(PolarInst, ...
39.72093
108
0.683255
[ "Apache-2.0" ]
Tenvence/polar-inst
model/polar_inst.py
1,708
Python
# coding: utf-8 """ FINBOURNE Insights API FINBOURNE Technology # noqa: E501 The version of the OpenAPI document: 0.0.238 Contact: info@finbourne.com Generated by: https://openapi-generator.tech """ try: from inspect import getfullargspec except ImportError: from inspect import getargs...
29.277154
140
0.584751
[ "MIT" ]
finbourne/finbourne-insights-sdk-python
sdk/finbourne_insights/models/audit_process.py
7,817
Python
#! /usr/bin/env python # PuLP : Python LP Modeler # Version 1.5.1 # Copyright (c) 2002-2005, Jean-Sebastien Roy (js@jeannot.org) # Modifications Copyright (c) 2007- Stuart Anthony Mitchell (s.mitchell@auckland.ac.nz) # $Id: pulp.py 1791 2008-04-23 22:54:34Z smit023 $ # Permission is hereby granted, free of charge, to...
33.75833
171
0.561311
[ "MIT" ]
ruxkor/pulp-or
src/pulp/pulp.py
75,990
Python
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
40.0625
158
0.632345
[ "MIT" ]
00Kai0/azure-cli-extensions
src/quantum/azext_quantum/vendored_sdks/azure_mgmt_quantum/models/target_description_py3.py
1,923
Python
# - * - encoding : utf - 8 - * - # pylint: disable=fixme, line-too-long """ Matrix factorization solver. :copyright: 2017-2019 H2O.ai, Inc. :license: Apache License Version 2.0 (see LICENSE for details) """ import numpy as np import scipy import scipy.sparse def _get_sparse_matrixes(X): '''Create csc, csr and ...
39.410095
137
0.574802
[ "Apache-2.0" ]
aaron8tang/h2o4gpu
src/interface_py/h2o4gpu/solvers/factorization.py
12,493
Python
# Copyright 2021 Arie Bregman # # 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 agree...
34.854369
78
0.591086
[ "Apache-2.0" ]
EliadCohen/cinfo
cinfo/triager.py
3,590
Python
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.8.1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys im...
23
105
0.729469
[ "Apache-2.0" ]
dix000p/kubernetes-client
kubernetes/test/test_apps_v1beta1_deployment_list.py
1,035
Python
from src.engine.company_root import CompanyRoot from src.engine.company_root_simples import CompanyRootSimples from src.engine.partners import Partners from src.engine.company import Company from src.engine.company_tax_regime import CompanyTaxRegime from src.engine.ref_date import main as engine_ref_date from s...
32.956522
63
0.777045
[ "MIT" ]
libercapital/dados_publicos_cnpj_receita_federal
src/engine/main.py
758
Python
"""Top-level package for stringdb. Imports the api module""" from .api import * __author__ = """Peter C DeWeirdt""" __email__ = 'petedeweirdt@gmail.com' __version__ = '0.1.5'
25.142857
60
0.710227
[ "MIT" ]
gpp-rnd/stringdb
stringdb/__init__.py
176
Python
""" python version compatibility code """ import functools import inspect import io import re import sys from contextlib import contextmanager from inspect import Parameter from inspect import signature import attr import py import _pytest from _pytest._io.saferepr import saferepr from _pytest.outcomes import fail fr...
29.682857
106
0.677544
[ "MIT" ]
robholt/pytest
src/_pytest/compat.py
10,389
Python
from neo4j import GraphDatabase from argparse import ArgumentParser from concurrent.futures import ThreadPoolExecutor,as_completed,thread import sys import csv from time import time PRACTICAL = 'practical' LOGICAL = 'logical' NETONLY = 'netonly' ALL = 'all' PRIVS = 'privileged' rans = None def time_to_str(total_time)...
45.941818
294
0.620389
[ "Apache-2.0" ]
naul1/BloodHound-Tools
Ransomulator/ransomulator.py
12,634
Python
# coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # --------------------------------------------------------------------...
40.261036
149
0.685593
[ "MIT" ]
hytao/azure-sdk-for-python
sdk/storage/azure-storage-blob/tests/test_common_blob_async.py
83,924
Python
#!/usr/bin/env python # # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Utility script to install APKs from the command line quickly.""" import argparse import glob import logging import os import ...
40.210526
80
0.618923
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Cela-Inc/WebARonARCore
build/android/adb_install_apk.py
5,348
Python
from cgi import parse_header from io import BytesIO from typing import Dict from typing import Optional from typing import Tuple from typing import Union from .headers import Headers from .http_method import HttpMethod from .message.body import RequestBody from .message.form_body import FormBody from .message.json_bod...
33.35
84
0.612444
[ "MIT" ]
gezpage/chocs
chocs/http_request.py
2,668
Python
""" Reinforcement learning maze example. Red rectangle: explorer. Black rectangles: hells [reward = -1]. Yellow bin circle: paradise [reward = +1]. All other states: ground [reward = 0]. This script is the environment part of this example. The RL is in RL_brain.py. View more o...
29.121622
84
0.517633
[ "MIT" ]
zhao-jin/Reinforcement-learning-with-tensorflow
contents/2_Q_Learning_maze/maze_env.py
4,310
Python
import unittest from wiki_dump_reader import Cleaner class TestRemoveEmphasis(unittest.TestCase): def setUp(self): self.cleaner = Cleaner() def test_remove_emphasis_bold(self): text = "'''游戏工具编程'''是指采用各种开发工具进行开发修改[[电脑]]、[[电视]][[游戏]]的过程。主要的开发工具有以下几大类" expected = '游戏工具编程是指采用各种开发工具进行开发修...
47.518519
97
0.62198
[ "MIT" ]
CyberZHG/wiki-dump-reader
tests/test_remove_emphasises.py
2,079
Python
import sys from os.path import dirname, abspath sys.path.append(dirname(dirname(abspath(__file__)))) from SCZ_RNAseq.syn4590909.utils import * path="../../data/SCZ_RNAseq/output/syn4590909/" dataset="PPI" features = np.genfromtxt("{}{}.GE_Features.txt".format(path, dataset), dtype=np.dtype(np.float32)) labels = get_c...
42.0625
115
0.69948
[ "MIT" ]
omarmaddouri/GCNCC_cross_validated
scripts/SCZ_RNAseq/syn4590909/rank_individual_genes.py
2,692
Python
LATEST_VERSION = '4.2.0' def rule(event): return (event['name'] == 'pack_it-compliance_osquery_info' and event['columns']['version'] != LATEST_VERSION and event['action'] == 'added') def title(event): return 'Osquery Version {} is Outdated'.format( event['columns'].get('versi...
25.076923
66
0.613497
[ "Apache-2.0" ]
designing-penguin/panther-analysis
osquery_rules/osquery_outdated.py
326
Python
"""An filter that removes operators based on regular expressions. """ from argparse import Namespace import logging import re import sys from cosmic_ray.config import load_config from cosmic_ray.work_db import WorkDB from cosmic_ray.work_item import WorkerOutcome, WorkResult from cosmic_ray.tools.filters.filter_app im...
29.647887
98
0.59905
[ "MIT" ]
Smirenost/cosmic-ray
src/cosmic_ray/tools/filters/operators_filter.py
2,105
Python
from userinput import userinput from ..utils import load_repository_author_name def get_package_author_name() -> str: """Return the package author name to be used.""" return userinput( name="python_package_author_name", label="Enter the python package author name to use.", default=load...
26.764706
61
0.648352
[ "MIT" ]
LucaCappelletti94/setup_python_package
setup_python_package/queries/get_package_author_name.py
455
Python
#!/usr/bin/env python # coding: utf-8 # # This code is based on torchvison resnet # URL: https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py import torch.nn as nn import torch.utils.model_zoo as model_zoo __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', ...
33.419643
102
0.599386
[ "MIT" ]
Kinpzz/RCRNet-Pytorch
libs/networks/resnet_dilation.py
7,486
Python
import unittest import numpy as np from overcooked_ai_py.agents.agent import AgentPair, FixedPlanAgent, GreedyHumanModel, RandomAgent, SampleAgent from overcooked_ai_py.mdp.actions import Direction, Action from overcooked_ai_py.mdp.overcooked_mdp import OvercookedGridworld, OvercookedState, PlayerState, ObjectState fr...
45.992453
139
0.6138
[ "MIT" ]
HelloN00bman/overcooked_ai
testing/agent_test.py
12,188
Python
from rest_framework import serializers from rest_framework.reverse import reverse from .models import Channel, Datasource, Value class ChannelSerializer(serializers.HyperlinkedModelSerializer): values = serializers.SerializerMethodField() latest = serializers.SerializerMethodField() def get_values(self...
30.22449
82
0.643484
[ "MIT" ]
City-of-Helsinki/hel-data-pipe
persister/observations/serializers.py
1,481
Python
import sympy from sympy import * def check_weak_prime(n): if not isprime(n): return(False) digits=[int(i) for i in str(n)] # For each digit location - test all other values to see if # the result is prime. If so - then this is not a weak prime for position in range(len(digits)): di...
28.594595
65
0.503781
[ "MIT" ]
rgc-retired/math_puzzles
bent/weakprime.py
1,058
Python
# Generated by Django 2.1.9 on 2020-03-20 00:50 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cmsplugin_blocks', '0003_slideitem_title'), ] operations = [ migrations.AlterField( model_name='al...
48.285714
258
0.646154
[ "MIT" ]
emencia/cmsplugin-blocks
cmsplugin_blocks/migrations/0004_change_image_as_filefield_.py
1,690
Python
""" ================================ Time-related feature engineering ================================ This notebook introduces different strategies to leverage time-related features for a bike sharing demand regression task that is highly dependent on business cycles (days, weeks, months) and yearly season cycles. I...
37.354293
97
0.733685
[ "BSD-3-Clause" ]
CastaChick/scikit-learn
examples/applications/plot_cyclical_feature_engineering.py
30,894
Python
import pytest def test_get(session, search_filter): from dispatch.search_filter.service import get t_search_filter = get(db_session=session, search_filter_id=search_filter.id) assert t_search_filter.id == search_filter.id def test_get_all(session, search_filters): from dispatch.search_filter.servic...
27.245902
81
0.737665
[ "Apache-2.0" ]
fiverr/dispatch
tests/search_filter/test_search_filter_service.py
1,662
Python
import dash from dash.dependencies import Input, Output from dash.exceptions import PreventUpdate import dash_core_components as dcc import dash_html_components as html import flask import time def test_llgo001_location_logout(dash_dcc): app = dash.Dash(__name__) @app.server.route("/_logout", methods=["POST"...
28.980392
85
0.656292
[ "MIT" ]
Joeyt1008/dash-core-components
tests/integration/location/test_location_logout.py
1,478
Python
from django.conf.urls import url from api.views import movie_views from api.views import auth_views from api.views import rating_views from api.views import recommend_views from api.views import collabo_test from api.views import content_based from api.algorithms import kmeansClustering urlpatterns = [ # user 접근 U...
49.156863
102
0.735142
[ "Apache-2.0" ]
BeautifulBeer/Youflix
django-vue/djangoAPI/api/urls.py
2,547
Python
"""HelloWorld Integration for Cortex XSOAR (aka Demisto) This integration is a good example on you can build a Cortex XSOAR Integration using Python 3. Please follow the documentation links below and make sure that your integration follows the Code Conventions and passes the Linting phase. Developer Documentation: ht...
38.937714
127
0.671319
[ "MIT" ]
DeanArbel/content
Packs/HelloWorld/Integrations/HelloWorld/HelloWorld.py
56,888
Python
# CMD import torch import torch.nn.functional as F import cv2 def calculate_psnr(img1, img2): """ data range [0, 1] """ img1 = img1.clamp(0, 1) img2 = img2.clamp(0, 1) mse = torch.mean((img1 - img2) ** 2, [1, 2, 3]) # if mse == 0: # return 100 PIXEL_MAX = 1 return 20 * to...
33.813433
117
0.609137
[ "MIT" ]
Wang-jiahao/SimDeblur
utils/metrics.py
4,531
Python
from __future__ import unicode_literals import frappe def execute(): frappe.rename_doc('DocType', 'Newsletter List', 'Email Group') frappe.rename_doc('DocType', 'Newsletter List Subscriber', 'Email Group Member')
35.833333
81
0.781395
[ "MIT" ]
07061999/frappe
frappe/patches/v7_0/rename_newsletter_list_to_email_group.py
215
Python
import json from lib import node from lib.generator import predicate_function from lib.generator import predicate_function_declaration with open("json/sundanese.json", "r") as stream: data = json.load(stream) nd = node.RootNode() for dat in data: nd.extend(dat, True) with open("dist/is_sundanese_unicos.h", "w...
26.15
69
0.772467
[ "MIT" ]
Tikubonn/unico
manual/unicos/src-groups/script/is_sundanese_unicos.py
523
Python
import sys import time import torch import random import argparse import numpy as np import torch.nn as nn import torchvision.transforms as transforms from torchvision import datasets from torch.utils.data import DataLoader # new # import torch.cuda.amp as amp def printParaNum(model): ''' function: pri...
41.4
130
0.580814
[ "MIT" ]
suiyizhao/Pytorch-speedup
src/train_amp.py
7,245
Python
import csnd6 # Import SPI library (for hardware SPI) and MCP3008 library. import Adafruit_GPIO.SPI as SPI import Adafruit_MCP3008 from random import randint, random import time # For Directory Searching import glob # Hardware SPI configuration: SPI_PORT = 0 SPI_DEVICE = 0 class RandomLine(object): ...
26.692857
104
0.628579
[ "MIT" ]
Airell/QB_Nebulae_V2
Code/tests/python_tests/nebulae_live.py
3,737
Python
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th...
31.442308
74
0.752905
[ "Apache-2.0" ]
benmcbenben/st2
contrib/runners/winrm_runner/winrm_runner/winrm_ps_command_runner.py
1,635
Python
import numpy as np import pandas as pd %matplotlib auto import matplotlib.pyplot as plt import seaborn as sns from sklearn.ensemble import RandomForestClassifier,ExtraTreesClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.preprocessing import StandardScaler from sklearn.model_selection import trai...
30.375
90
0.739712
[ "MIT" ]
Py-Contributors/Hands-on-Machine-learning-with-Scikit-learn-Tensorflow-and-Keras
AnomalyDetection/DB.py
1,944
Python
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
39.086331
80
0.683416
[ "Apache-2.0" ]
ekyuho/tensorflow
tensorflow/contrib/batching/python/ops/batch_ops.py
5,433
Python
''' #################################################################### # author wudong # date 20190816 # 在连续的puckworld空间中测试DDPG # 状态空间和行为空间连续 # 状态空间:x,y # 行为空间:水平和竖直方向上的力的大小[-1,1] # ps 不知道是计算机的原因还是算法的原因,训练不动 ###################################################################### ''' import gym from puckworld_continuo...
24.892857
73
0.625538
[ "Apache-2.0" ]
WoShiDongZhiWu/Reinforcement-learning-Algorithm
DDPG/test_ddpg_puckWorld.py
877
Python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This file contains code to serve a web application to convert HTML to PDF. This application uses a local install of the `wkhtmltopdf` binary for the conversion. """ import os from subprocess import check_output from tempfile import TemporaryDirectory from starlette.a...
25.714286
85
0.669444
[ "MIT" ]
mtik00/wkhtmltopdf-service
src/app.py
1,800
Python
import os import shutil import subprocess import sys from enum import Enum from PyQt5 import QtCore from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QMainWindow, QApplication, QListWidgetItem, QFileDialog, QComboBox, QMessageBox, \ QAbstractItemView, QDialogButtonBox, QLabel, QWidget, QPushButton, QListWi...
46.881326
123
0.654395
[ "MIT" ]
ackhoury/mbreplacer
mbreplacer.py
26,863
Python
File "test.py", line 15, in <module> print(find_lowest(a)) File "test.py", line 12, in find_lowest return lowest(lst[0], lst[1:]) File "test.py", line 9, in lowest return lowest(rest[0], rest[1:]) File "test.py", line 9, in lowest return lowest(rest[0], rest[1:]) File "test.py", line 13, in lowest return lo...
34.9375
62
0.697674
[ "MIT" ]
ALFA-group/neural-program-comprehension
Python_proficiency_test/latex/codes/17b.py
559
Python
""" This is the runner of the entire eva.jvc system. Version 1, the steps for the entire pipeline are as follows: 1. preprocessor -- get rep indices, save children metadata 2. encoder -- encode video by forcing i-frames (also modify the i-frame skip rate) 3. decoder -- using metadata, select the i-frames you want to ...
31.9375
122
0.716732
[ "Apache-2.0" ]
jaehobang/cs7643_project
eva_storage/jvc/jvc_runner_v2.py
2,044
Python
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os from spack import * class SspaceLongread(Package): """SSPACE-LongRead is a stand-alone program for scaffo...
33.972222
92
0.699918
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
0luhancheng0/spack
var/spack/repos/builtin/packages/sspace-longread/package.py
1,223
Python
class Jumble(object): def __init__(self): self.dict = self.make_dict() def make_dict(self): dic = {} f = open('/usr/share/dict/words', 'r') for word in f: word = word.strip().lower() sort = ''.join(sorted(word)) dic[sort] = word return dic def unjumble(self, lst): for ...
26.16129
49
0.59926
[ "MIT" ]
Nyapal/CS1.3
Code/word_jumble.py
811
Python
# -*- coding: utf-8 -*- # Resource object code # # Created: Mon Oct 15 12:53:43 2018 # by: The Resource Compiler for PySide (Qt v4.8.7) # # WARNING! All changes made in this file will be lost! from PySide import QtCore qt_resource_data = b"\x00\x006x\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\x00\x02|\x00\x...
6,411.863636
139,433
0.736958
[ "Apache-2.0" ]
mahyar-osn/mapclientplugins.parametricfittingstep
mapclientplugins/parametricfittingstep/resources_rc.py
141,061
Python
import unittest,os from src.tasks.scrape_reddit.tiktok import dwn_tiktok from src.tasks.generate_video.task import generate_tiktok from src.tasks.upload_video.task import upload_video class TestTiktok(unittest.TestCase): def setUp(self): pass def test_tiktok(self): context = { '...
37.346154
119
0.627188
[ "MIT" ]
lijemutu/auddit_extension
test/test_tiktok.py
971
Python
import os import pathlib from flask import Flask from flask import request from flask import redirect from flask import url_for from flask import session from flask import render_template from flask.json import jsonify from td.app.auth import FlaskTDAuth from configparser import ConfigParser # Define the templates f...
28.594203
109
0.696655
[ "MIT" ]
Aspire1Inspire2/td-ameritrade-python-api
td/oauth.py
3,946
Python
# Copyright 2015 Ciara Kamahele-Sanfratello # # 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...
36.727273
85
0.75
[ "Apache-2.0" ]
ciarakamahele/sasy
simulator/Planners/Planner.py
808
Python
"""Tests for queues.py""" import sys import unittest from unittest import mock import asyncio from .. import utils as test_utils class _QueueTestBase(test_utils.TestCase): def setUp(self): super().setUp() self.loop = self.new_test_loop() class QueueBasicTests(_QueueTestBase): def _test_rep...
28.861852
96
0.585967
[ "Apache-2.0", "MIT" ]
ProvoK/trio-asyncio
tests/python/test_queues.py
18,385
Python
from flask import jsonify, request from flask_restx import Resource, reqparse, fields, marshal_with import requests import redis import os import logging import time import datetime import json from app import api, db from models import User logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) user_fi...
34.302703
102
0.615663
[ "MIT" ]
pwegrzyn/pandemic-monitor
users-api/routes.py
6,346
Python
import time, calendar from datetime import datetime # # Decodes UNIX timestamp (UTC secs since epoch) to python datetime and vice versa. # class Time(datetime): def __new__(cls, *x): return datetime.__new__(cls, *x) @staticmethod def decode(json): assert isinstance(json, int) retur...
23.863636
82
0.659048
[ "BSD-3-Clause" ]
daxm/raritan-pdu-json-rpc
raritan/rpc/Time.py
525
Python
"""Module with git related utilities.""" import git class GitRepoVersionInfo: """ Provides application versions information based on the tags and commits in the repo """ def __init__(self, path: str): """ Create an instance of GitRepoVersionInfo :param path: The path to search...
37.45283
112
0.608564
[ "Apache-2.0" ]
giantswarm/step-exec-lib
step_exec_lib/utils/git.py
1,985
Python
# A very very minimal BeautifulSoup immitation. # # BS uses SGMLlib to parse, which converts everything to lower case. # This uses real xml parsing to mimic the parts of BS we use. import xml.dom.minidom def _getText(node): nodelist = node.childNodes rc = [] for node in nodelist: if node.nodeType ...
25.706767
85
0.497221
[ "Apache-2.0" ]
bbc/kamaelia
Sketches/RJL/bittorrent/BitTorrent/BitTorrent/BeautifulSupe.py
3,419
Python
from pdb import set_trace as TT import numpy as np import scipy from scipy.spatial import ConvexHull import skimage from skimage.morphology import disk import skbio global trg_image trg_image = None def diversity_calc(config): div_calc_name = config.FITNESS_METRIC return get_div_calc(div_calc_name) def get_div...
37.589912
225
0.687066
[ "MIT" ]
narendasan/neural-mmo
evolution/diversity.py
17,145
Python
""" The file contains the PPO class to train with. NOTE: All "ALG STEP"s are following the numbers from the original PPO pseudocode. It can be found here: https://spinningup.openai.com/en/latest/_images/math/e62a8971472597f4b014c2da064f636ffe365ba3.svg """ import gym import numpy as np import torch i...
40.42344
164
0.681444
[ "MIT" ]
britig/S2RL-Policies
ppoPolicyTraining.py
21,384
Python
import os from typing import Union, Tuple from torchtext._internal.module_utils import is_module_available from torchtext.data.datasets_utils import ( _wrap_split_argument, _create_dataset_directory, ) if is_module_available("torchdata"): from torchdata.datapipes.iter import FileOpener, GDriveReader, Iter...
34.486842
119
0.720336
[ "BSD-3-Clause" ]
abhinavarora/text
torchtext/datasets/amazonreviewpolarity.py
2,621
Python
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
30.753304
147
0.655064
[ "BSD-3-Clause" ]
ReconCell/smacha
smacha_ros/doc/conf.py
6,981
Python
# qubit number=4 # total number=32 import cirq import qiskit from qiskit.providers.aer import QasmSimulator from qiskit.test.mock import FakeVigo from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import ...
33.871795
140
0.651527
[ "BSD-3-Clause" ]
UCLA-SEAL/QDiff
benchmark/startQiskit_noisy1996.py
3,963
Python
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import from .data import DataIngestion __all__ = ['DataIngestion']
23.571429
63
0.787879
[ "BSD-3-Clause" ]
4QuantOSS/OpenDIGITS
plugins/data/bAbI/digitsDataPluginBAbI/__init__.py
165
Python
""" Methods for assessing treatment of finite-precision issues """ import os import sys import time import multiprocessing as mp import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.markers as mrk import plotter as ptr import rnn_fxpts as rfx import fxpt_experiments as fe import...
44.088496
163
0.616118
[ "MIT" ]
garrettkatz/rnn-fxpts
roundoff.py
19,928
Python
import pytest from selenium import webdriver from model.application import Application def pytest_addoption(parser): parser.addoption("--browser", action="store", default="firefox", help="browser type") parser.addoption("--base_url", action="store", default="http://localhost:9080/php4dvd/", help="base URL") ...
30.548387
109
0.711721
[ "Apache-2.0" ]
sargm/selenium-py-traning-barancev
php4dvd/conftest.py
947
Python
# name : Shoby Gnanasekaran # net id: shoby from dungeonchar import DungeonCharacter from healable import Healable from hero import Hero class Priestess(Hero, Healable): """ Priestess is a hero with it own statistics. The basic behaviour is same as the hero. Special ability is to heal everytime after taking ...
35.52
92
0.679054
[ "MIT" ]
nvanbaak/dungeon-adventure-2
priestess.py
888
Python
from django.contrib import admin from claims import models # Register your models here. admin.site.register(models.AddressCountry) admin.site.register(models.AddressRegion) admin.site.register(models.AddressCity) admin.site.register(models.ProjectStatus)
28.444444
42
0.839844
[ "Apache-2.0" ]
joinrpg/joinrpg
claims/admin.py
256
Python
api_key = '' seceret_key = '' passphrase = ''
11.5
16
0.608696
[ "Apache-2.0" ]
dy618i5ECC/cryptoquant
cryptoquant/api/okex/config.py
46
Python
#!/usr/bin/env python # Copyright (c) 2021 IBM Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, mod...
37.847826
80
0.746123
[ "MIT" ]
CMU-cabot/cabot
mf_localization_mapping/script/check_topic_size.py
1,741
Python
import pymysql class SQLHold(): def __init__(self, host: str, user: str, password: str, database: str, port=3306): self.db = pymysql.connect(host=host, user=user, port=port, database=database, password=password) self.cursor = self.db.cursor() def execute_command(self, command: str): s...
27.45
104
0.642987
[ "MIT" ]
kalenforn/video-context-analyze
Server/videoProcessServer/mysqlTools.py
549
Python