max_stars_repo_path
stringlengths
3
269
max_stars_repo_name
stringlengths
4
119
max_stars_count
int64
0
191k
id
stringlengths
1
7
content
stringlengths
6
1.05M
score
float64
0.23
5.13
int_score
int64
0
5
aquitania/data_processing/indicator_pipeline.py
marcus-var/aquitania
0
12794151
<filename>aquitania/data_processing/indicator_pipeline.py ######################################################################################################################## # |||||||||||||||||||||||||||||||||||||||||||||||||| AQUITANIA ||||||||||||||||||||||||||||||||||||||||||||||||||||||| # # ||||||||||||||||||...
2.171875
2
nbmessages/utils.py
ucsd-ets/nbmessages
0
12794152
"""One-off functions""" import urllib.parse, random, string def load_yaml(path): import yaml try: with open(path, 'r') as yaml_file: data = yaml.load(yaml_file, Loader=yaml.FullLoader) return data except FileNotFoundError: raise FileNotFoundError('could not load yaml at...
3.1875
3
controls.py
CamRoy008/AlouetteApp
0
12794153
# This file is depreciated. Controls had to be hard coded into app.py in the translate_static function. Babel could not translate from this file. from flask_babel import Babel, _ # Controls for webapp station_name_options = [ {'label': _('Resolute Bay, No. W. Territories'), 'value': 'Resolute Bay, No. W. Territor...
1.78125
2
archiv/views.py
csae8092/djtranskribus
0
12794154
<reponame>csae8092/djtranskribus # generated by appcreator from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from django.urls import reverse, reverse_lazy from django.views.generic.detail import DetailView from django.views.generic.edit import DeleteView from...
1.90625
2
hero1/command_pb2.py
danielhwkim/Hero1
0
12794155
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: command.proto """Generated protocol buffer code.""" from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool fr...
1.15625
1
hoki/load.py
HeloiseS/hoki
40
12794156
<reponame>HeloiseS/hoki """ This module implements the tools to easily load BPASS data. """ import pandas as pd import hoki.hrdiagrams as hr from hoki.constants import * import os import yaml import io import pickle import pkg_resources import hoki.data_compilers import warnings from hoki.utils.exceptions import HokiD...
2.078125
2
examples/go_to_joints_with_joint_impedances.py
iamlab-cmu/frankapy
18
12794157
import argparse import sys from frankapy import FrankaArm from frankapy import FrankaConstants as FC def wait_for_enter(): if sys.version_info[0] < 3: raw_input('Press Enter to continue:') else: input('Press Enter to continue:') if __name__ == '__main__': parser = argparse.ArgumentParser()...
2.9375
3
ftp.py
benny-ojeda/python-ftp-client
1
12794158
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys from ftplib import FTP import ftplib import argparse import getpass parser = argparse.ArgumentParser(description='FTP Client.') parser.add_argument('ftp_server') args = parser.parse_args() def cli(prompt, reminder='Please type a valid command'): ...
3.171875
3
synapse/tests/test_lib_filepath.py
larrycameron80/synapse
0
12794159
<reponame>larrycameron80/synapse import io import shutil import tarfile import zipfile import tempfile from synapse.tests.common import * import synapse.exc as s_exc import synapse.lib.filepath as s_filepath class TestFilePath(SynTest): def test_filepath_glob(self): temp_dir = tempfile.mkdtemp() ...
2.421875
2
award/forms.py
Ras-Kwesi/ranker
0
12794160
from django import forms from .models import * class NewProject(forms.ModelForm): class Meta: model = Project exclude = ['likes', 'profile',] class EditProfile(forms.ModelForm): class Meta: model = Profile exclude = [] fields = ['profilepic','bio','contact'] class E...
2.1875
2
gae/api/__init__.py
trevorhreed/gae-boilerplate
0
12794161
import core class Test(core.Endpoint): def get(self): self.json({'what': 'now'})
1.90625
2
src/rpdk/core/jsonutils/utils.py
zjinmei/cloudformation-cli
200
12794162
import hashlib import json import logging from collections.abc import Mapping, Sequence from typing import Any, List, Tuple from nested_lookup import nested_lookup from ordered_set import OrderedSet from .pointer import fragment_decode, fragment_encode LOG = logging.getLogger(__name__) NON_MERGABLE_KEYS = ("uniqueI...
2.328125
2
tests/test_cli.py
jacebrowning/slackoff
0
12794163
# pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned import pytest from click.testing import CliRunner from expecter import expect from slackoff.cli import main @pytest.fixture def runner(): return CliRunner() def describe_cli(): def describe_signout(): def it_can_force_s...
1.953125
2
main.py
albgus/fikabotten
1
12794164
<reponame>albgus/fikabotten<gh_stars>1-10 #!/usr/bin/env python3 import discord import asyncio import re import time import yaml import os import sys from sqlalchemy import func, create_engine from sqlalchemy.orm import sessionmaker from db import Base,User,Server,Trigger def load_config(configfile): """Return a ...
2.125
2
buffer/shard-cpp-test/common/inner_reuse/out_parser.py
zaqwes8811/coordinator-tasks
0
12794165
# coding: utf-8 import re from inner_reuse import chunks class Ptr(object): """ Contain operation data """ def __init__(self, pos, type_key): self.position = pos self.type_response = type_key self.name_test = None self.out = "" def __repr__(self): return s...
2.703125
3
ml/scratch.py
Shivams9/pythoncodecamp
6
12794166
import numpy import pandas as pd import matplotlib.pyplot as plt from sklearn.metrics import r2_score x = [1,2,3,4] x=numpy.array(x) print(x.shape) x=x.reshape(2,-1) print(x.shape) print(x) x=x.reshape(-1) print(x.shape) print(x) y = [2,4,6,8] #x*2=[2,4,6,8] #x*x=[1,4,9,16] #sum(x) = 10 pf=numpy.polyfit(x,y,3) print...
3.1875
3
Day 52/PolygonPossibilty.py
sandeep-krishna/100DaysOfCode
0
12794167
''' You are given length of n sides, you need to answer whether it is possible to make n sided convex polygon with it. Input : - First line contains ,no .of testcases. For each test case , first line consist of single integer ,second line consist of spaced integers, size of each side. Output : - For each test case p...
4.09375
4
util/ConfigUtils.py
cclauss/ph0neutria
0
12794168
#!/usr/bin/python from ConfigParser import SafeConfigParser import os import string class baseObj: def __init__(self, multiProcess, userAgent, outputFolderName, outputFolder, deleteOutput, dateFormat, useTor, torIP, torPort, redirectLimit, hashCountLimit, urlCharLimit, osintDays, malShareApiKey, disableMalShare...
1.945313
2
dragonfire/conversational/corpus/ubuntudata.py
kameranis/Dragonfire
1
12794169
<gh_stars>1-10 import os from tqdm import tqdm """ Ubuntu Dialogue Corpus http://arxiv.org/abs/1506.08909 """ class UbuntuData: """ """ def __init__(self, dirName): """ Args: dirName (string): directory where to load the corpus """ self.MAX_NUMBER_SUBDIR = 1...
2.6875
3
yacluster.py
KrzysiekJ/yacluster
4
12794170
<filename>yacluster.py from functools import partial, reduce from itertools import chain, product from math import sqrt def distance(coords_1, coords_2): return sqrt(pow(coords_1[0] - coords_2[0], 2) + pow(coords_1[1] - coords_2[1], 2)) def get_grid_cell(x, y, threshold): return (int(x // threshold), int(y...
3.265625
3
mock_interview/spring_mock_at_make_school.py
Sukhrobjon/leetcode
0
12794171
<filename>mock_interview/spring_mock_at_make_school.py<gh_stars>0 """Problem 2: Given an array of integers, replace each element of the array with product of every other element in the array without using the division operator. Example input 1: [1, 2, 3, 4, 5] = > should return output: [120, 60, 40, 30, 24] Example...
3.84375
4
tests/test_cli_config.py
Dallinger/Dallinger
100
12794172
<reponame>Dallinger/Dallinger from pathlib import Path import json import mock import pytest import shutil import tempfile def test_list_hosts_empty(): from dallinger.command_line.config import get_configured_hosts assert get_configured_hosts() == {} def test_list_hosts_results(tmp_appdir): from dalli...
2.1875
2
energy/evaluation.py
pminervini/DeepKGC
5
12794173
<reponame>pminervini/DeepKGC # -*- coding: utf-8 -*- import numpy as np import theano import theano.tensor as T import logging from sklearn import metrics from sparse.learning import parse_embeddings def auc_pr(predictions=[], labels=[]): '''Computes the Area Under the Precision-Recall Curve (AUC-PR)''' pr...
2.046875
2
tests/test_markup.py
Kiran-Raj-Dev/ManimPango
0
12794174
# -*- coding: utf-8 -*- from pathlib import Path import pytest import manimpango from . import CASES_DIR from ._manim import MarkupText from .svg_tester import SVGStyleTester ipsum_text = ( "<b>Lorem ipsum dolor</b> sit amet, <i>consectetur</i> adipiscing elit," "sed do eiusmod tempor incididunt ut labore e...
2.34375
2
orb_simulator/orbsim_language/orbsim_ast/bitwise_shift_right_node.py
dmguezjaviersnet/IA-Sim-Comp-Project
1
12794175
<filename>orb_simulator/orbsim_language/orbsim_ast/bitwise_shift_right_node.py from orbsim_language.orbsim_ast.binary_expr_node import BinaryExprNode # >> class BitwiseShiftRightNode(BinaryExprNode): pass
1.695313
2
pylabnet/network/client_server/dio_breakout.py
wi11dey/pylabnet
10
12794176
<gh_stars>1-10 from pylabnet.network.core.service_base import ServiceBase from pylabnet.network.core.client_base import ClientBase class Service(ServiceBase): def exposed_measure_voltage(self, board, channel): return self._module.measure_voltage(board, channel) def exposed_set_high_voltage(self, bo...
2.46875
2
api/__init__.py
adenilsonElias/Gerenciador_Casa_Aluguel
0
12794177
""" API do Gerenciador de Casas de Aluguel ====================================== """ # https://www.pythoncentral.io/introduction-to-sqlite-in-python/ import sqlite3 import config def make_connection(): return sqlite3.connect(config.DATABASE_URL) class InquilinoException(Exception): ... class CasaExcept...
4.09375
4
wisdem/orbit/phases/install/cable_install/__init__.py
ptrbortolotti/WISDEM
81
12794178
<reponame>ptrbortolotti/WISDEM """Initialize cable installation functionality""" __author__ = "<NAME>" __copyright__ = "Copyright 2020, National Renewable Energy Laboratory" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" from .array import ArrayCableInstallation from .common import SimpleCable from .export import Ex...
0.984375
1
src/nsupdate/utils/_tests/test_mail.py
mirzazulfan/nsupdate.info
774
12794179
<reponame>mirzazulfan/nsupdate.info """ Tests for mail module. """ from django.contrib.auth import get_user_model from django.utils.translation import ugettext_lazy as _ from ..mail import translate_for_user class TestTransUser(object): def test(self): User = get_user_model() user = User.objects...
2.1875
2
tool_sdk/api/basic/list_tool_pb2.py
easyopsapis/easyops-api-python
5
12794180
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: list_tool.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf i...
1.179688
1
hrdf-tools/hrdf_db_reporter_cli.py
vasile/OJP-Showcase
0
12794181
import argparse import os import re import sys from inc.HRDF.Stops_Reporter.stops_reporter import HRDF_Stops_Reporter from inc.HRDF.HRDF_Parser.hrdf_helpers import compute_formatted_date_from_hrdf_db_path from inc.HRDF.db_helpers import compute_db_tables_report parser = argparse.ArgumentParser(description = 'Generate...
2.578125
3
AnnotationTools/ui_mainwindow.py
upzheng/Electrocardio-Panorama
33
12794182
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'mainwindow.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow)...
2.109375
2
typeidea/blog/admin.py
IchLiebeDeutsch/typeidea
0
12794183
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from .models import Post, Category, Tag from typeidea.custom_site import custom_site from django.utils.html import format_html from django.core.urlresolvers import reverse from .adminforms import PostAdminForm from typeide...
1.90625
2
src/optimizer.py
Chizuchizu/riadd
1
12794184
from adabelief_pytorch import AdaBelief import torch_optimizer from torch import optim from src.sam import SAM __OPTIMIZERS__ = { "AdaBelief": AdaBelief, "RAdam": torch_optimizer.RAdam, "SAM": SAM } def get_optimizer(cfg, model): optimizer_name = cfg.optimizer.name if optimizer_name == "SAM": ...
2.375
2
eval/keras_v1/utils.py
zifanw/smoothed_geometry
5
12794185
import numpy as np import tensorflow as tf import random import _pickle as pkl import matplotlib.pyplot as plt from pylab import rcParams import scipy import scipy.stats as stats from tensorflow.python.ops import gen_nn_ops config_gpu = tf.ConfigProto() config_gpu.gpu_options.allow_growth = True MEAN_IMAGE = np.zeros(...
2.4375
2
pulse/uix/menu/widgets/plotWidget.py
open-pulse/OpenPulse
23
12794186
<reponame>open-pulse/OpenPulse from os.path import isfile from PyQt5.QtWidgets import QWidget, QLabel, QLineEdit, QPushButton, QFormLayout, QMessageBox, QCheckBox class PlotWidget(QWidget): """MenuInfo Widget This class is responsible for building a small area below of the item menu when some item is clic...
2.78125
3
setuptools_pyecore/command.py
pyecore/setuptools-pyecore
4
12794187
"""Implementation of the setuptools command 'pyecore'.""" import collections import contextlib import distutils.log as logger import logging import pathlib import shlex import pyecore.resources import pyecoregen.ecore import setuptools class PyEcoreCommand(setuptools.Command): """A setuptools command for generat...
2.34375
2
terseparse/root_parser.py
jthacker/terseparse
1
12794188
<reponame>jthacker/terseparse import sys import logging from argparse import ArgumentParser, RawTextHelpFormatter, _SubParsersAction, SUPPRESS from collections import namedtuple, OrderedDict def is_subparser(action_group): for a in action_group._group_actions: if isinstance(a, _SubParsersAction): ...
2.46875
2
pytautulli/models/home_stats.py
bdraco/pytautulli
2
12794189
"""PyTautulliApiHomeStats.""" from __future__ import annotations from pytautulli.models.user import PyTautulliApiUser from .base import APIResponseType, PyTautulliApiBaseModel class PyTautulliApiHomeStatsRow(PyTautulliApiUser, PyTautulliApiBaseModel): """PyTautulliApiHomeStatsRow""" _responsetype = APIResp...
2.359375
2
TextCNN_Siamese/cnn_loaddata_v2.py
Wang-Yikai/Final-Project-for-Natural-Language-Processing-FDU
6
12794190
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 21 15:05:24 2018 @author: Hendry """ from read_data import * from TokenizeSentences import * import numpy as np def onehot(data,nClass): data2 = np.zeros([len(data),nClass]) for i in range(nClass): data2[np.where(data==i),i]= 1 return data2 ...
2.5625
3
tests/context.py
mrcagney/googlemaps_helpers
1
12794191
import os import sys from pathlib import Path sys.path.insert(0, os.path.abspath('..')) import googlemaps_helpers ROOT = Path('.') DATA_DIR = Path('tests/data')
1.789063
2
HW2/dataset_setup.py
yusufdalva/CS550_Assignments
1
12794192
<filename>HW2/dataset_setup.py import os import shutil import wget import numpy as np DATA_FILE_NAMES = ["train1", "test1", "train2", "test2"] BASE_URL = "http://www.cs.bilkent.edu.tr/~gunduz/teaching/cs550/documents" FILE_URLS = [os.path.join(BASE_URL, file_name) for file_name in DATA_FILE_NAMES] def download_data(...
2.90625
3
pfp/fuzz/__init__.py
bannsec/pfp
1
12794193
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module contains the base classes used when defining mutation strategies for pfp """ import glob import os import six get_strategy = None StratGroup = None FieldStrat = None def init(): global get_strategy global StratGroup global FieldStrat i...
2.484375
2
library/source1/mdl/v44/__init__.py
anderlli0053/SourceIO
0
12794194
from .mdl_file import MdlV44
1.09375
1
Course/functions/example_19.py
zevgenia/Python_shultais
0
12794195
<filename>Course/functions/example_19.py # -*- coding: utf-8 -*- def func(b): b[0] = 1 def func2(b): b = b[:] b[0] = 2 def func3(b): b = b.copy() b[0] = 3 l = ['one', 'two', 'three'] func(l[:]) print("l1:", l) func2(l) print("l2:", l) func3(l) print("l3:", l)
3.5625
4
eeyore/linalg/is_pos_def.py
papamarkou/eeyore
6
12794196
import torch def is_pos_def(x): if torch.equal(x, x.t()): try: torch.linalg.cholesky(x) return True except RuntimeError: return False else: return False
2.671875
3
QSQuantifier/DataConnection.py
lizhuangzi/QSQuantificationCode
2
12794197
<gh_stars>1-10 #!/usr/bin python # coding=utf-8 from pymongo import MongoClient def startConnection(ip = 'localhost',port = 27017,dbname = 'StockDatas'): client = MongoClient(ip,port) # try: # client.admin.command('ismaster') # except Exception as e: # print('Server not available') db = client[dbname] ...
2.703125
3
barbeque/shortcuts.py
moccu/barbeque
5
12794198
<reponame>moccu/barbeque from django.shortcuts import _get_queryset def get_object_or_none(klass, *args, **kwargs): """Return an object or ``None`` if the object doesn't exist.""" queryset = _get_queryset(klass) try: return queryset.get(*args, **kwargs) except queryset.model.DoesNotExist: ...
2.140625
2
problems/DivisionTwo_Practice/solution.py
Pactionly/SpringComp2019
1
12794199
print("Hello World from Division Two!")
1.328125
1
story/serializers.py
mshirdel/socialnews
0
12794200
from rest_framework import serializers from accounts.serializers import UserSerializer from .models import Story class StorySerializer(serializers.ModelSerializer): user = UserSerializer(read_only=True) class Meta: model = Story fields = [ "id", "title", "s...
2.671875
3
development/server/algorithm/tf_faster_rcnn/data_processing/small_tools/get_you_need_label_img.py
FMsunyh/re_com
0
12794201
<filename>development/server/algorithm/tf_faster_rcnn/data_processing/small_tools/get_you_need_label_img.py<gh_stars>0 # -*- coding: utf-8 -*- # @Time : 5/24/2018 # @Author : CarrieChen # @File : get_you_need_label_img.py # @Software: ZJ_AI # this code is for read some labels from excel and find according imgs ...
2.5625
3
xy_python_utils/image_utils.py
yxiong/xy_python_utils
0
12794202
#!/usr/bin/env python # # Author: <NAME>. # Created: Dec 11, 2014. """Some utility functions to handle images.""" import math import numpy as np import PIL.Image from PIL.Image import ROTATE_180, ROTATE_90, ROTATE_270, FLIP_TOP_BOTTOM, FLIP_LEFT_RIGHT import skimage.transform def imcast(img, dtype, color_space="defa...
3.390625
3
main.py
takat0m0/test_solve_easy_maze_with_Q
0
12794203
# -*- coding:utf-8 -*- import os import sys import numpy as np from simulater import Simulater from play_back import PlayBack, PlayBacks COMMAND = ['UP', 'DOWN', 'LEFT', 'RIGHT'] def get_max_command(target_dict): return max([(v,k) for k,v in target_dict.items()])[1] def simplify(command): return command[...
2.71875
3
pyvac/helpers/holiday.py
sayoun/pyvac
21
12794204
<reponame>sayoun/pyvac # import time import logging import calendar from datetime import datetime from workalendar.europe import France, Luxembourg from workalendar.usa import California from workalendar.asia import Taiwan log = logging.getLogger(__file__) conv_table = { 'fr': France, 'us': California, ...
2.5625
3
utils.py
wuch15/Sentiment-debiasing
0
12794205
from numpy.linalg import cholesky import numpy as np def senti2cate(x): if x<=-0.6: return 0 elif x>-0.6 and x<=-0.2: return 1 elif x>-0.2 and x<0.2: return 2 elif x>=0.2 and x<0.6: return 3 elif x>=0.6: return 4 def dcg_score(y_true, y_score,...
2.703125
3
sjb/hack/determine_install_upgrade_version_test.py
brenton/aos-cd-jobs
45
12794206
<reponame>brenton/aos-cd-jobs import unittest from determine_install_upgrade_version import * class TestPackage(object): def __init__(self, name, version, release, epoch, vra, pkgtup): self.name = name self.version = version self.release = release self.epoch = epoch self.vra = vra self.pkgtup = pkgtup d...
2.390625
2
radionica-petak/hamster.py
Levara/pygame-hamster
0
12794207
<reponame>Levara/pygame-hamster # ukljucivanje biblioteke pygame import pygame import random #inicijalizacija pygame pygame.init() #inicijalizacije fontova pygame.font.init() # definiranje konstanti za velicinu prozora WIDTH = 1024 HEIGHT = 600 # tuple velicine prozora size = (WIDTH, HEIGHT) #definiranje boja - gug...
3.109375
3
mizarlabs/tests/transformers/test_average_uniqueness.py
MizarAI/mizar-labs
18
12794208
<gh_stars>10-100 import pandas as pd import pytest from mizarlabs.static import CLOSE from mizarlabs.transformers.sampling.average_uniqueness import AverageUniqueness from mizarlabs.transformers.targets.labeling import TripleBarrierMethodLabeling @pytest.mark.usefixtures("dollar_bar_dataframe") def test_average_uniq...
2.34375
2
ingestion/8.ingest_qualifying_file.py
iamrahulsen/formula-1-data-analysis
0
12794209
# Databricks notebook source # MAGIC %md # MAGIC ### Ingest qualifying json files # COMMAND ---------- dbutils.widgets.text("p_data_source", "") v_data_source = dbutils.widgets.get("p_data_source") # COMMAND ---------- dbutils.widgets.text("p_file_date", "2021-03-21") v_file_date = dbutils.widgets.get("p_file_date"...
2.8125
3
pool/cmd.py
jan-g/pool-balls
0
12794210
<filename>pool/cmd.py<gh_stars>0 from __future__ import print_function import argparse import os import sys import pool.demo def main(): print(os.getcwd()) print(os.listdir(".")) print(os.listdir("tools")) parser = argparse.ArgumentParser( description='ball locator') parser.add_argument(...
2.515625
3
src/ctc/protocols/curve_utils/pool_lists.py
fei-protocol/checkthechain
94
12794211
from __future__ import annotations import typing from typing_extensions import TypedDict from ctc import evm from ctc import rpc from ctc import spec old_pool_factory = '0x0959158b6040d32d04c301a72cbfd6b39e21c9ae' pool_factory = '0xb9fc157394af804a3578134a6585c0dc9cc990d4' eth_address = '0xeeeeeeeeeeeeeeeeeeeeeeeeee...
2.125
2
Advent2015/6.py
SSteve/AdventOfCode
0
12794212
import numpy as np import re lineRegex = re.compile(r"(turn on|turn off|toggle) (\d+),(\d+) through (\d+),(\d+)") def day6(fileName): lights = np.zeros((1000, 1000), dtype=bool) with open(fileName) as infile: for line in infile: match = lineRegex.match(line) if match: for x in range(int(match[2]), int(m...
3.0625
3
client/configuration_monitor.py
fabiomassimo/pyre-check
1
12794213
<gh_stars>1-10 # Copyright (c) 2016-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-unsafe import logging import os from logging import Logger from typing import Any, Dict, List from .analysis_directory impor...
1.96875
2
Data.py
happylittlecat2333/travel_simulation
0
12794214
<filename>Data.py city_dangers = {'南京': 0.5, '北京': 0.9, '成都': 0.5, '杭州': 0.2, '广州': 0.5, '武汉': 0.9, '上海': 0.9, '重庆': 0.2, '青岛': 0.9, '深圳': 0.2, '郑州': 0.5, '西安': 0.2} # 在城市停留的风险值 trans_dangers = {"汽车": 2, "火车": 5, "飞机": 9} # 交通工具的风险值 time_table_values = [] # 所有班次时间表 map_values = [] # 所有城市的经纬...
2.703125
3
readthedocs/config/utils.py
tkoyama010/readthedocs.org
4,054
12794215
"""Shared functions for the config module.""" def to_dict(value): """Recursively transform a class from `config.models` to a dict.""" if hasattr(value, 'as_dict'): return value.as_dict() if isinstance(value, list): return [ to_dict(v) for v in value ] if...
2.984375
3
qiandao.py
gyje/tieba_qiandao
7
12794216
import requests,time,gevent,gevent.monkey,re,os from threading import Thread import schedule from pyquery import PyQuery as pq gevent.monkey.patch_socket() url="http://tieba.baidu.com/mo/q---F55A5B1F58548A7A5403ABA7602FEBAE%3AFG%3D1--1-1-0--2--wapp_1510665393192_464/sign?tbs=af62312bf49309c61510669752&fid=152744&kw=" ...
2.375
2
setup.py
magamba/dreamerv2
97
12794217
<reponame>magamba/dreamerv2 import setuptools setuptools.setup( name="dreamerv2", version="1.0.0", description=( "Mastering Atari with Discrete World Models" ), license="MIT License", url="https://github.com/RajGhugare19/dreamerv2", packages=setuptools.find_packages(), )
1.101563
1
lib/spack/spack/util/web.py
koning/spack
0
12794218
# Copyright 2013-2019 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 __future__ import print_function import codecs import errno import re import os import os.path import shutil import ...
2.015625
2
hydrocarbon_problem/api/aspen_api.py
ADChristos/Aspen-RL
0
12794219
from typing import Tuple from Simulation import Simulation from hydrocarbon_problem.api.api_base import BaseAspenDistillationAPI from hydrocarbon_problem.api.types import StreamSpecification, ColumnInputSpecification, \ ColumnOutputSpecification, ProductSpecification, PerCompoundProperty PATH = 'C:/Users/s2199718...
2.53125
3
rssparser/tests/test_convert_module.py
disp1air/rss_parser
0
12794220
<filename>rssparser/tests/test_convert_module.py import unittest from rssparser.convert_module import rss_items_to_list, rss_to_dict class TestConvertModule(unittest.TestCase): def test_rss_items_to_list(self): self.assertEqual(rss_items_to_list([{}]), [{}]) def test_rss_to_dict(self): self.a...
2.6875
3
SciGen/Network/utilities.py
SamuelSchmidgall/SciGen
1
12794221
import random def ReLU(x, derivative=False): """ ReLU function with corresponding derivative """ if derivative: x[x <= 0] = 0 x[x > 0] = 1 return x x[x < 0] = 0 return x def ReLU_uniform_random(): """ Ideal weight starting values for ReLU """ return random.uniform(0.00...
3.875
4
ipypdf/widgets/canvas.py
JoelStansbury/ipypdf
0
12794222
from ipycanvas import MultiCanvas CANVAS_TYPE_KWARGS = { "section": {"color": "blue"}, "text": {"color": "black"}, "image": {"color": "red"}, "pdf": {"color": "black"}, # Unused "folder": {"color": "black"}, # Unused "table": {"color": "green"}, } class PdfCanvas(MultiCanvas): def __ini...
2.921875
3
[Kaleido-subs]/Dropped/FGO - Absolute Demonic Front - Babylonia/ac_Babylonia_03.py
tuilakhanh/Encoding-Projects
57
12794223
<filename>[Kaleido-subs]/Dropped/FGO - Absolute Demonic Front - Babylonia/ac_Babylonia_03.py #!/usr/bin/env python3 import vapoursynth as vs import audiocutter import lvsfunc as lvf from subprocess import call core = vs.core ts_in = r'03/Fate Grand Order_ Zettai Majuu Sensen Babylonia - 03 (MX).d2v' src = lvf.src(ts...
1.820313
2
test/message_test.py
gavincyi/Telex
0
12794224
#!/bin/python import unittest import logging import os import sys from src.message import message class message_test(unittest.TestCase): def test_from_message_record(self): message_record = message( msg_id=185, channel_id=82, ...
3.359375
3
djsubject/__init__.py
ttngu207/canonical-colony-management
0
12794225
from .subject import schema as subject
1.0625
1
backend/app/models/episode.py
flsworld/comment-rick-n-morty
0
12794226
from sqlalchemy import Column, Integer, String, Date from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.orm import relationship from app.db.session import Base from app.models import CharacterEpisode class Episode(Base): __tablename__ = "episode" id = Column(Integer, primary_key=T...
2.625
3
BG-NBD_model/3_training_prediction_evaluation.py
les1smore/Stat-Notes
0
12794227
<filename>BG-NBD_model/3_training_prediction_evaluation.py # Fitting from lifetimes import BetaGeoFitter # instantiation of BG-NBD model bgf = BetaGeoFitter(penalizer_coef = 0.0) # fitting of BG-NBD model bgf.fit(frequency = rfm_cal_holdout['frequency_cal'], recency = rfm_cal_holdout['recency_cal'], T...
2.71875
3
blkdiscovery/lsblk.py
jaredeh/blkdiscovery
0
12794228
import json #hack for python2 support try: from .blkdiscoveryutil import * except: from blkdiscoveryutil import * class LsBlk(BlkDiscoveryUtil): def disks(self): retval = [] parent = self.details() for path, diskdetails in parent.items(): if not diskdetails.get('type') ...
2.4375
2
Env/discretize.py
mikema2019/Deep-reinforcement-learning
1
12794229
import numpy as np import tensorflow as tf def discretize(value,action_dim,n_outputs): discretization = tf.round(value) discretization = tf.minimum(tf.constant(n_outputs-1, dtype=tf.float32,shape=[1,action_dim]), tf.maximum(tf.constant(0, dtype=tf.float32,shape=[1,action_dim]), tf....
2.9375
3
developmentHub/posts/tests/test_models.py
MariiaBel/developmentHub
0
12794230
<reponame>MariiaBel/developmentHub from django.test import TestCase from django.contrib.auth import get_user_model from ..models import Post, Group User = get_user_model(); class PostModelTest(TestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.user = User.objects.create(use...
2.578125
3
ChessAI/GameController/game_board.py
PavelLebed20/chess_classic
1
12794231
import copy import sys import ChessAI.GameController.game_figures as Figures from ChessBoard.chess_board import Board from ChessBoard.chess_figure import FigureType, Side from Vector2d.Vector2d import Vector2d, Move class GameBoard: default_white_king_pos = Vector2d(4, 7) default_black_king_pos = Vector2d(4,...
2.96875
3
scripts/map_price.py
allinbits/gravity-dex-stats
2
12794232
<gh_stars>1-10 import csv import sys import requests def get_pools(): url = "https://staging.demeris.io/v1/liquidity/cosmos/liquidity/v1beta1/pools" r = requests.get(url) return r.json()["pools"] def get_balance(addr): url = "https://staging.demeris.io/v1/liquidity/cosmos/bank/v1beta1/balances/" + ...
2.5
2
publicationData/paperResultsScripts/Fig2_Extended-model.py
pranasag/extendedEcoliGEM
1
12794233
import cbmpy import numpy as np import os import sys import pandas as pd import re modelLoc = sys.argv[1] growthMediumLoc = sys.argv[2] scriptLoc = sys.argv[3] proteomicsLoc = sys.argv[4] resultsFolder = sys.argv[5] model = cbmpy.CBRead.readSBML3FBC(modelLoc, scan_notes_gpr = False) growthData = pd.read_csv(growthMed...
2.53125
3
HSPpipe/callall.py
fedhere/getlucky
0
12794234
import sys,os,time import pyfits as PF sys.path.append("../LIHSPcommon") from myutils import mygetenv,readconfig, mymkdir, mjd speedyout=mygetenv('SPEEDYOUT') def readconfig(configfile): f = open(configfile, 'r') config_string = f.read() parameters = eval(config_string) return parameters #unspool de...
2.109375
2
maskrcnn/tflite_convert.py
hqbao/dlp_tf
0
12794235
<filename>maskrcnn/tflite_convert.py import numpy as np from datetime import datetime import matplotlib.pyplot as plt import tensorflow as tf from pycocotools.coco import COCO from matplotlib.patches import Rectangle from models import build_inference_maskrcnn_non_fpn from utils import genanchors, box2frame from setti...
1.953125
2
lib/augment3D/elastic_deform.py
utayao/MedicalZooPytorch
1
12794236
import numpy as np from scipy.interpolate import RegularGridInterpolator from scipy.ndimage.filters import gaussian_filter """ Elastic deformation of images as described in <NAME>, "Best Practices for Convolutional Neural Networks applied to Visual Document Analysis", in Proc. of the International Conference on D...
2.8125
3
tensorflow_graphics/projects/nasa/lib/utils.py
Liang813/graphics
2,759
12794237
# Copyright 2020 The TensorFlow Authors # # 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 i...
1.8125
2
setup.py
vermakhushboo/sedpy
16
12794238
<filename>setup.py from setuptools import setup # The text of the README file with open("README.md", 'r') as f: long_description = f.read() # This call to setup() does all the work setup(name="sedpy", version="1.0.0", description="Cross-platform stream-line editing tool", long_description=long_d...
1.671875
2
dht/main.py
leonkoens/dht
1
12794239
<filename>dht/main.py import argparse import asyncio import importlib import logging import random import settings import string from collections import deque from dht.node import SelfNode from dht.protocol import DHTServerProtocol, DHTClientProtocol from dht.routing import BucketTree from dht.utils import hash_strin...
2.3125
2
my_files_utils.py
luisst/Audio_Performance_Evaluation
0
12794240
<reponame>luisst/Audio_Performance_Evaluation<filename>my_files_utils.py<gh_stars>0 #!/usr/bin/env python3 """ Utilities functions to check and find files from UNIX-based systems This should be syncronized for all of my repos """ import glob import os import sys import shutil import re import numpy as np import pand...
2.6875
3
MNIST/mnist_keras.py
im0qianqian/ML_demo
2
12794241
import keras import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.datasets import mnist x_train = None y_train = None x_test = None y_test = None def init(): global x_train, y_train, x_test, y_test (x_train_tmp, y_train_tmp), (x_test_tmp, y_test_tmp) = mnist.load_d...
3.09375
3
examples/exception.py
pawelmhm/scrapy-playwright
155
12794242
import logging from pathlib import Path from scrapy import Spider, Request from scrapy.crawler import CrawlerProcess from scrapy_playwright.page import PageCoroutine class HandleTimeoutMiddleware: def process_exception(self, request, exception, spider): logging.info("Caught exception: %s", exception.__cl...
2.515625
3
Labs/Lab-3.1/fan.py
Josverl/MicroPython-Bootcamp
4
12794243
from machine import Pin, PWM # Initialization pwmFan = PWM(Pin(21), duty=0) reverseFan = Pin(22, Pin.OUT) # Turn Fan forward 70% speed reverseFan.value(0) pwmFan.duty(70) # Decrease speed pwmFan.duty(50) # Decrease speed further (it might stop) pwmFan.duty(30) # Turn Fan backwards 70% speed reverseFan.value(1) pwmFan...
3.265625
3
submissions/aising2019/b.py
m-star18/atcoder
1
12794244
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) a, b = map(int, readline().split()) p = list(map(int, readline().split())) memo = [0, 0, 0] for check in p: if check <= a: memo[0] += 1 ...
2.6875
3
flog/user/__init__.py
mutalisk999/Flog
1
12794245
""" MIT License Copyright (c) 2020 <NAME> """ from flask import Blueprint user_bp = Blueprint("user", __name__) from . import views
1.4375
1
examples/icml_2018_experiments/scripts/generate_all_cave_reports.py
kaddynator/BOAH
58
12794246
<gh_stars>10-100 import os from cave.cavefacade import CAVE def analyze_all(): for dirpath, dirnames, filenames in os.walk('../opt_results/'): if not dirnames: print(dirpath) cave = CAVE(folders=[dirpath], output_dir=os.path.join("../CAVE_reports", dirpath[1...
2.578125
3
Pacote download/Exercicios/tabuada com while.py
Henrique-GM/Exercicios_de_Python
0
12794247
while True: numero = int(input('Digite um número: ')) i = 0 while i <= 10: print(f'{numero} x {i} = {numero * i}') i += 1 resposta = str(input('Deseja continuar[S/N]: ')).strip().upper()[0] if resposta == 'N': break
3.890625
4
tests.py
cooperlees/69
2
12794248
#!/usr/bin/env python3 import asyncio import unittest import sixtynine class TestSixtynine(unittest.TestCase): def setUp(self): self.loop = asyncio.get_event_loop() def tearDown(self): self.loop.close() def test_mouthful(self): self.assertEqual(self.loop.run_until_complete(sixt...
2.625
3
GoingMerry/__init__.py
Luffin/ThousandSunny
0
12794249
<gh_stars>0 import os from tornado import web from settings import * from handlers import handlers theme_path = os.path.join(os.path.dirname(__file__), 'themes', theme_name) class Application(web.Application): def __init__(self): settings = dict( static_path = os.path.join(theme_path, 'static'), template_...
1.9375
2
number_reader.py
CoffeeCodeRpt/python-crash-course
0
12794250
<reponame>CoffeeCodeRpt/python-crash-course<filename>number_reader.py from fileinput import filename import json filename = 'chapter_10/numbers.json' with open(filename) as f_object: numbers = json.load(f_object) print(numbers)
3.3125
3