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 |
|---|---|---|---|---|---|---|---|---|
# encoding: utf-8
import datetime
import uuid
import logging
from sqlalchemy.orm import class_mapper
from six import string_types
import ckan.lib.dictization as d
import ckan.lib.helpers as h
import ckan.authz as authz
log = logging.getLogger(__name__)
def resource_dict_save(res_dict, context):
model = context... | 33.578352 | 92 | 0.637864 | [
"Apache-2.0"
] | NP-compete/ckan | ckan/lib/dictization/model_save.py | 20,785 | Python |
""" ************************************************
* fileName: train.py
* desc: The training file for SimDeblur,
pay much attention to your constructed configs.
* author: mingdeng_cao
* date: 2021/07/14 17:26
* last revised: Reformat the file
************************************************ """
from simdebl... | 23.896552 | 60 | 0.613276 | [
"MIT"
] | Wang-jiahao/SimDeblur | train.py | 693 | Python |
answer = input ("Would you like to play?")
if answer.lower().strip() == "yes":
print ("Yay! Let's get started.")
answer = input ("You have reached an apple tree, would you like to pick an apple?").lower ().strip()
if answer == "yes":
answer = input ("would you like to eat the apple?")
if ... | 33.285714 | 131 | 0.562232 | [
"MIT"
] | sabdllah/03-Text-adventure | game.py | 932 | Python |
import operator
import os
from collections import OrderedDict
from pandas import DataFrame
from cave.analyzer.parameter_importance.base_parameter_importance import BaseParameterImportance
class Fanova(BaseParameterImportance):
"""
fANOVA (functional analysis of variance) computes the fraction of the varianc... | 49.067797 | 120 | 0.604836 | [
"BSD-3-Clause"
] | automl/CAVE | cave/analyzer/parameter_importance/fanova.py | 5,790 | Python |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... | 40.37037 | 146 | 0.544495 | [
"Unlicense",
"MIT"
] | amcclead7336/Enterprise_Data_Science_Final | venv/lib/python3.8/site-packages/vsts/release/v4_1/models/release_task_attachment.py | 2,180 | Python |
try:
from maya import cmds
except ImportError:
pass
from menus import typeIDs as nem_typeids, base as nem_base
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
def createOutputJnts(*args):
## Create outputs for the selected hermite nodes
exitB = "Exit"
doitB = "doIt"
i... | 37.490196 | 109 | 0.625 | [
"Apache-2.0"
] | fsanges/neMenuManager | menus/nodes/hermite.py | 1,912 | 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
# ... | 41.965109 | 79 | 0.577625 | [
"Apache-2.0"
] | openstack/heat | heat/tests/test_stack.py | 131,099 | Python |
import sys
import traceback
from socket import error
from gevent.pywsgi import WSGIServer
from socketio.handler import SocketIOHandler
from socketio.policyserver import FlashPolicyServer
from socketio.virtsocket import Socket
from geventwebsocket.handler import WebSocketHandler
__all__ = ['SocketIOServer']
class ... | 35.172775 | 78 | 0.601221 | [
"BSD-3-Clause"
] | jykim16/gevent-socketio | socketio/server.py | 6,718 | Python |
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
# Created by vikey on 2018/2/17
from __future__ import print_function
from __future__ import unicode_literals
def main():
pass
if __name__ == "__main__":
main()
| 14.6 | 39 | 0.707763 | [
"Apache-2.0"
] | chenyuanqi/python-training | src/day_16/src/models/__init__.py | 219 | Python |
import random
from time import sleep
def Guess():
global attempts
# If the user choose anything but a number between 0 and 10, they will get stuck in loop.
while True:
try:
attempts += 1 # This will count every attempt made by the user
user_number = int(input().replace(' '... | 36.457944 | 127 | 0.5596 | [
"MIT"
] | Kaique-Apolinario/Python-projects | Python Projects/A Number Guesser(2 modes).py | 3,902 | Python |
# coding=utf-8
import sys
import traceback
import numpy as np
import os
import Putil.base.logger as plog
plog.PutilLogConfig.config_file_handler(filename='./test/data/_log_test_common_data_multiprocess.log', mode='w')
plog.PutilLogConfig.config_log_level(stream=plog.INFO, file=plog.DEBUG)
plog.PutilLogConfig.config_fo... | 29.225564 | 112 | 0.621045 | [
"Apache-2.0"
] | balde-soul/Putil | test/data/test_common_data_multiprocess.py | 3,887 | Python |
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
import time
from tensorflow.keras.layers import Input, Dense, Flatten, Conv1D, MaxPooling1D, UpSampling1D, BatchNormalization, Reshape
from tensorflow.keras.models import Model, Sequential
from tensorflow.keras.callbacks import TensorBoar... | 38 | 153 | 0.544002 | [
"MIT"
] | csepreghy/spectral-analysis | spectral_analysis/unsupervised_learning/autoencoder/autoencoder_bestmodel.py | 9,389 | Python |
# -*- coding: utf-8 -*-
"""
Django settings for server project.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their config, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
from typing import Tuple
from server.settings.c... | 26.30303 | 72 | 0.698387 | [
"MIT"
] | FrolovIlya78/wemake-django-template | {{cookiecutter.project_name}}/server/settings/components/common.py | 4,340 | Python |
from setuptools import find_packages, setup
setup(
name='qualprep',
packages=find_packages(include=['qualprep']),
version='0.1.1',
description='Python library to prepare data',
author='Lena Berger',
license='MIT',
install_requires=['pandas', 'numpy', 'tqdm'],
setup_requires=['... | 28.714286 | 50 | 0.641791 | [
"BSD-2-Clause"
] | berglen/qualprep | setup.py | 402 | Python |
from puq import *
import numpy as np
# test case with just a single point
def run():
# Declare our parameters here. Both are uniform on [-2, 2]
x = UniformParameter('x', 'x', min=-2, max=2)
y = UniformParameter('y', 'y', min=-2, max=2)
# Create a host
host = InteractiveHost()
# any of these ... | 23.590909 | 62 | 0.597303 | [
"MIT"
] | zoidy/puq | examples/simple_sweep/rosen_1.py | 519 | Python |
# import datetime, time
from typing import List
from datetime import datetime, timedelta
import pytz
import os
from puffmarker.domain.datapoint import DataPoint
from puffmarker.input.import_stream_processor_inputs import load_data, load_data_offset
data_dir = '/home/nsaleheen/data/rice_ema_puffmarker_activity_loc/'
# ... | 36.25784 | 148 | 0.591486 | [
"MIT"
] | nsaleheen/puffmarker_plus_plus | puffmarker/input/import_RICE_pilot_data.py | 10,406 | Python |
def get_min_max(ints):
"""
Return a tuple(min, max) out of list of unsorted integers.
Args:
ints(list): list of integers containing one or more integers
"""
# Handle non-list input
if not isinstance(ints, list):
return None, None
# Define variables for min and max value and... | 26.644068 | 67 | 0.636768 | [
"MIT"
] | johangenis/problems_vs_algorithms | problem_6.py | 1,572 | Python |
from bravado_core.request import IncomingRequest, unmarshal_request
from bravado_core.swagger20_validator import ValidationError
from .support import OpenAPITest
class OpenAPIRequestsValidationTest(OpenAPITest):
def setUp(self):
super().setUp()
self.request = IncomingRequest()
self.reque... | 34.870968 | 99 | 0.557046 | [
"Apache-2.0"
] | dreuse/kinto | tests/openapi/test_validation.py | 6,486 | Python |
def calculate_critical_value(size : int, alpha : float) -> float:
t_dist = stats.t.ppf(1 - alpha / (2 * size), size - 2)
numerator = (size - 1) * np.sqrt(np.square(t_dist))
denominator = np.sqrt(size) * np.sqrt(size - 2 + np.square(t_dist))
critical_value = numerator / denominator
print("Grubbs... | 55.857143 | 72 | 0.659847 | [
"Apache-2.0"
] | bharathjinka09/docly-demo | script_2.py | 391 | Python |
"""
Visualizing bidirectionnal Dijkstra
using matplotlib
"""
import sys
from dataclasses import dataclass
from heapq import heappush, heappop
from itertools import permutations
from collections import defaultdict
import matplotlib
from matplotlib import pyplot as plt
import matplotlib.animation as animation
from dijkst... | 28.38796 | 112 | 0.521206 | [
"MIT"
] | colon3ltocard/pythonalgorithms | bidir_dijkstra.py | 8,488 | Python |
'''Deoxyribonucleic acid (DNA) is a chemical found in the nucleus
of cells and carries the "instructions" for the development and functioning of living organisms.
If you want to know more http://en.wikipedia.org/wiki/DNA
In DNA strings, symbols "A" and "T" are complements of each other,
as "C" and "G". You have functi... | 41 | 96 | 0.698331 | [
"MIT"
] | Thearakim/warcode | DNA.py | 779 | Python |
import os
import time
import sys
total = 0.0
N = 10001 # number of cases (seeds) to test
for seed in range(1,N):
#vis_command = "java TerrainCrossingVis -exec \"/home/dawid/TopCoder/TerrainCrossing/./TerrainCrossing\" -novis -seed "
vis_command = "java TerrainCrossingVis -exec \"$PWD/./TerrainCrossing\" -no... | 26.90625 | 123 | 0.630662 | [
"MIT"
] | diwadd/TerrainCrossing | testing_solution.py | 861 | Python |
from django.urls import path
from .views import Index, language_switch
app_name = 'portfolio'
urlpatterns = [
path('', Index.as_view(), name='index'),
path('switch-lang/<str:lang>/', language_switch, name='switch-lang'),
]
| 25.777778 | 73 | 0.698276 | [
"MIT"
] | mahdimehrabi/django-portfolio-app | project/apps/portfolio/urls.py | 232 | Python |
import keras.backend as K
from keras.models import Model
from keras.layers import Dense, MaxPooling2D, Conv2D, Activation, \
Dropout, Reshape, Input, BatchNormalization, GRU, Bidirectional, Permute, TimeDistributed
from keras.optimizers import Adam, SGD, Adadelta, RMSprop
import src.model.mfom as mfom
import src.mo... | 39.352941 | 122 | 0.603222 | [
"MIT"
] | Vanova/mfom_attribute_detection | src/model/sed_ogits.py | 6,021 | Python |
from core import Symbol
_latin = list('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
# COSINEQ should not be imported as they clash
_greek = 'alpha beta gamma delta epsilon zeta eta theta iota kappa '\
'mu nu xi omicron pi rho sigma tau upsilon phi chi psi omega'.split(' ')
for _s in _latin + _greek:
e... | 31.583333 | 74 | 0.728232 | [
"BSD-3-Clause"
] | fperez/sympy | sympy/abc.py | 379 | Python |
# Generated by Django 3.1.5 on 2021-02-25 11:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cluster', '0001_initial'),
('manager', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='director',
... | 23.05 | 96 | 0.607375 | [
"Apache-2.0"
] | allegro/vaas | vaas-app/src/vaas/manager/migrations/0002_auto_20210225_1216.py | 461 | Python |
# Copyright (c) 2020 PaddlePaddle 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 appli... | 39.283237 | 80 | 0.657004 | [
"Apache-2.0"
] | 0x45f/Paddle | python/paddle/fluid/tests/unittests/test_fleet_recompute_meta_optimizer.py | 6,796 | Python |
__author__ = 'noam'
| 10 | 19 | 0.7 | [
"BSD-3-Clause"
] | noamkatzir/palm-hand-reading | tests/__init__.py | 20 | Python |
name = input().split()
print(name[0], name[1]*(len(name[1]) if len(name[1])!=5 else 4)) | 44 | 64 | 0.602273 | [
"BSD-3-Clause"
] | nithinmanne/kattis | The Noble Houses of Apaxia/noble.py | 88 | Python |
import re
import pandas as pd
import requests
from lxml import html as lhtml
from fake_useragent import UserAgent
import logging
WS_TO_STR = 0
WS_SRC = 1
WS_PATH = 2
WS_CACHE = 3
class WebParse:
websource = {
# Readable Source unique path caching
... | 34.945525 | 111 | 0.512137 | [
"MIT"
] | neilc7/ValDashboard | src/webparse.py | 17,962 | Python |
def identity(x):
return x
def always_false(x):
return False
def always_true(x):
return True
def add(x, y):
return x + y
| 9.466667 | 20 | 0.612676 | [
"MIT"
] | apragacz/functoolsplus | tests/functions.py | 142 | Python |
from typing import Optional
from pyspark.sql import Column, DataFrame
from pyspark.sql.functions import from_unixtime, to_timestamp
from spark_auto_mapper.data_types.data_type_base import AutoMapperDataTypeBase
from spark_auto_mapper.helpers.value_parser import AutoMapperValueParser
from spark_auto_mapper.type_defini... | 33.918367 | 109 | 0.661252 | [
"Apache-2.0"
] | icanbwell/SparkAutoMapper | spark_auto_mapper/data_types/unix_timestamp.py | 1,662 | Python |
import numpy as np
import pickle
def unique(seq):
seen = set()
seen_add = seen.add
return [x for x in seq if not (x in seen or seen_add(x))]
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def softmax(x, temperature=1.0):
exp_x = np.exp(x / temperature)
return exp_x / np.sum(exp_x)
class TextRNN... | 31.807163 | 150 | 0.529188 | [
"MIT"
] | KingPixil/gram-rnn | gru.py | 11,546 | Python |
#
# PySNMP MIB module HUAWEI-RSVPTE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-RSVPTE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:36:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | 149.703846 | 12,243 | 0.770675 | [
"Apache-2.0"
] | agustinhenze/mibs.snmplabs.com | pysnmp/HUAWEI-RSVPTE-MIB.py | 77,846 | Python |
#!/usr/bin/env python
from setuptools import setup
setup(name='BnW',
version='0.1',
description='Microblogging service',
author='Stiletto',
author_email='blasux@blasux.ru',
url='http://github.com/stiletto/bnw',
packages=['bnw', 'bnw.core', 'bnw.formatting', 'bnw.handlers', 'bnw.scripts', 'bnw.... | 44.807692 | 183 | 0.615451 | [
"BSD-2-Clause"
] | stiletto/bnw | setup.py | 1,165 | Python |
import logging
from robot.api import logger
from robot.libraries.BuiltIn import BuiltIn
from simple_salesforce import Salesforce
from cumulusci.cli.config import CliRuntime
from cumulusci.core.config import TaskConfig
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.core.tasks import CURRENT_TASK... | 38.509346 | 109 | 0.62638 | [
"BSD-3-Clause"
] | jdominiczak/CumulusCI | cumulusci/robotframework/CumulusCI.py | 8,241 | 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... | 34.05 | 84 | 0.769457 | [
"Apache-2.0"
] | Explorer1092/aliyun-openapi-python-sdk | aliyun-python-sdk-vpc/aliyunsdkvpc/request/v20160428/ModifyEipAddressAttributeRequest.py | 2,724 | Python |
import os
#
# path and dataset parameter
#
#该cfg文件,是通过import的方式进行配置的。并不是main的arg配置
DATA_PATH = 'data'
PASCAL_PATH = os.path.join(DATA_PATH, 'pascal_voc')
CACHE_PATH = os.path.join(PASCAL_PATH, 'cache')
OUTPUT_DIR = os.path.join(PASCAL_PATH, 'output')
WEIGHTS_DIR = os.path.join(PASCAL_PATH, 'weights')
WEIGHTS_FILE... | 14.012821 | 71 | 0.670631 | [
"MIT"
] | banayoyo/yolo | yolo/config.py | 1,137 | Python |
import os
import matplotlib as mpl
import torch
from data_management import Jitter, load_dataset
from networks import IterativeNet, UNet
from operators import TVAnalysis, get_tikhonov_matrix
# --- load configuration -----
import config # isort:skip
# ----- general setup -----
mpl.use("agg")
device = torch.device(... | 26.814516 | 77 | 0.616241 | [
"MIT"
] | jmaces/robust-nets | tvsynth/script_train_unet_it_tikh_jitter.py | 3,325 | Python |
N = int(input())
line = []
for a in range(N):
line.append(int(input()))
total = 0
curIter = 1
while min(line) < 999999:
valleys = []
for a in range(N):
if line[a] < 999999:
if (a == 0 or line[a] <= line[a - 1]) and (a == N - 1 or line[a] <= line[a + 1]):
valleys.append... | 20.904762 | 93 | 0.503417 | [
"MIT"
] | MatiwsxD/ayed-2019-1 | labinfo13/Candies.py | 439 | Python |
"""
Tests meant to be run with pytest
"""
import sys
import os
import pytest
from moviepy.editor import *
from moviepy.video.tools.interpolators import Trajectory
import sys
sys.path.append("tests")
import download_media
from test_helper import PYTHON_VERSION, TMP_DIR, TRAVIS
def test_download_media(capsys):
w... | 27.77551 | 79 | 0.630051 | [
"Apache-2.0"
] | L0dz/auto-post | env/Lib/site-packages/tests/test_PR.py | 2,722 | Python |
import cv2
import matplotlib.pyplot as plt
import numpy as np
img= cv2.imread("img.png")
img=cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.axis('off')
# show the image
plt.imshow(img)
plt.show()
# get the image shape
rows, cols, dim = img.shape
rows, cols, dim = img.shape
# transformation matrix for Shearing
# shearing app... | 27.424242 | 76 | 0.658564 | [
"MIT"
] | Payal197bhadra/ComputerVision | OpenCV-Computer-Vision-Examples-with-Python-A-Complete-Guide-for-Dummies-master/Source Code/opencv/Affine Transformation/shearing.py | 905 | Python |
from dataclasses import dataclass, field
from typing import Dict, Optional
@dataclass
class FooType:
class Meta:
name = "fooType"
foo_ele1: Optional[str] = field(
default=None,
metadata={
"name": "fooEle1",
"type": "Element",
"namespace": "",
... | 19.285714 | 45 | 0.479259 | [
"MIT"
] | tefra/xsdata-w3c-tests | output/models/ms_data/complex_type/ct_i028_xsd/ct_i028.py | 1,350 | Python |
__author__ = 'Gobin'
from redditcli.api import base
class Account(base.Resource):
resource_name = 'Account'
class AccountManager(base.ResourceManager):
resource_class = Account
def me(self):
return self._get('/api/v1/me')
def getkarma(self):
return self._get('/api/v1/me/karma')
... | 20.961538 | 54 | 0.645872 | [
"Apache-2.0"
] | gobins/python-oauth2 | redditcli/api/account.py | 545 | Python |
import os
import numpy as np
import warnings
#import SimpleITK as sitk
import cv2
from scipy import misc
from scipy import ndimage
def load_image_from_folder(folder_path, new_size, HE=False, Truc=False, Aug=False):
"""loads images in the folder_path and returns a ndarray and threshold the label image"""
imag... | 41.405797 | 93 | 0.645082 | [
"MIT"
] | junyuchen245/NM-Img-Denoising-DIP-Keras | DIPDenoising/image_reading.py | 5,714 | Python |
#MIT License
#Copyright (c) 2021 OXYOP
#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, modify, merge, publish, distr... | 39.42 | 269 | 0.624556 | [
"MIT"
] | OxyNotOp/OxyPlayer | plugins/inline.py | 3,963 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 32.820122 | 186 | 0.636693 | [
"ECL-2.0",
"Apache-2.0"
] | chivandikwa/pulumi-aws | sdk/python/pulumi_aws/signer/_inputs.py | 10,765 | Python |
import discord
async def get_role_based_on_reputation(self, guild, ranked_amount):
if ranked_amount >= 10:
return await get_role_from_db(self, "experienced_mapper", guild)
elif ranked_amount >= 1:
return await get_role_from_db(self, "ranked_mapper", guild)
else:
return await get_ro... | 37.833333 | 98 | 0.675477 | [
"MIT"
] | Kyuunex/Seija | seija/reusables/verification.py | 681 | Python |
from .station import consistant_typical_range_stations
def stations_level_over_threshold(stations: list, tol: float) -> list:
"""function takes in stations and returns a list of tuples contating station and
relative water lever where the relative water level greater than tol """
stations = consistant_ty... | 33 | 105 | 0.710438 | [
"MIT"
] | LakeeSiv/Flood | floodsystem/flood.py | 1,188 | Python |
import pytest
import sys
import os
os.environ['SENTINEL_CONFIG'] = os.path.normpath(os.path.join(os.path.dirname(__file__), '../test_sentinel.conf'))
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), '../../lib')))
@pytest.fixture
def valid_parking_address(network='mainnet'):
return 'yYe8Kw... | 40.070922 | 380 | 0.777699 | [
"MIT"
] | hexter2018/sentinel | test/unit/test_parkingy_things.py | 5,650 | Python |
# Fetches and displays a basic candlestick app.
import dash
import plotly.graph_objects as go
import plotly.express as px
import dash_core_components as dcc
import dash_html_components as html
from dash_table import DataTable, FormatTemplate
from utils import *
from datetime import date, timedelta
from math ... | 41.332231 | 81 | 0.477765 | [
"MIT"
] | SantiLJ/strategy-template | app.py | 25,006 | Python |
from autokeras.generator import DefaultClassifierGenerator
from autokeras.graph import *
from autokeras.net_transformer import legal_graph
from tests.common import get_conv_data, get_add_skip_model, get_conv_dense_model, get_pooling_model, \
get_concat_skip_model
def test_conv_deeper_stub():
graph = get_conv_... | 26.99569 | 120 | 0.695513 | [
"MIT"
] | MenEnger/autokeras | tests/test_graph.py | 6,263 | Python |
'''
Revealer
Do you have something to hide?
Secret backup plug-in for the electrum wallet.
Tiago Romagnani Silveira, 2017
'''
import os
import random
import traceback
from decimal import Decimal
from functools import partial
import sys
import qrcode
from PyQt5.QtPrintSupport import QPrinter
from PyQt5.QtCore impo... | 43.717848 | 159 | 0.584877 | [
"MIT"
] | anonymouszar/electrum-vestx | electrum_vestx/plugins/revealer/qt.py | 33,313 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 39.743802 | 180 | 0.680183 | [
"Apache-2.0"
] | test-wiz-sec/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/network/v20200301/get_network_interface_tap_configuration.py | 4,809 | Python |
# -*- coding: utf-8 -*-
import codecs
import re
import sys
from distutils.core import setup
import os
if sys.version_info < (3, 5, 0):
raise RuntimeError("aio-space-track-api requires Python 3.5.0+")
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
VERSION_REGEXP = re.compile(r"^__version__ = [\'\"](.+?... | 26.866667 | 98 | 0.671629 | [
"MIT"
] | NikitaKoshelev/aio-space-track-api | setup.py | 1,209 | Python |
# https://github.com/facebookresearch/torchbeast/blob/master/torchbeast/core/environment.py
import numpy as np
from collections import deque
import gym
from gym import spaces
import cv2
cv2.ocl.setUseOpenCL(False)
class NoopResetEnv(gym.Wrapper):
def __init__(self, env, noop_max=30):
"""Sample initial st... | 38.129758 | 171 | 0.632742 | [
"MIT"
] | HelgeS/cleanrl | cleanrl/experiments/dqn2_atari_visual.py | 22,039 | Python |
#coding:utf-8
'''
filename:get_numbers.py
chap:8
subject:2
conditions:file [data],contains: numbers,annotations,empty line
solution:function get_numbers
'''
import sys
def get_numbers(file):
f = None
numbers = []
try:
with open(file,'rt') as f:
for line in f:
... | 21.028571 | 67 | 0.569293 | [
"MIT"
] | marble-git/python-laoqi | chap8/get_numbers.py | 736 | Python |
#Author-HeNeos
#Description-Many triangles, I love triangles
import adsk.core, adsk.fusion, adsk.cam, traceback
import math
def get_points(n, angle, r):
ans = [[0.0, 0.0]]*n
for i in range(0, n):
ans[i] = [r*math.cos(angle + 2*i*math.pi/n), r*math.sin(angle + 2*i*math.pi/n)]
return ans
def run(c... | 35.714286 | 155 | 0.595 | [
"MIT"
] | HeNeos/autodesk_scripts | Fusion/fillet_polygon.py | 3,000 | Python |
from django.urls import path
from . import views
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
path('settings', views.project_settings, name='settings'),
path('envs', views.os_envs, name='envs'),
]
| 26 | 62 | 0.723776 | [
"MIT"
] | Nenu1985/blog | products/urls.py | 286 | Python |
# coding: utf-8
#
# Copyright 2019 The Oppia 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 requi... | 45.437904 | 80 | 0.623512 | [
"Apache-2.0"
] | cclauss/oppia | core/domain/prod_validation_jobs_one_off_test.py | 287,940 | Python |
from django.db import models
from django.conf import settings
# Create your models here.
class Message(models.Model):
id = models.AutoField(primary_key=True)
sender_id = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="message_sender", on_delete=models.DO_NOTHING, null=True)
receiver_id = model... | 35.247191 | 134 | 0.739241 | [
"MIT"
] | KayT77/SMA-Team-2 | Details/models.py | 3,137 | Python |
import customSocket
import sys, pygame
#constants
windowSize = width, height = 800, 600
#displayed in the window t ogive directiosn to the driver
instructionTextLines = open('commands.txt').readlines()
activeColor = (0,175,0)
inactiveColor = (255,0,0)
textColor = (0,0,0)
screen = pygame.display.set_mode(win... | 25.910891 | 92 | 0.670615 | [
"Apache-2.0"
] | sturzl/keyboardControlSocket | commandWindow.py | 2,617 | Python |
import os
from gym import utils
from gym.envs.robotics import fetch_env
import numpy as np
from goal_prox.envs.holdout_sampler import HoldoutSampler, LineHoldoutSampler
from goal_prox.envs.old_holdout_sampler import OldHoldoutSampler
# Ensure we get the path separator correct on windows
MODEL_XML_PATH = os.path.join(... | 38.8125 | 100 | 0.636675 | [
"MIT"
] | clvrai/goal_prox_il | goal_prox/envs/fetch/custom_push.py | 4,968 | Python |
from ._tracing import Beam
from ._sbt import trace_surfaces | 29.5 | 32 | 0.847458 | [
"MIT"
] | draustin/otk | otk/asbt1/__init__.py | 59 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Guenter Bartsch, Heiko Schaefer
#
# 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/LICEN... | 32.752137 | 190 | 0.640919 | [
"Apache-2.0"
] | 0zAND1z/zamia-ai | tests/test_aiprolog.py | 3,835 | Python |
from __future__ import absolute_import
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
# ---------------... | 39.943503 | 120 | 0.603112 | [
"MIT"
] | busyboxs/pytorch-faster-rcnn | lib/model/rpn/proposal_layer.py | 7,070 | Python |
"""
Use lldb Python API to verify that expression evaluation for property references uses the correct getters and setters
"""
from __future__ import print_function
import os
import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldb... | 37.6 | 117 | 0.671922 | [
"Apache-2.0"
] | Polidea/SiriusObfuscator | SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py | 5,264 | Python |
# -*- coding: utf8 -*-
# Copyright (c) 2021 Niklas Rosenstein
#
# 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, mo... | 32.955307 | 103 | 0.698423 | [
"MIT"
] | NiklasRosenstein/shut | src/shut/model/version.py | 5,899 | Python |
"""
Off Multipage Cheatsheet
https://github.com/daniellewisDL/streamlit-cheat-sheet
@daniellewisDL : https://github.com/daniellewisDL
"""
import streamlit as st
from pathlib import Path
import base64
from modules.toc import *
# Initial page config
st.set_page_config(
page_title='Code Compendium Intro Page',
... | 26.845921 | 228 | 0.658226 | [
"MIT"
] | rypaik/Streamlit_Ref | .history/pages/intro_20220303160531.py | 8,907 | Python |
import glob
import os
from collections import defaultdict
import numpy as np
from yt.data_objects.static_output import ParticleDataset, ParticleFile
from yt.frontends.gadget.data_structures import _fix_unit_ordering
from yt.funcs import only_on_root, setdefaultattr
from yt.geometry.particle_geometry_handler import Pa... | 40 | 87 | 0.620642 | [
"BSD-3-Clause-Clear"
] | neutrinoceros2/yt | yt/frontends/owls_subfind/data_structures.py | 8,720 | Python |
# -*- coding: utf-8 -*-
from devp2p import crypto
from quarkchain.rlp.utils import decode_hex
import random
import pytest
def get_ecc(secret=b''):
return crypto.ECCx(raw_privkey=crypto.mk_privkey(secret))
def test_valid_ecc():
for i in range(100):
e = get_ecc()
assert len(e.raw_pubkey) == 64... | 30.694915 | 162 | 0.717835 | [
"MIT"
] | Kaushalop/pyquarkchain | devp2p/tests/test_crypto.py | 3,622 | Python |
import pytest
from django.urls import resolve, reverse
from car_rental.users.models import User
pytestmark = pytest.mark.django_db
def test_user_detail(user: User):
assert (
reverse("api:user-detail", kwargs={"username": user.username})
== f"/api/users/{user.username}/"
)
assert resolve(... | 26.52 | 81 | 0.669683 | [
"MIT"
] | TheHaRyPL/Car-rental | car_rental/car_rental/users/tests/test_drf_urls.py | 663 | Python |
#! -*- coding: utf-8 -*-
# 主要模型
import numpy as np
from bert4keras.layers import *
from bert4keras.snippets import insert_arguments
from bert4keras.snippets import delete_arguments
from bert4keras.snippets import is_string
from keras.models import Model
import json
class Transformer(object):
"""模型基类
"""
... | 33.316331 | 121 | 0.536853 | [
"Apache-2.0"
] | CurisZhou/bert4keras | bert4keras/models.py | 80,151 | Python |
from mahotas import cwatershed
from mala.losses import ultrametric_loss_op
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.filters import maximum_filter
from scipy.ndimage.morphology import distance_transform_edt
import gunpowder as gp
import json
import numpy as np
import skelerator
import tensorf... | 29.364754 | 85 | 0.573203 | [
"MIT"
] | pattonw/mouselight | synthetic/blobs/train.py | 7,165 | Python |
from collections import defaultdict
from django.conf import settings
from prices import Price
from satchless.process import ProcessManager
from .steps import ShippingAddressStep, ShippingMethodStep, SummaryStep, DetailsStep
from ..cart import Cart
from ..core import analytics
from ..order.models import Order
STORAGE... | 35.307692 | 84 | 0.635924 | [
"BSD-3-Clause"
] | spartonia/saleor | saleor/checkout/core.py | 4,131 | Python |
import abc
import collections.abc
import contextlib
import dataclasses
import itertools
import math
import operator
import re
import sys
import time
from collections import defaultdict
from datetime import datetime, timedelta
from functools import lru_cache
from hashlib import md5
from typing import Any, Optional
impo... | 36.556485 | 132 | 0.602877 | [
"BSD-3-Clause"
] | martindurant/tiled | tiled/server/core.py | 26,211 | Python |
# coding: utf-8
"""
Eclipse Kapua REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
... | 44.859882 | 426 | 0.624324 | [
"MIT"
] | liang-faan/SmartIOT-Diec | kapua-client/python-client/swagger_client/api/devices_api.py | 152,075 | Python |
"""
Conversion of length units.
Available Units:- Metre,Kilometre,Feet,Inch,Centimeter,Yard,Foot,Mile,Millimeter
USAGE :
-> Import this file into their respective project.
-> Use the function length_conversion() for conversion of length units.
-> Parameters :
-> value : The number of from units you want to... | 32.853659 | 84 | 0.621133 | [
"MIT"
] | 04n0/TheAlgorithms-Python | conversions/length_conversion.py | 4,041 | Python |
from ._stopping_criterion import StoppingCriterion
from ..accumulate_data import LDTransformData
from ..util import MaxSamplesWarning, ParameterError, ParameterWarning
from numpy import *
from time import time
import warnings
class CubQMCLDG(StoppingCriterion):
"""
Abstract class for CubQMC{LD}G where LD is a... | 44.347368 | 124 | 0.618562 | [
"Apache-2.0"
] | QMCSoftware/QMCSoftware | qmcpy/stopping_criterion/_cub_qmc_ld_g.py | 4,213 | Python |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | 69.094568 | 934 | 0.631931 | [
"MIT"
] | rahul0324/Upgrade-AQM-Evaluation-Suite-of-ns-3 | ns-3-dev-git/src/flow-monitor/bindings/modulegen__gcc_ILP32.py | 530,439 | Python |
"""Generic Z-Wave Entity Classes."""
import copy
import logging
from openzwavemqtt.const import (
EVENT_INSTANCE_STATUS_CHANGED,
EVENT_VALUE_CHANGED,
OZW_READY_STATES,
CommandClass,
ValueIndex,
)
from openzwavemqtt.models.node import OZWNode
from openzwavemqtt.models.value import OZWValue
from ho... | 35.131148 | 91 | 0.650863 | [
"Apache-2.0"
] | 2Fake/core | homeassistant/components/ozw/entity.py | 10,715 | Python |
"""App initialization file. Instantiates app, database, login_manager. Registers view blueprints. Defines user_loader callback for LoginManager."""
from flask import Flask
from flask_login import LoginManager
from flask_wtf.csrf import CSRFProtect
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative... | 25.468085 | 150 | 0.798663 | [
"MIT"
] | YouKnowBagu/item-catalog | app/__init__.py | 1,197 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from ... | 41.557895 | 247 | 0.691109 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/eventgrid/get_event_channel.py | 7,896 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test the archive_lib module."""
from __future__ import print_function
import mock
from chromite.cbuildbot import archive... | 34.311321 | 77 | 0.688617 | [
"BSD-3-Clause"
] | FLOSSBoxIN/src | third_party/chromite/cbuildbot/archive_lib_unittest.py | 7,274 | Python |
"""This module contains the general information for AdaptorEthCompQueueProfile ManagedObject."""
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class AdaptorEthCompQueueProfileConsts():
pass
class AdaptorEthCompQueueProfil... | 49.446809 | 283 | 0.669105 | [
"Apache-2.0"
] | depereo/ucscsdk | ucscsdk/mometa/adaptor/AdaptorEthCompQueueProfile.py | 2,324 | Python |
from userbot import bot, logger
from telethon import TelegramClient, events
from config import user
from telethon.tl.functions.users import GetFullUserRequest
@bot.on(events.NewMessage(**user))
async def getUser(event):
logger.info("user plugin is called")
pattern_string = event.pattern_match.string
entity... | 42 | 113 | 0.725275 | [
"MIT"
] | fosslife/grambot | plugins/user.py | 1,092 | Python |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Comment.article_version'
db.add_column(u'wiking_comment',... | 68.103448 | 187 | 0.571983 | [
"Apache-2.0"
] | lenarhus/opengift.io | wiking/migrations/0004_auto__add_field_comment_article_version.py | 5,925 | Python |
#!/usr/bin/python3
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
"""
Manage database of SV JJ device fab/measurement parameters
File format: SQLite
Tables: barrier (dep structure), shape, josephson (measured params),
trend (fitted Jc, RnA, IcRn)
BB, 2015
"""
print('hello')
import sqlite3
# Restrict t... | 33.970588 | 80 | 0.540404 | [
"MIT"
] | bebaek/cryomem | cryomem/cmtools/lib/old/sql_svjj_old2.py | 6,930 | Python |
import json
import yaml
from jsonschema import validate
import os
configuration_file = os.environ['SC_ENABLER_CONF']
with open(configuration_file, 'r') as conf_file:
input_config = yaml.safe_load(conf_file)
with open("./input_schema_validator.json", 'r') as schema_file:
schema = json.load(schema_file)
def ... | 23.058824 | 63 | 0.772959 | [
"Apache-2.0"
] | cszelesbbs/servicecatalogenabler | test_validate_input_file.py | 392 | Python |
import logging
import os.path
from copy import deepcopy
import pkg_resources
import salt.config
import salt.loader
import salt.modules.boto_elb as boto_elb
import salt.utils.versions
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import T... | 38.279352 | 91 | 0.696563 | [
"Apache-2.0"
] | Anujsahu902/salt | tests/unit/modules/test_boto_elb.py | 9,455 | Python |
from six.moves.urllib_parse import quote
from jet_bridge_base import settings
from jet_bridge_base.responses.base import Response
from jet_bridge_base.responses.redirect import RedirectResponse
from jet_bridge_base.status import HTTP_400_BAD_REQUEST
from jet_bridge_base.views.base.api import APIView
class RegisterVi... | 35.488372 | 105 | 0.659895 | [
"MIT"
] | RamsesMartinez/jet-bridge | packages/jet_bridge_base/jet_bridge_base/views/register.py | 1,526 | Python |
import datetime
from app import db
class BucketList(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(100), unique=True)
description = db.Column(db.Text, nullable=True)
interests = db.Column(db.String(120), nullable=True)
date_created = db.Colum... | 38.451613 | 88 | 0.703859 | [
"MIT"
] | SerryJohns/bucket-list | app/api/v1/models/bucketlist.py | 1,192 | Python |
import logging
import os
import subprocess
import tempfile
from argparse import Namespace
from pathlib import Path
from .error import EvalError
from .manifest import Repo, load_manifest, update_lock_file
from .path import EVALREPO_PATH, LOCK_PATH, MANIFEST_PATH, nixpkgs_path
from .prefetch import prefetch
logger = lo... | 31.212766 | 114 | 0.582822 | [
"MIT"
] | nixos-users/NUR | ci/nur/update.py | 2,934 | Python |
import json
from videomaker.functions.packageData import packageData
from videomaker.functions.addPreset import addOption
def savePreset(focus):
preset = packageData(focus, verify=False)
with open("./presets/{0}.json".format(preset["subredditName"]), "w+") as out:
json.dump(preset, out, indent=4)
a... | 41.5 | 99 | 0.73253 | [
"MIT"
] | TheTimebike/VideoMaker-Studio | videomaker/functions/savePreset.py | 415 | Python |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import framework.configbase
import math
import time
import numpy as np
from modules.transformer_encoder import Encoder
from modules.transformer_decoder import Decoder
decay1 = [(i+1)*20**(-1) for i in range(20)]
deca... | 44.762712 | 166 | 0.683453 | [
"MIT"
] | riokt/video-paragraph | modules/transformer.py | 5,282 | Python |
def par_UCT(rootstate, rootnode, itermax):
print('hi')
for i in range(0):
node = rootnode
state = rootstate.clone()
# Select
while node.untriedMoves == [] and node.childNodes != []: # node is fully expanded and non-terminal
node = node.UCTSelectCh... | 44.209302 | 145 | 0.557601 | [
"MIT"
] | guy477/Poker | Version2/ivan/rlcard/rlcard/agents/mcmphelp.py | 1,901 | Python |
import pytrec_eval
from repro_eval.util import trim, break_ties
from repro_eval.measure.statistics import ttest
from repro_eval.measure.overall_effects import ER, deltaRI
from repro_eval.measure.document_order import ktau_union as ktu, RBO
from repro_eval.measure.effectiveness import rmse as RMSE, nrmse as nRMSE
from r... | 59.723856 | 143 | 0.643019 | [
"MIT"
] | irgroup/repro_eval | repro_eval/Evaluator.py | 36,551 | Python |
"""
Module for applying conditional formatting to
DataFrames and Series.
"""
from collections import defaultdict
from contextlib import contextmanager
import copy
from functools import partial
from itertools import product
from uuid import uuid1
import numpy as np
from pandas.compat import range
from pandas.util._de... | 34.005848 | 79 | 0.529923 | [
"BSD-3-Clause"
] | harunpehlivan/pandas | pandas/io/formats/style.py | 46,520 | Python |
import datetime
import json
import logging
import socket
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.DEBUG)
class Base(dict):
"""Base metric class"""
def __init__(
self,
name: str,
environment: str,
zone: str,
timestamp: str = None
):
supe... | 26.021978 | 71 | 0.559966 | [
"Apache-2.0"
] | opentelekomcloud-infra/csm-test-utils | csm_test_utils/message.py | 2,368 | Python |
# -*- coding: utf-8 -*-
import os
import shutil
def make_empty_folder(folder_path:str):
if os.path.exists(folder_path):
if os.path.isdir(folder_path):
shutil.rmtree(folder_path)
else:
os.remove(folder_path)
os.mkdir(folder_path)
def copy_files(from_path:str, to_path:... | 28.375 | 77 | 0.618943 | [
"MIT"
] | TrpFrog/jellyfish-aquarium | submission_builder.py | 1,362 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.