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 |
|---|---|---|---|---|---|---|---|---|
# Copyright 2016 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... | 32.08642 | 80 | 0.653713 | [
"MIT"
] | DPBayes/ADADP | CIFAR_tests/gaussian_moments.py | 10,396 | Python |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Serializer for the users object"""
class Meta:
model = get_user_model()
fields = (... | 30.875 | 74 | 0.646038 | [
"MIT"
] | siddharthisaiah/recipe-app-api | app/user/serializers.py | 1,729 | Python |
# coding: utf-8
"""
Memsource REST API
Welcome to Memsource's API documentation. To view our legacy APIs please [visit our documentation](https://wiki.memsource.com/wiki/Memsource_API) and for more information about our new APIs, [visit our blog](https://www.memsource.com/blog/2017/10/24/introducing-rest-apis... | 32.317073 | 421 | 0.744151 | [
"Apache-2.0"
] | unofficial-memsource/memsource-cli | test/test_project_workflow_step_dto_v2.py | 1,325 | Python |
#!/usr/bin/env python3
# ----------------------------------------------------------------------------
#
# Copyright 2018 EMVA
#
# 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://ww... | 33.96 | 82 | 0.563408 | [
"Apache-2.0"
] | willlewin/harvesters_gui | src/harvesters_gui/_private/frontend/pyqt5/device_list.py | 2,547 | Python |
"""Commonly used tensor functions."""
import math
from typing import Union, Optional
import tensorflow as tf
import numpy as np
from .factory import AbstractTensor
def binarize(tensor: tf.Tensor,
bitsize: Optional[int] = None) -> tf.Tensor:
"""Extract bits of values in `tensor`, returning a `tf.Tenso... | 30.787037 | 77 | 0.63218 | [
"Apache-2.0"
] | Arash-Afshar/tf-encrypted | tf_encrypted/tensor/shared.py | 3,325 | Python |
import sys
import utils
from statistics import Statistics
from connect import connect
import printer
from configloader import ConfigLoader
from rafflehandler import Rafflehandler
import rafflehandler
import OnlineHeart
import asyncio
from cmd import Cmd
def fetch_real_roomid(roomid):
if roomid:
real_r... | 31.94152 | 130 | 0.566459 | [
"MIT"
] | yjqiang/bilibili-live-tools | bili_console.py | 6,334 | Python |
import unittest
from _2015 import d22_wizard
class TestWizard(unittest.TestCase):
# damage, heal, acBonus, manaRecharge
def test_evaluateSpellEffects_effects_empty(self):
w = d22_wizard.Wizard(0, 0)
activeEffects = {}
effects = w._evaluateSpellEffects(activeEffects)
self.assert... | 38.346535 | 74 | 0.653757 | [
"Unlicense"
] | dcsparkes/adventofcode | test/test_wizard.py | 3,873 | Python |
import numpy as np
np.random.seed(0)
ADOPT = 0
OVERRIDE = 1
WAIT = 2
class Environment(object):
def __init__(self, mining_powers, gammas, T):
# relative mining strengths.
self.mining_powers = mining_powers
self.gammas = gammas
self.num_miners = len(mining_powers)
#... | 35.39759 | 102 | 0.62015 | [
"MIT"
] | michaelneuder/parkes_lab_fa19 | proof_of_work/multiagent/turn_based/v5/environmentv5.py | 2,938 | Python |
"""
Statistical tools for time series analysis
"""
from statsmodels.compat.python import (iteritems, range, lrange, string_types,
lzip, zip, long)
from statsmodels.compat.scipy import _next_regular
import numpy as np
from numpy.linalg import LinAlgError
from scipy import stats
f... | 35.16705 | 96 | 0.613776 | [
"BSD-3-Clause"
] | josef-pkt/statsmodels | statsmodels/tsa/stattools.py | 45,893 | Python |
"""
ASGI config for ecom project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS... | 22.647059 | 78 | 0.781818 | [
"BSD-3-Clause"
] | Limo-v/ecom | ecom/asgi.py | 385 | Python |
"""Tests for the smarttub integration."""
from datetime import timedelta
from openpeerpower.components.smarttub.const import SCAN_INTERVAL
from openpeerpower.util import dt
from tests.common import async_fire_time_changed
async def trigger_update(opp):
"""Trigger a polling update by moving time forward."""
... | 29 | 65 | 0.782328 | [
"Apache-2.0"
] | OpenPeerPower/core | tests/components/smarttub/__init__.py | 464 | Python |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 27.657895 | 74 | 0.747859 | [
"Apache-2.0"
] | AI-App/Polyaxon | src/tests/test_proxies/test_streams/test_main.py | 1,051 | Python |
"""This file contains utils for BEHAVIOR demo replay checkpoints."""
import json
import os
from igibson.objects.articulated_object import URDFObject
import pybullet as p
from igibson.utils.utils import restoreState
def save_task_relevant_state(env, root_directory, filename="behavior_dump"):
json_path = os.path.... | 36.947368 | 179 | 0.704179 | [
"MIT"
] | Learning-and-Intelligent-Systems/iGibson | igibson/utils/checkpoint_utils.py | 4,212 | Python |
import json
import re
import sys
from argparse import ArgumentParser, ArgumentTypeError
from enum import Enum
from pathlib import Path
from typing import Any, Iterable, List, NewType, Optional, Tuple, Union
import dataclasses
DataClass = NewType("DataClass", Any)
DataClassType = NewType("DataClassType", Any)
def st... | 60.105114 | 134 | 0.571773 | [
"Apache-2.0"
] | LinXueyuanStdio/KGE-toolbox | toolbox/KGArgsParser.py | 21,157 | Python |
"""
Class for package details.
"""
import json
from typing import Any, Dict, List
def _log_info(msg: str) -> None:
print(msg)
class PackageAPI:
"""Package API class
This class is used to hold the interface of a given package
being analyzed by doppel. It's comparison operators enable comparison
... | 28.666667 | 96 | 0.611047 | [
"BSD-3-Clause"
] | franklinen/doppel-cli | doppel/PackageAPI.py | 3,440 | Python |
import pytest
from werkzeug.datastructures import MultiDict
from wtforms import Form, validators
from wtforms import BooleanField, StringField
from app.model.components.helpers import form_fields_dict
def _form_factory(form_class):
def _create_form(**kwargs):
form = form_class(MultiDict(kwargs))
... | 26.927536 | 92 | 0.606028 | [
"MIT"
] | digitalservice4germany/steuerlotse | webapp/tests/model/components/test_helpers.py | 1,858 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.contrib.sites.models import Site
from django.core.exceptions import PermissionDenied
from django.utils.encoding import smart_text
from django.utils.translation import (
ugettext_lazy as _,
get_language,
)
fro... | 35.376923 | 84 | 0.602087 | [
"BSD-3-Clause"
] | rspeed/django-cms-contrib | cms/forms/wizards.py | 9,200 | Python |
# 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 writing, software
# d... | 39.883212 | 79 | 0.645864 | [
"Apache-2.0"
] | ePlusPS/tempest | tempest/scenario/orchestration/test_server_cfn_init.py | 5,464 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/client/dialogs/ssh_host_key.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
#... | 40.526316 | 154 | 0.755411 | [
"BSD-3-Clause"
] | tanc7/king-phisher | king_phisher/client/dialogs/ssh_host_key.py | 6,930 | Python |
"""
generate_data.py
Core script for generating training/test addition data. First, generates random pairs of numbers,
then steps through an execution trace, computing the exact order of subroutines that need to be
called.
"""
import pickle
import numpy as np
from tasks.bubblesort.env.trace import Trace
def genera... | 31.529412 | 98 | 0.679104 | [
"BSD-3-Clause"
] | ford-core-ai/neural-programming-architectures | tasks/bubblesort/env/generate_data.py | 1,072 | Python |
# Format of required info for batch runs.
debug = 0
AMQPdebug = 0
debugTimer = 0
simNotes = """
Step of load up 10%, Reff Enabled
"""
# Simulation Parameters Dictionary
simParams = {
'timeStep': 1.0,
'endTime': 60.0,
'slackTol': 1,
'PY3msgGroup' : 3,
'IPYmsgGroup' : 60,
'Hinput' : 0.0, # MW*se... | 34 | 84 | 0.66263 | [
"MIT"
] | thadhaines/PSLTDSim | testCases/sixMachine/sixMachineStep4.py | 1,156 | Python |
""" GIGATL experiment specifications
dimpart contains
- "netcdfdimnames": how to map netCDF to CROCO dimensions
- "domainpartition": which CROCO dimensions are tiled
"""
import os
import sys
import glob
from shapely.geometry.polygon import Polygon
import pickle
from pretty import BB
import pretty
import tempf... | 27.956989 | 97 | 0.587821 | [
"MIT"
] | Mesharou/paragridded | paragridded/giga_tools.py | 15,600 | Python |
"""Helper methods to handle the time in Home Assistant."""
import datetime as dt
import re
from typing import Any, Dict, List, Optional, Tuple, Union, cast
import pytz
import pytz.exceptions as pytzexceptions
import pytz.tzinfo as pytzinfo
from homeassistant.const import MATCH_ALL
DATE_STR_FORMAT = "%Y-%m-%d"
UTC = ... | 33.879032 | 87 | 0.64929 | [
"Apache-2.0"
] | 854562/home-assistant | homeassistant/util/dt.py | 12,603 | Python |
from cpu_element import CPU_element
from elements import Instruction_pointer
from tests.tools import set_signals
signals = ["address"]
result = "result"
def test_write_output():
source = CPU_element([], signals)
ip = Instruction_pointer(signals, [result])
assert isinstance(ip, CPU_element)
ip.connect... | 25.352941 | 47 | 0.723898 | [
"MIT"
] | chagulend/MIPS-Sim | src/tests/test_instruction_pointer.py | 431 | Python |
#!/usr/bin/python3
from subprocess import Popen, PIPE
import re
import argparse
import signal
import random
import socket
from collections import defaultdict
import sys
import subprocess
try:
import picamera
except ImportError:
subprocess.call([sys.executable, "-m", "pip", "install", "picamera"])
finally:
... | 38.295082 | 118 | 0.581978 | [
"MIT"
] | Ethan7102/FYP | other/gstreamcam.py | 4,672 | Python |
import os
from typing import Optional
from pytorchltr.utils.downloader import DefaultDownloadProgress
from pytorchltr.utils.downloader import Downloader
from pytorchltr.utils.file import validate_and_download
from pytorchltr.utils.file import extract_zip
from pytorchltr.utils.file import dataset_dir
from pytorchltr.da... | 51.145631 | 132 | 0.658314 | [
"MIT"
] | SuperXiang/pytorchltr | pytorchltr/datasets/svmrank/mslr10k.py | 5,268 | Python |
from setuptools import find_packages, setup
setup(
name="src",
packages=find_packages(),
version="0.3.0",
description="Estimating the impact of COVID policy on disease spread",
author="Global Policy Lab",
license="MIT",
)
| 22.454545 | 74 | 0.688259 | [
"MIT"
] | fergald/gpl-covid | code/setup.py | 247 | Python |
# -*- coding: utf-8 -*-
import zeit.wochenende.interfaces
import zeit.wochenende.testing
from zeit.cms.testcontenttype.testcontenttype import ExampleContentType
class SectionTest(zeit.wochenende.testing.FunctionalTestCase):
def test_zwe_ressort_content_is_zwe_content(self):
content = ExampleContentType()... | 35 | 74 | 0.744643 | [
"BSD-3-Clause"
] | rickdg/vivi | core/src/zeit/wochenende/tests/test_interfaces.py | 560 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os,glob
from setuptools import setup, find_packages
setup(
name = 'qcon',
version = '2.5',
scripts=['qcon/qcon.py'],
packages=['qcon'],
author = 'pawnhearts',
author_email = 'ph@kotchan.org',
description = """qcon is program for hiding... | 32.871795 | 113 | 0.673167 | [
"MIT"
] | pawnhearts/qcon | setup.py | 1,282 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Ricardo Ribeiro"
__credits__ = ["Ricardo Ribeiro"]
__license__ = "MIT"
__version__ = "0.0"
__maintainer__ = "Ricardo Ribeiro"
__email__ = "ricardojvr@gmail.com"
__status__ = "Development"
import pyforms.Utils.tools as tools
from PyQ... | 27.060606 | 75 | 0.68533 | [
"MIT"
] | sunj1/my_pyforms | pyforms/gui/Controls/ControlCheckBox.py | 1,786 | Python |
from django.urls import path
from . import views
urlpatterns = [
path('', views.post, name='post'),
path('post/<int:pk>/', views.detail, name='detail'),
path('post/new', views.new_post, name='new_post'),
path('post/<int:pk>/edit/', views.edit_post, name='edit_post'),
path('drafts/', views.draft_post, name='draft_... | 39.5 | 72 | 0.689873 | [
"Apache-2.0"
] | MiKueen/Django | bloggers/blog/urls.py | 474 | Python |
# Importamos testcase
from flask_testing import TestCase
# Importamos nuesra app desde el main de nuestra aplicacion
from main import app
from flask import current_app, url_for
# Creamos una nueva clase que se llama main test
class MainTest(TestCase):
# Creamos el metodo create app que retorna una aplicacion de f... | 42.191176 | 116 | 0.699895 | [
"MIT"
] | NicolasImplant/python-flask | tests/test_base.py | 2,870 | Python |
import codecs
from setuptools import setup
with codecs.open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(
name="shadowsocksr-cli",
version="2.1.1",
author="tyrantlucifer",
author_email="tyrantlucifer@gmail.com",
description="The command client of shadowsocksr",
u... | 30.833333 | 70 | 0.602027 | [
"MIT"
] | weakeng/ssr-command-client | setup.py | 1,480 | Python |
import re
import pygtrie as trie # type: ignore
from functools import reduce
__ALL__ = ('PrefixTokenizers', 'PrefixSearch')
class PrefixTokenizers:
# This string here is just an arbitrary long string so that
# re.split finds no matches and returns the entire phrase
ENTIRE_PHRASE = '::gooey/tokenizatio... | 29.438017 | 92 | 0.618754 | [
"MIT"
] | QuantumSpatialInc/Gooey | gooey/gui/components/filtering/prefix_filter.py | 3,562 | Python |
from chainer import backend
from chainer import function
from chainer import utils
from chainer.utils import type_check
class DeCov(function.Function):
"""DeCov loss (https://arxiv.org/abs/1511.06068)"""
def __init__(self, reduce='half_squared_sum'):
self.h_centered = None
self.covariance = ... | 33.89011 | 77 | 0.597601 | [
"MIT"
] | Anyz01/chainer | chainer/functions/loss/decov.py | 3,084 | Python |
def my_func1(x: int, y: int) -> int:
...
bit: BitVec[1]
myu32: BitVec[32]
myu64: BitVec[64]
| 12.25 | 36 | 0.591837 | [
"MIT"
] | MiguelMarcelino/py2many | tests/cases/smt_types.py | 98 | Python |
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu Nguyen" at 15:39, 20/04/2020 %
# ... | 46.318182 | 129 | 0.459274 | [
"MIT"
] | ElliottP-13/opfunu | opfunu/cec/cec2005/F8.py | 2,038 | Python |
from data.indicator.SE2.process import WB_computation_config, SDG_computation_config
| 42.5 | 84 | 0.894118 | [
"MIT"
] | simonzabrocki/Anticipe | data/indicator/SE2/__init__.py | 85 | 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... | 42.056122 | 88 | 0.711998 | [
"Apache-2.0"
] | 05259/tensorflow | tensorflow/python/debug/lib/source_remote_test.py | 8,243 | Python |
# authors_name = 'Preetham Ganesh'
# project_title = 'Multi Sensor-based Human Activity Recognition using OpenCV and Sensor Fusion'
# email = 'preetham.ganesh2015@gmail.com'
import numpy as np
import os
import pandas as pd
import itertools
import logging
import sklearn.pipeline
from sklearn.metrics import accuracy_sc... | 55.275 | 121 | 0.675959 | [
"MIT"
] | preetham-ganesh/multi-sensor-human-activity-recognition | codes/model_training_testing.py | 24,321 | Python |
import cv2
import keras
import math
import matplotlib.pyplot as plt
import numpy as np
import random
import warnings
from generators.utils import get_affine_transform, affine_transform
from generators.utils import gaussian_radius, draw_gaussian, gaussian_radius_2, draw_gaussian_2
class Generator(keras.utils.Sequence... | 43.223592 | 145 | 0.583479 | [
"Apache-2.0"
] | lbcsept/keras-CenterNet | generators/common.py | 24,551 | Python |
#https://leetcode.com/problems/reverse-linked-list/
# Iterative method
#Approach :
# Store the head in a temp variable called current .
# curr = head , prev = null
# Now for a normal linked list , the current will point to the next node and so on till null
# For reverse linked list, the current node should po... | 28.235294 | 121 | 0.638542 | [
"MIT"
] | 5l1v3r1/CompetitiveProgrammingQuestionBank | DSA 450 GFG/reverse_linked_list_iterative.py | 960 | Python |
# Generated by Django 2.2.8 on 2020-01-05 15:27
from django.db import migrations
import pyuploadcare.dj.models
class Migration(migrations.Migration):
dependencies = [
('awards', '0005_auto_20200104_1643'),
]
operations = [
migrations.AlterField(
model_name='projo_post',
... | 21.25 | 54 | 0.628235 | [
"MIT"
] | petermirithu/Grant_py | awards/migrations/0006_auto_20200105_1827.py | 425 | Python |
INFO = dict(
name='byecha',
description='Log dumper of Chatwork, inspired by goodbye_chatwork',
author='nothink',
author_email='nothing@yasagure.jp',
license='MIT License',
url='https://github.com/nothink/byecha',
classifiers=[
'Programming Language :: Python :: 3.5',
'Progra... | 30.6875 | 71 | 0.602851 | [
"MIT"
] | nothink/ByeCha | info.py | 491 | Python |
import numpy as np
import math
def Sphere(ind):
sum = 0
for i in ind:
sum += i**2
return sum
def Rastrigin(ind):
sum = 10 * len(ind)
for i in ind:
sum += i**2 - 10 * np.cos(2*np.pi*i)
return sum
def Rosenbrock(ind):
sum = 0
for i in range(len(ind) - 1):
sum += ... | 20.604651 | 66 | 0.479684 | [
"MIT"
] | ngctnnnn/Simulation_experiments_for_optimizing_objective_function | test_function.py | 886 | Python |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/03_models.base_models.ipynb (unless otherwise specified).
__all__ = ['MLBEndpointBase', 'MLBEndpointReference', 'CustomInt', 'PositionBase', 'PlayerHandedness', 'PersonBase',
'MLBPerson', 'Coordinates', 'TimeZone', 'VenueLocation', 'TurfType', 'RoofType', 'Fie... | 18.959064 | 116 | 0.638186 | [
"Apache-2.0"
] | schlinkertc/MLB_DataDevTools | MLB_DataDevTools/models/base_models.py | 3,242 | Python |
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from networks.embedding import *
from networks.encoder import *
from networks.selector import *
from networks.classifier import *
from .Model import Model
... | 29.263158 | 55 | 0.784173 | [
"MIT"
] | ningpang/com-CNN | PCNN+WA+PF/models/PCNN_ONE.py | 556 | Python |
import re
def validate_sheet_name(sheet_name):
if len(sheet_name) > 33:
return False
return not re.search("[%#&/\*\?\\\]", sheet_name)
def sanitise_sheet_name(sheet_name):
replaced_with_empty = ["%", "#", "&", "*", "?"]
replaced_with_hyphens = ["/", "\\"]
for ch in replaced_with_empty:
... | 25.368421 | 53 | 0.618257 | [
"MIT"
] | simkimsia/ug-read-write-excel-using-python | examples/c07_2_rename_validate_sheet_name/custom/index.py | 482 | Python |
import unicodedb_shim as unicodedb
from data import Position
class CStream(object):
def __init__(self, source, index=0, col=0, lno=1):
self.col = col
self.index = index
self.lno = lno
self.source = source
def advance(self):
c = self.current
self.index += 1
... | 23.982456 | 64 | 0.567666 | [
"MIT"
] | cheery/lever | compiler/lever_parser/reader/stream.py | 1,367 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# stdlib imports
import os.path
import re
# third party imports
import numpy as np
import pandas as pd
import pkg_resources
# Local imports
from gmprocess.metrics.station_summary import StationSummary
from gmprocess.core.stationstream import StationStream
from gmprocess.... | 33.483516 | 82 | 0.575648 | [
"Unlicense"
] | jrekoske-usgs/groundmotion-processing | tests/gmprocess/metrics/imt/fas_greater_of_two_test.py | 3,047 | Python |
import sys
import flask
from flask import Response, request, jsonify, send_file
from . import tagger
app = flask.Flask(__name__)
app.config['JSON_SORT_KEYS'] = False
app.url_map.strict_slashes = False
ROOT = '/spacy-ner'
@app.route(ROOT, methods=['GET'])
def home():
resp = Response(
response='{"endpoin... | 24.897436 | 99 | 0.623069 | [
"Apache-2.0"
] | BasLee/textrepo | elasticsearch/spacy-ner/py/app/router.py | 971 | Python |
import os
import nuke
import pyblish.api
import pype
class ExtractReviewData(pype.api.Extractor):
"""Extracts movie and thumbnail with baked in luts
must be run after extract_render_local.py
"""
order = pyblish.api.ExtractorOrder + 0.01
label = "Extract Review Data"
families = ["review"]
... | 34.132979 | 101 | 0.56475 | [
"MIT"
] | tws0002/pype | pype/plugins/nuke/publish/extract_review_data.py | 6,417 | Python |
"""
TODO docs
High-level commands to execute tasks
"""
from watsoncloud.foo.project_settings import *
from watsoncloud.foo.audio_video import *
from watsoncloud.foo.watson import *
from multiprocessing import Process
from os.path import exists
def init_project(video_filename):
# creates a project directory and ... | 28.831325 | 79 | 0.716674 | [
"MIT"
] | audip/youtubeseek | watsoncloud/foo/high.py | 2,393 | Python |
# coding=utf8
from __future__ import unicode_literals
import codecs
from pyecharts import (Bar, Scatter3D)
from pyecharts import Page
from pyecharts.conf import configure, online
from test.constants import RANGE_COLOR, CLOTHES
def create_three():
# bar
v1 = [5, 20, 36, 10, 75, 90]
v2 = [10, 25, 8, 60, 2... | 26.541667 | 78 | 0.614861 | [
"MIT"
] | RuanJylf/Data_Visualization | pyecharts-0.3.1/test/test_custom_render.py | 2,005 | Python |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
""" This module provides widgets for displaying plots of
scalar data assigned to one- and two-dime... | 38.052817 | 119 | 0.573332 | [
"Unlicense"
] | TreeerT/pymor | src/pymor/discretizers/builtin/gui/matplotlib.py | 10,807 | Python |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | 40.308861 | 80 | 0.651803 | [
"Apache-2.0"
] | IanCostello/data | scripts/world_bank/worldbank.py | 15,922 | Python |
#coding=utf-8
#
# Created on Apr 23, 2014, by Junn
#
#
import json
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from rest_framework.response import Response as RfResponse
from core import codes
import urllib
... | 30.745283 | 107 | 0.6278 | [
"MIT"
] | dlooto/driver-vision | apps/utils/http.py | 3,479 | Python |
#coding:utf-8
"""
@author : linkin
@email : yooleak@outlook.com
@date : 2018-11-07
"""
import asyncio
import datetime
async def send_async_http(session,method,url,*,
retries=1,
interval=1,
wait_factor=2,
... | 32.203125 | 89 | 0.54197 | [
"MIT"
] | 01ly/FooProxy | tools/async_tools.py | 2,375 | Python |
from django.test import TestCase, Client
from assertpy import assert_that
from rest_framework import status
from rest_framework.test import APIClient
from .factories import RecipeFactory, IngredientFactory
from ..models import Recipe
from ..serializers import RecipeSerializer
import factory
LIST_SIZE = 3
class Recip... | 41.161765 | 116 | 0.720972 | [
"MIT"
] | djensen47/recipe-api-django | src/recipes/tests/test_recipe_update.py | 2,799 | Python |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 36.130435 | 81 | 0.754513 | [
"Apache-2.0"
] | curlup/google-cloud-python | bigquery/samples/tests/test_client_query_batch.py | 831 | Python |
# Copyright 2015 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... | 40.065728 | 80 | 0.62374 | [
"Apache-2.0"
] | 1559603450/tensorflow | tensorflow/python/kernel_tests/batch_matmul_op_test.py | 8,534 | Python |
"""Here we define the exported functions, types, etc... which need to be
exported through a global C pointer.
Each dictionary contains name -> index pair.
Whenever you change one index, you break the ABI (and the ABI version number
should be incremented). Whenever you add an item to one of the dict, the API
needs to ... | 44.111111 | 78 | 0.476728 | [
"BSD-3-Clause"
] | MatthieuDartiailh/numpy | numpy/core/code_generators/numpy_api.py | 18,262 | Python |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import WebDriverException
import time
from django.test import LiveServerTestCase
MAX_WAIT = 10
class NewVisitorTest(LiveServerTestCase):
def setUp(self):
self.browser = webdriver.Firefox()
... | 40.428571 | 80 | 0.664973 | [
"MIT"
] | votatdat/obeythetestinggoat | functional_tests/tests.py | 4,528 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 by Murray Altheim. All rights reserved. This file is part
# of the Robot Operating System project, released under the MIT License. Please
# see the LICENSE file included as part of this package.
#
# author: Murray Altheim
# created: 2021-03-06
# ... | 35.768657 | 170 | 0.440851 | [
"MIT"
] | fanmuzhi/ros | lib/gps.py | 4,793 | Python |
import itertools
import sys
import time
import signal
from .fancycli import fancywait
from .fancycli.platform import isatty
def skipcallback(handler):
raise StopIteration
class ShellNextFrontend:
def __init__(self, use_status_line, show_toggle):
self.show_toggle = show_toggle
self.use_status... | 27.684932 | 113 | 0.557051 | [
"MIT"
] | TeemoKill/ArknightsAutoHelper | Arknights/shell_next.py | 10,465 | Python |
from dataloader import AmazonProductDataloader
from inverted_index import InvertedIndex
from utils import preprocess_text
import numpy as np
class BM25SearchRelevance:
def __init__(self, inverted_index, b=0.65, k1=1.6):
self.inverted_index = inverted_index
self.b = b
self.k1 = k1
se... | 46.971429 | 158 | 0.669708 | [
"MIT"
] | shahrukhx01/advanced-information-retrieval-tu-wien | lecture1/code/bm25_search_relevance.py | 1,644 | Python |
"""
Pre-defined query strategy for noisy oracles.
In reality, the labels given by human is not always correct. For one hand,
there are some inevitable noise comes from the instrumentation of experimental
setting. On the other hand, people can become distracted or fatigued over time,
introducing variability in the qual... | 40.476651 | 129 | 0.658736 | [
"BSD-3-Clause"
] | Houchaoqun/ALiPy | alipy/query_strategy/noisy_oracles.py | 25,140 | Python |
import komand
from .schema import LabelIssueInput, LabelIssueOutput
# Custom imports below
class LabelIssue(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name='label_issue',
description='Label Issue',
input=LabelIssueInput(),
out... | 26.74359 | 92 | 0.589645 | [
"MIT"
] | xhennessy-r7/insightconnect-plugins | jira/komand_jira/actions/label_issue/action.py | 1,043 | Python |
"""OAuth1 module written according to http://oauth.net/core/1.0/#signing_process"""
import base64
import hmac
import requests # requests must be loaded so that urllib receives the parse module
import time
import urllib
from hashlib import sha1
from six import b
from uuid import uuid4
use_parse_quote = not hasattr(ur... | 35.655462 | 116 | 0.679236 | [
"MIT"
] | bluefish6/Emailage_Python | emailage/signature.py | 4,243 | Python |
from numbers import Number
from typing import Dict, Sequence, Tuple, Union
import torch
from meddlr.transforms.base.spatial import (
AffineTransform,
FlipTransform,
Rot90Transform,
TranslationTransform,
)
from meddlr.transforms.build import TRANSFORM_REGISTRY
from meddlr.transforms.param_kind import P... | 35.926702 | 96 | 0.626639 | [
"Apache-2.0"
] | ad12/meddlr | meddlr/transforms/gen/spatial.py | 6,862 | Python |
from flask_restful import Resource
from tasks import add
class HelloResource(Resource):
def get(self):
add.delay(3, 5)
return {"msg": "get ok"}
| 13.076923 | 34 | 0.641176 | [
"Apache-2.0"
] | NeverLeft/FLASKTPP | App/apis/HelloApi.py | 170 | Python |
# This file is a part of ninfs.
#
# Copyright (c) 2017-2021 Ian Burgwin
# This file is licensed under The MIT License (MIT).
# You can find the full license text in LICENSE.md in the root of this project.
import logging
import time
from argparse import ArgumentParser, SUPPRESS
from errno import EROFS
from functools im... | 30.016086 | 112 | 0.602358 | [
"MIT"
] | Jhynjhiruu/ninfs | ninfs/mount/_common.py | 11,196 | Python |
"""
Copyright 2019 by Adam Lewicki
This file is part of the Game Theory library,
and is released under the "MIT License Agreement". Please see the LICENSE
file that should have been included as part of this package.
"""
import json
# ====================================================================================... | 37.909747 | 120 | 0.544805 | [
"MIT"
] | deadsmond/gametree | gametree_lite.py | 10,501 | Python |
# 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 writing, software
# distributed under the Li... | 28.699741 | 87 | 0.460151 | [
"Apache-2.0"
] | 001101/warehouse | tests/unit/malware/checks/setup_patterns/test_check.py | 33,263 | Python |
# Copyright 2013-2022 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)
from spack.package import *
class RNanotime(RPackage):
"""Nanosecond-Resolution Time Support for R.
Full 64-bit... | 48.65625 | 95 | 0.739242 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | jmellorcrummey/spack | var/spack/repos/builtin/packages/r-nanotime/package.py | 1,557 | Python |
#!/usr/bin/env python
"""This is the GRR frontend HTTP Server."""
import BaseHTTPServer
import cgi
import cStringIO
from multiprocessing import freeze_support
from multiprocessing import Process
import pdb
import socket
import SocketServer
import threading
import ipaddr
import logging
# pylint: disable=unused-i... | 31.814815 | 80 | 0.669642 | [
"Apache-2.0"
] | strcrzy/grr | tools/http_server.py | 7,731 | Python |
import re
from typing import Set, Any, List
from sequal.amino_acid import AminoAcid
from sequal.modification import Modification, ModificationMap
from copy import deepcopy
import itertools
from json import dumps
mod_pattern = re.compile(r"[\(|\[]+([^\)]+)[\)|\]]+")
mod_enclosure_start = {"(", "[", "{"}
mod_enclosure_e... | 39.637394 | 182 | 0.583905 | [
"MIT"
] | bschulzlab/dialib_standalone | sequal/sequence.py | 13,992 | Python |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 5 17:37:31 2017
@author: Flame
"""
from TuringMachine import Rule, Q, Move, TuringMachine, Tape
from TuringMachine import EMTY_SYMBOL as empty
def check(input_str):
rules= \
[
Rule(Q(1),'1',Q(1),'1', Move.Right),# приводим к первоначальному виду
... | 38.9 | 128 | 0.535347 | [
"MIT"
] | KarpenkoDenis/TuringMachine | main.py | 1,808 | 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 ... | 37.84127 | 78 | 0.599832 | [
"MIT"
] | JonathanGailliez/azure-sdk-for-python | azure-keyvault/azure/keyvault/v2016_10_01/models/secret_bundle.py | 2,384 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import traceback
from flask import current_app, render_template
from flask import make_response
from flask.json import jsonify
from ooniapi.auth import auth_b... | 33.204082 | 88 | 0.734788 | [
"BSD-3-Clause"
] | hellais/ooni-measurements | newapi/ooniapi/views.py | 3,254 | Python |
from .elektra5585 import Elektra5585, Elektra5585Line
| 27 | 53 | 0.87037 | [
"Apache-2.0"
] | CiscoDevNet/firepower-kickstart | kick/device2/elektra5585/actions/__init__.py | 54 | Python |
import os
import sys
import subprocess
CondylesFeaturesExtractor = "/Users/prisgdd/Documents/Projects/CNN/CondylesFeaturesExtractor-build/src/bin/condylesfeaturesextractor"
parser = argparse.ArgumentParser()
parser.add_argument('-meshDir', action='store', dest='meshDir', help='Input file to classify',
... | 29.185185 | 133 | 0.739848 | [
"Apache-2.0"
] | pdedumast/CondylesClassification | src/runCondylesFeaturesExtractor.py | 1,576 | Python |
import torch
import torch.nn as nn
from .mol_tree import Vocab, MolTree
from .nnutils import create_var
from .jtnn_enc import JTNNEncoder
from .jtnn_dec import JTNNDecoder
from .mpn import MPN, mol2graph
from .jtmpn import JTMPN
from .chemutils import enum_assemble, set_atommap, copy_edit_mol, attach_mols, atom_equal,... | 40.739884 | 144 | 0.62124 | [
"MIT"
] | samgoldman97/icml18-jtnn | jtnn/jtnn_vae.py | 14,096 | Python |
# This code is heavily inspired from https://github.com/fangwei123456/PixelUnshuffle-pytorch
import torch
import torch.nn as nn
import torch.nn.functional as F
def pixel_unshuffle(input, downscale_factor):
'''
input: batchSize * c * k*w * k*h
downscale_factor: k
batchSize * c * k*w * k*h -> batchSize ... | 36.272727 | 113 | 0.643275 | [
"MIT"
] | laowng/GISR | src/model/PixelUnShuffle.py | 1,197 | Python |
import itertools
import logging
import os.path as osp
import tempfile
import mmcv
import numpy as np
from mmcv.utils import print_log
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from terminaltables import AsciiTable
from mmdet.core import eval_recalls
from .builder import DATASETS
from... | 41.793372 | 79 | 0.528871 | [
"Apache-2.0"
] | invite-you/mmdetection | mmdet/datasets/coco_car.py | 21,440 | Python |
from IMDB_task4 import scrape_movie_details
from pprint import pprint
import os,requests,json,time,random
from IMDB_task1 import scrape_top_list
# task13
# this task for the make a json file ini our directory
def save_data():
movies_data = scrape_top_list()
for one_movie in movies_data :
id_movie = (one_movie['urls... | 34.064516 | 75 | 0.688447 | [
"MIT"
] | amansharmma/IMDB-movie-scraper | IMDB_task8.py | 1,056 | Python |
#
# Copyright (c) 2015-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import six
from nfv_common.helpers import Constant
from nfv_common.helpers import Constants
from nfv_common.helpers import Singleton
@six.add_metaclass(Singleton)
class NfviErrorCodes(Constants):
"""
NFVI - Error C... | 20.333333 | 50 | 0.747951 | [
"Apache-2.0"
] | SidneyAn/nfv | nfv/nfv-vim/nfv_vim/nfvi/_nfvi_defs.py | 488 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-06-17 14:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('book', '0001_initial'),
]
operations = [
migrations.AddField(
m... | 33.516129 | 165 | 0.599615 | [
"Apache-2.0"
] | LennonChin/Blog-Back-Project | apps/book/migrations/0002_auto_20180617_2210.py | 1,135 | Python |
from django.apps import AppConfig
class LibookapiConfig(AppConfig):
name = 'libookapi'
| 15.5 | 33 | 0.763441 | [
"Apache-2.0"
] | sjtu-libook/libook | libookapi/apps.py | 93 | Python |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from filer.models.imagemodels import Image
from fractions import Fraction
import exifread
class ExifData(models.Model):
class Meta:
verbose_name = _('EXIF Data')
verbose_name_plural = _('EXIF data')
image = m... | 30.349515 | 83 | 0.53039 | [
"MIT"
] | svenhertle/django_image_exif | image_exif/models.py | 3,126 | Python |
from decimal import Decimal
import logging
from django.core.exceptions import ImproperlyConfigured
from suds import WebFault
from suds.transport import TransportError
import vatnumber
import stdnum
from plans.taxation import TaxationPolicy
logger = logging.getLogger('plans.taxation.eu.vies')
class EUTaxationPolicy(T... | 39.066116 | 112 | 0.579437 | [
"MIT"
] | ShreeshaRelysys/django-plans | plans/taxation/eu.py | 4,727 | Python |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
##############################################################################
# Copyright 2020 AlexPDev
#
# 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 Lice... | 33.152941 | 78 | 0.683996 | [
"Apache-2.0"
] | alexpdev/Torrentfile-GUI | tests/test_checktab.py | 5,636 | Python |
"""Internal Exception classes used by package
These classes subclass the base Exception class
Classes
_______
MissingPortException(Exception)
SerialReadException(Exception)
UnknownConfirmationCodeException(Exception)
"""
class MissingPortException(Exception):
"""
Exception raised when the port param is mis... | 22.888889 | 70 | 0.786408 | [
"MIT"
] | cerebrohivetech/adafruit-fingerprint | adafruit_fingerprint/exceptions.py | 618 | Python |
"""Python Compatibility Utilities."""
from __future__ import annotations
import numbers
import sys
from contextlib import contextmanager
from functools import wraps
try:
from importlib import metadata as importlib_metadata
except ImportError:
# TODO: Remove this when we drop support for Python 3.7
import... | 24.57554 | 75 | 0.592799 | [
"BSD-3-Clause"
] | CountRedClaw/kombu | kombu/utils/compat.py | 3,416 | Python |
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ model.py ]
# Synopsis [ the 1-hidden model ]
# Author [ S3PRL ]
# Copyright [ Copyleft(c), Speech Lab, NTU, Taiwan ]
"""************************************... | 35.370968 | 103 | 0.574099 | [
"MIT"
] | AmirHussein96/Self-Supervised-Speech-Pretraining-and-Representation-Learning | downstream/libri_phone/model.py | 2,193 | Python |
# Copyright 2013-2022 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)
from spack import *
class PyBiopandas(PythonPackage):
"""Working with molecular structures in pandas DataFrames"""
... | 33.653846 | 73 | 0.674286 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | Bambi/spack | var/spack/repos/builtin/packages/py-biopandas/package.py | 875 | Python |
from pprint import pprint
import re
import pexpect
import yaml
def cisco_send_show_command(host, username, password, enable_pass, command):
with pexpect.spawn(f"ssh {username}@{host}", encoding="utf-8") as ssh:
ssh.expect("[Pp]assword")
ssh.sendline(password)
ssh.expect(">")
ssh.s... | 26.785714 | 77 | 0.532444 | [
"MIT"
] | levs72/pyneng-examples | ssh_telnet/pexpect/ex06_ssh_pexpect_show_with_paging.py | 1,125 | Python |
import argparse
import shutil
import sys
import time
from datetime import timedelta
from pathlib import Path
import torch
from openunreid.apis import BaseRunner, test_reid
from openunreid.core.solvers import build_lr_scheduler, build_optimizer
from openunreid.data import build_test_dataloader, build_train_dataloader
... | 27.813793 | 88 | 0.666997 | [
"Apache-2.0"
] | gwanglee/OpenUnReID | tools/UDA_TP/main.py | 4,033 | 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... | 35.823077 | 80 | 0.684131 | [
"Apache-2.0"
] | 2017qiuju/tensorflow | tensorflow/contrib/framework/python/ops/sort_ops_test.py | 4,657 | Python |
import gflags
import sys
import torch
from spinn.util.misc import recursively_set_device
FLAGS = gflags.FLAGS
def convert(inpt, outp, gpu=-1):
ckpt = torch.load(inpt)
if gpu < 0:
ckpt['model_state_dict'] = {k: v.cpu() for k, v in ckpt['model_state_dict'].items()}
else:
ckpt['model_state... | 26 | 93 | 0.666209 | [
"Apache-2.0"
] | NYU-CDS-Capstone-Project/Betelgeuse_SPINN | scripts/convert_ckpt.py | 728 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.