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 |
|---|---|---|---|---|---|---|
apps/trac/migrations/0017_checkpoint_distance_units.py | tractiming/trac-gae | 3 | 12789151 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('trac', '0016_auto_20160303_2353'),
]
operations = [
migrations.AddField(
model_name='checkpoint',
na... | 1.773438 | 2 |
linuxTutorial.py | kumarashit/ExploreTheTux | 1 | 12789152 | <filename>linuxTutorial.py<gh_stars>1-10
#!/usr/bin/env python3
import os
import re
#import sys
commands = {"list" : 'ls', 'long-list': 'ls -ltr', 'pwd' : '<PASSWORD>', 'change-dir':'cd', 'create-dir': 'mkdir', 'delete': 'rm',
'display':'cat', 'rename': 'mv', 'copy' : 'cp', 'modify_perm':'chmod'}
commands_lea... | 3.359375 | 3 |
utils/nico_spliter.py | Luodian/Learning-Invariant-Representations-and-Risks | 17 | 12789153 | <reponame>Luodian/Learning-Invariant-Representations-and-Risks<filename>utils/nico_spliter.py
import os
# used to remove all .DS_Store files from mac os.
def file_fliter(root_path):
for home, dirs, files in os.walk(root_path):
for file_name in files:
if file_name.startswith("."):
... | 3.09375 | 3 |
or_testbed/solvers/tabusearch/multistart.py | Fynardo/or-testbed | 1 | 12789154 | <reponame>Fynardo/or-testbed
# -*- coding:utf-8 -*-
import or_testbed.solvers.base.solver as base_solver
class MultiStartTabuSearch(base_solver.MultiStartSolver):
"""
MultiStart version of Tabu Search.
This is just an extension of base multistart solver. It works fine out of the box.
... | 2.078125 | 2 |
app/__init__.py | ryzencool/flask_arch | 0 | 12789155 | <filename>app/__init__.py
from flask import Flask
from app.api import user, trans
app_starter = Flask(__name__)
app_starter.register_blueprint(user, url_prefix="/user")
app_starter.register_blueprint(trans, url_prefix="/trans") | 2.03125 | 2 |
src/psiz/keras/layers/similarities/inverse.py | greenfieldvision/psiz | 21 | 12789156 | <filename>src/psiz/keras/layers/similarities/inverse.py
# -*- coding: utf-8 -*-
# Copyright 2020 The PsiZ 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
#
# ... | 2.5625 | 3 |
fixtitle.py | qingzma/cnd | 1 | 12789157 | <filename>fixtitle.py
import math
fname1 = "paper.csv"
fname2 = "paper_fixed.csv"
with open(fname2, 'w') as f2:
with open(fname1, 'r') as f1:
for line in f1.readlines():
spl = line.split(",")
if len(spl) < 4:
continue
f2.write(spl[0])
f2.write(",")
f2.write(";".join(spl[1:-2]))
f... | 2.6875 | 3 |
bpprosdk/websockets/orderbook/orderbook.py | Tibi-Bitpanda/bitpanda-pro-sdk-py | 17 | 12789158 | <filename>bpprosdk/websockets/orderbook/orderbook.py
"""Order Book model"""
import json
from decimal import Decimal
class OrderBook:
"""Stores the state of the order book"""
def __init__(self):
self.asks = dict()
self.bids = dict()
self.instrument_code = None
def get_bids(self):... | 2.78125 | 3 |
llama/tests/ping_test.py | anirudh-ramesh/llama | 0 | 12789159 | """Unittests for metrics lib."""
from llama import ping
from llama import util
import pytest
def fake_runcmd(cmd):
stderr = '''
--- shelby hping statistic ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.1/0.1/0.2 ms
'''
stdout = '''
HPING shelby (e... | 2.265625 | 2 |
src/scottbrian_throttle/throttle.py | ScottBrian/scottbrian_throttle | 0 | 12789160 | """Module throttle.
========
Throttle
========
The throttle allows you to limit the rate at which a function is
executed. This is helpful to avoid exceeding a limit, such as when
sending requests to an internet service that specifies a limit as to the
number of requests that can be sent in a specific time interval.
... | 3.375 | 3 |
data_parallel_nn.py | jbram22/blackjack_parallel_neural_network | 0 | 12789161 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # This is a data-parallelized Neural Network # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
############################################################################################################
#############################... | 2.453125 | 2 |
oauth2_backend/migrations/0001_initial.py | practian-reusable-applications/django-oauth2-backend | 0 | 12789162 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-29 03:12
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import oauth2_backend.models.use... | 2 | 2 |
scraper/storage_spiders/giadungsmartcom.py | chongiadung/choinho | 0 | 12789163 | # Auto generated by generator.py. Delete this line if you make modification.
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
XPATH = {
'name' : "//div[@class='tensp']/h2",
'price' : "//div[@class='pd-right fr']/p[@class='p-price']",
'category' : "//ul[@class='breadcrumb all'... | 2.125 | 2 |
aiopyarr/models/common.py | yoki31/aiopyarr | 1 | 12789164 | <filename>aiopyarr/models/common.py
"""Common Models."""
# pylint: disable=invalid-name, too-many-instance-attributes
from __future__ import annotations
from dataclasses import dataclass
from aiopyarr.models.base import APIResponseType, BaseModel
@dataclass(init=False)
class Diskspace(BaseModel):
"""Radarr disk... | 2.359375 | 2 |
course_02_python_data_structures/week_5/give_most_mails.py | RicardoRodriguesCosta/python_for_everybody | 0 | 12789165 | name = input("Enter file:")
if len(name) < 1 : name = "mbox-short.txt"
handle = open(name)
emails = dict()
for line in handle:
list_line = line.split()
if len(list_line) > 1 and list_line[0] == "From":
emails[list_line[1]] = emails.get(list_line[1], 0) + 1
else:
continue
mostemails_key = ... | 3.546875 | 4 |
cgbind/add_substrate.py | duartegroup/cgbind | 7 | 12789166 | from cgbind.log import logger
from copy import deepcopy
import numpy as np
from cgbind.constants import Constants
from rdkit.Chem import AllChem
from scipy.optimize import minimize, Bounds
from scipy.spatial import distance_matrix
from cgbind import geom
from cgbind.atoms import get_vdw_radii
from cgbind.geom import ro... | 2.40625 | 2 |
src/old_encoder_decoder.py | suhasjs/upgraded-system | 1 | 12789167 | <reponame>suhasjs/upgraded-system<filename>src/old_encoder_decoder.py
import collections
import csv
import random
import numpy as np
import tensorflow as tf
def _read_words(filename):
with tf.gfile.GFile(filename, "r") as f:
return filter(None, f.read().decode("utf-8").replace(".", " <eos>").
... | 2.453125 | 2 |
python/parsers/modules/molecular_formula.py | ajmaurais/ms2_annotator | 4 | 12789168 | <gh_stars>1-10
import re
from collections import Counter
from modules import atom_table
class MolecularFormula(object):
_FORMULA_RESIDUE_ORDER = ['C', '(13)C', 'H', 'D', 'Br', 'Cl', 'N',
'(15)N', 'O', '(18)O', 'P', 'S', 'Se']
def __init__(self, seq='', n_term=True, c_term=Tru... | 2.796875 | 3 |
api/test.py | mingweiarthurli/CMPUT-404-Project | 0 | 12789169 | <reponame>mingweiarthurli/CMPUT-404-Project
import re
# text = ["http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013",
# "http://127.0.0.1:5454/author/ae345d54-75b4-431b-adb2-fb6b9e547891",]
text = "https://cmput404-socialdistribution.herokuapp.com/posts/da61a3f4-8cfb-4046-881f-50e12bfb4a4d"
# for t i... | 2.734375 | 3 |
tensorcv/train/lr_policy.py | afcarl/tensorcv | 1 | 12789170 | import tensorflow as tf
def fixed(global_step, params):
assert 'base_lr' in params, 'base_lr must in params'
lr = tf.constant(params['base_lr'])
tf.summary.scalar('learining_rate', lr)
return lr
def exponential_decay(global_step, params):
assert 'base_lr' in params, 'base_lr must in params'
... | 2.203125 | 2 |
scripts/generate_mo.py | SiKreuz/discord-birthday-bot | 1 | 12789171 | import os
from pythongettext import msgfmt
LOCALE_PATH = os.path.join('..', 'discord_birthday_bot', 'locale')
for subdir, dirs, files in os.walk(LOCALE_PATH):
for filename in files:
if filename.endswith('.po'):
path = os.path.join(subdir, filename)
mo_str = msgfmt.Msgfmt(path).get... | 2.796875 | 3 |
classification_aromatic_substitution/predict_desc/post_process.py | coleygroup/QM-augmented_GNN | 11 | 12789172 | from rdkit import Chem
import pandas as pd
import numpy as np
from tqdm import tqdm
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import RobustScaler
tqdm.pandas()
GLOBAL_SCALE = ['partial_charge', 'fukui_neu', 'fukui_elec']
ATOM_SCALE = ['NMR']
def check_chemprop_out(df):
invalid = ... | 2.453125 | 2 |
Modulo-03/ex112/utilidadescev/moeda/__init__.py | Matheus-Henrique-Burey/Curso-de-Python | 0 | 12789173 | def almentar(preco, taxa, formato=False):
res = preco + preco * taxa / 100
return res if not formato else moeda(res)
def diminuir(preco, taxa, formato=False):
res = preco - preco * taxa / 100
return res if not formato else moeda(res)
def dobro(preco, formato=False):
res = preco * 2
return re... | 3.375 | 3 |
vega/algorithms/nas/adelaide_ea/adelaide_trainer_callback.py | Lzc06/vega | 12 | 12789174 | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... | 2.15625 | 2 |
pymesm.py | x86128/pymesm | 2 | 12789175 | <gh_stars>1-10
#!/usr/bin/env python3
import argparse
import sys
from mesm_devs import Bus, RamDevice, Printer
from mesm_cpu import CPU
from mesm_utils import load_oct
argp = argparse.ArgumentParser()
argp.add_argument("-i", required=True, dest="input", help="Input *.oct file")
argp.add_argument("-c", default=100, ty... | 2.421875 | 2 |
Designning the System Latest/LLF_Schedule.py | JoHussien/rl_mc_scheduler | 1 | 12789176 | <filename>Designning the System Latest/LLF_Schedule.py
from env.job_generator import create_workload
import numpy as np
def compute_SCP_MBS(num_jobs, total_load, lo_per, job_density, time):
# We schedule here using LLF and compute the MBS of the generated Schedule
workload = create_workload(num_jobs, ... | 2.671875 | 3 |
app/v1/authentication.py | arnxun/Space | 0 | 12789177 | import os
import re
from flask import g, jsonify, request
from flask_httpauth import HTTPTokenAuth # HTTPBasicAuth
from app.models import User
from app.v1 import api
from app.v1.errors import forbidden, unauthorized
from config import config
auth = HTTPTokenAuth()
@auth.verify_token
def verify_token(token):
g... | 2.859375 | 3 |
scripts/debugging.py | falkben/zoo-checks | 0 | 12789178 | """to be run from root directory
"""
import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
django.setup()
from django.db.models.functions import Cast
from django.db.models.fields import DateField
from zoo_checks.models import AnimalCount, Enclosure, GroupCount, SpeciesCount
from... | 2.125 | 2 |
tests/highlevel/transformer-redefine.py | sjdv1982/seamless | 15 | 12789179 | <reponame>sjdv1982/seamless
import os, tempfile
from seamless.highlevel import Context, Cell
import json
ctx = Context()
ctx.transform = lambda a,b: a + b
ctx.transform.a = 2
ctx.transform.b = 3
ctx.translate()
ctx.transform.example.a = 0
ctx.transform.example.b = 0
ctx.result = ctx.transform
ctx.result.celltype = "... | 2.09375 | 2 |
tests/test_workers.py | iawn/live2p | 0 | 12789180 | <reponame>iawn/live2p
import logging
from glob import glob
from queue import Queue
import sys
from pathlib import Path
from live2p.utils import ptoc, tic, get_true_mm3d_range
from live2p.offline import prepare_init
from live2p.workers import RealTimeQueue
# logging setup
# change for more or less information...
caima... | 2.0625 | 2 |
metnet_pytorch/model.py | tcapelle/metnet_pytorch | 15 | 12789181 | # AUTOGENERATED! DO NOT EDIT! File to edit: 01_model.ipynb (unless otherwise specified).
__all__ = ['DownSampler', 'TemporalEncoder', 'condition_time', 'ConditionTime', 'feat2image', 'MetNet',
'metnet_splitter']
# Cell
from .layers import *
from fastai.vision.all import *
# Cell
def DownSampler(in_channel... | 2.28125 | 2 |
main.py | pannoi/cdn-dns-controller | 1 | 12789182 | <reponame>pannoi/cdn-dns-controller
from flask import Flask, jsonify
from flask import make_response
from flask import request
import logging
from src.route53 import Route53
from src.cloudfront import CloudFront
app = Flask(__name__)
# Route53 routes
@app.route('/zones/', methods=['GET'])
def list_host... | 2.671875 | 3 |
game/upl/upl_scripts/storage.py | Sipondo/ulix-dexflow | 5 | 12789183 | <filename>game/upl/upl_scripts/storage.py
"""function
Opens the battler storage.
Opens the battler storage.
in:
None
"""
class Storage:
def __init__(self, act, src, user):
act.funcs.append(self)
self.init_time = act.current_time
self.act = act
self.src = src
self.user =... | 2.515625 | 3 |
utility/__init__.py | Krishna10798/Multi-User-Blog | 5 | 12789184 | <reponame>Krishna10798/Multi-User-Blog<filename>utility/__init__.py
from utility import hash_str, check_secure_val, make_secure_val,\
valid_email, valid_username, valid_password
from filters import filterKey, showCount
| 1.125 | 1 |
logging/logging_api/logging_api_example_2_new_format.py | levs72/pyneng-examples | 11 | 12789185 | import logging
logger = logging.getLogger("__name__")
logger.setLevel(logging.DEBUG)
console = logging.StreamHandler()
console.setLevel(logging.DEBUG)
formatter = logging.Formatter(
"{asctime} - {name} - {levelname} - {message}", datefmt="%H:%M:%S", style="{"
)
console.setFormatter(formatter)
logger.addHandler(c... | 2.75 | 3 |
Controllers/CommonModules/authfunc.py | SoulfulArt/BugTracker | 0 | 12789186 | <gh_stars>0
def login_test(request, User):
#login test
user_data = User.objects.all()
user = request.user
user_session = user_data.filter(user_username__exact=user.username)
if user.is_authenticated and user_session[0].user_type=="Admin":
return True
else:
return False
| 2.390625 | 2 |
phr/establecimiento/api/urls.py | richardqa/django-ex | 0 | 12789187 | <filename>phr/establecimiento/api/urls.py
# coding=utf-8
from django.conf.urls import include, url
from phr.establecimiento.api.views import (
DetalleEstablecimientoAPIView, DiresaDetalleAPI, ListaDiresaAPI, ListaEstablecimientoAPI,
ListaEstablecimientoGrupoAPI, ListaEstablecimientoPorCategoriaAPI, ListaEstabl... | 1.84375 | 2 |
web_app/__init__.py | yalyakoob/TwitOff | 0 | 12789188 | """Entry point for TwitOff Flask application."""
from web_app.app import create_app
APP = create_app() | 1.273438 | 1 |
SSF_mip/evaluation/evaluation.py | Sijie-umn/SSF-MIP | 6 | 12789189 | import pickle
import numpy as np
import pandas as pd
from numpy import linalg as LA
from scipy import stats
import sys
def compute_rmse(target, prediction):
"""Compute rmse between the ground truth and forecasts
Args:
target: a numpy array with ground truth
forecasts: a numpy array with forecasted val... | 3.359375 | 3 |
lib/python2.7/site-packages/whitenoise/storage_backport.py | vipulkanade/EventbriteDjango | 1 | 12789190 | <filename>lib/python2.7/site-packages/whitenoise/storage_backport.py
from __future__ import absolute_import, unicode_literals
import json
from django.contrib.staticfiles.storage import CachedStaticFilesStorage
class ManifestStaticFilesStorage(CachedStaticFilesStorage):
"""
Basic emulation of ManifestStaticF... | 2.5 | 2 |
qatrack/faults/migrations/0006_auto_20210317_1651.py | crcrewso/qatrackplus | 20 | 12789191 | <reponame>crcrewso/qatrackplus
# Generated by Django 2.2.18 on 2021-03-17 20:51
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | 1.828125 | 2 |
prompt_tuning/data/preprocessors_test.py | dumpmemory/prompt-tuning | 108 | 12789192 | <reponame>dumpmemory/prompt-tuning
# Copyright 2022 Google.
#
# 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 applicabl... | 2.140625 | 2 |
src/visualize_data.py | h1yung/PyUpBit | 3 | 12789193 | <reponame>h1yung/PyUpBit
import sys
import numpy as np
import matplotlib.pyplot as plt
data = np.load(sys.argv[1])
plt.hist(data, edgecolor='k')
plt.show()
| 2.28125 | 2 |
iot/amqp/header/impl/AMQPAttach.py | mobius-software-ltd/iotbroker.cloud-python-client | 2 | 12789194 | <filename>iot/amqp/header/impl/AMQPAttach.py
"""
# Mobius Software LTD
# Copyright 2015-2018, Mobius Software LTD
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# ... | 1.515625 | 2 |
multi_dimensional_clustering/__init__.py | PieterMey/multi_dimensional_clustering | 1 | 12789195 | from .multi_D_clustering import MD_clustering
| 0.996094 | 1 |
_solutions/pandas/series/pandas_series_attributes.py | sages-pl/2022-01-pythonsqlalchemy-aptiv | 0 | 12789196 | <gh_stars>0
result = {
'number of dimensions': DATA.ndim,
'number of elements': DATA.size,
'data type': DATA.dtype,
'shape': DATA.shape,
}
| 1.859375 | 2 |
src/dashboard/settings/travis.py | travishen/aprp | 1 | 12789197 | from os import environ
from .base import *
# provide via Trais CI Dashboard
DAILYTRAN_BUILDER_API['amis'] = environ['AMIS_URL']
DAILYTRAN_BUILDER_API['apis'] = environ['APIS_URL']
DAILYTRAN_BUILDER_API['efish'] = environ['EFISH_URL']
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.post... | 1.453125 | 1 |
neural_compressor/ux/components/model/shape.py | intel/neural-compressor | 172 | 12789198 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Intel Corporation
#
# 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 r... | 2.53125 | 3 |
tests/test_default.py | jonhealy1/stac-validator | 2 | 12789199 | """
Description: Test the default which validates core and extensions
"""
__authors__ = "<NAME>", "<NAME>"
from stac_validator import stac_validator
def test_default_v070():
stac_file = "https://radarstac.s3.amazonaws.com/stac/catalog.json"
stac = stac_validator.StacValidate(stac_file)
stac.run()
as... | 2.265625 | 2 |
code/deep-high-resolution-net.pytorch/lib/core/function.py | SomaKishimoto/AwA-Pose | 12 | 12789200 | <filename>code/deep-high-resolution-net.pytorch/lib/core/function.py
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------... | 2.046875 | 2 |
ta_lab5/src/utils.py | vivekchand/TA_example_labs | 13 | 12789201 | <gh_stars>10-100
#!/usr/bin/env python
import rospy
import numpy as np
from std_msgs.msg import Header
from visualization_msgs.msg import Marker
from geometry_msgs.msg import Point, Pose, PoseStamped, PoseArray, Quaternion, PolygonStamped,Polygon, Point32, PoseWithCovarianceStamped, PointStamped
import tf.transformat... | 2.734375 | 3 |
gallery/models.py | reddevilcero/SchoolWeb | 0 | 12789202 | from django.db import models
from core.models import BaseModel
from django.utils.translation import gettext as _
# Create your models here.
class GalleryImage(BaseModel):
name = models.CharField(_("Picture Name"), max_length=50)
picture = models.ImageField(_("Image"), upload_to="img/gallery")
def __str... | 2.25 | 2 |
hinkaponka/__init__.py | shinjiniray/testpackage | 0 | 12789203 | from . import helloworld
__all__ = [
'helloworld'
]
| 1.0625 | 1 |
pyCWD/mesh.py | rdzotz/Coda-Analysis | 7 | 12789204 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 4 11:19:57 2018
@author: rwilson
"""
import pygmsh
import meshio
import numpy as np
import pickle
class utilities():
'''A collection of functions for interacting with the mesh object
'''
def meshOjfromDisk(meshObjectPath='cly.Mesh')... | 3.15625 | 3 |
dstl/translate/__init__.py | kabirkhan/dstl | 2 | 12789205 | <reponame>kabirkhan/dstl
from .azure import AzureTranslator
from .google import GoogleTranslator
from .transformers import TransformersMarianTranslator
| 0.859375 | 1 |
src/ising_animate/__init__.py | davifeliciano/ising_model | 2 | 12789206 | """
A Python Package to easily generate animations of the Ising Model using the Metropolis Algorithm,
the most commonly used Markov Chain Monte Carlo method to calculate estimations for this system.
"""
from .ising import Ising, AnimatedIsing, CoolingAnimatedIsing, DynamicAnimatedIsing
| 2.484375 | 2 |
src/test_who_likes_it.py | hcodydibble/code-katas | 0 | 12789207 | """Test function for who_likes_it module."""
import pytest
TEST_DATA = [([], "no one likes this"),
(["Peter"], "Peter likes this"),
(["Jacob", "Alex"], "Jacob and Alex like this"),
(["Max", "John", "Mark"], "Max, John and Mark like this"),
(["Alex", "Jacob", "Mark",... | 3.1875 | 3 |
src/ml_preprocessing/encoding_helpers.py | mjasieczko/new_offer_success_predictor | 0 | 12789208 | import itertools
from typing import List, DefaultDict, Tuple
import numpy as np
import pandas as pd
from sklearn.base import clone
from sklearn.metrics import roc_auc_score
# from sklearn.metrics import recall_score, accuracy_score, confusion_matrix
from sklearn.model_selection import KFold
from .categorical_encoders... | 2.78125 | 3 |
solution/operators/create_users_0.0.1/content/files/vflow/subengines/com/sap/python36/operators/create_users/create_users.py | thhapke/workshop_registration | 0 | 12789209 | import sdi_utils.gensolution as gs
import subprocess
import io
import logging
import os
import string
import secrets
import base64
try:
api
except NameError:
class api:
queue = list()
class Message:
def __init__(self, body=None, attributes=""):
self.body = body
... | 1.992188 | 2 |
tohu/v7/foreach.py | maxalbert/tohu | 1 | 12789210 | import ast
import inspect
import textwrap
from .base import TohuBaseGenerator
from .ipython_support import get_ast_node_for_classes_defined_interactively_in_ipython
__all__ = ["Placeholder", "placeholder", "foreach"]
class Placeholder:
def __init__(self, name):
self.name = name
placeholder = Placeholde... | 2.140625 | 2 |
astr-119-session-4/python_use_module.py | jjohnst6260/astr-119 | 0 | 12789211 | <reponame>jjohnst6260/astr-119<filename>astr-119-session-4/python_use_module.py
# this uses the module
import test_module as tm
tm.hello_world() | 1.390625 | 1 |
venv/lib/python2.7/site-packages/sqlalchemy/testing/config.py | banianlabs/Stash-Prototype | 5 | 12789212 | <gh_stars>1-10
requirements = None
db = None
| 0.910156 | 1 |
generate_encryption_keys.py | dan-omniscience/private-secure-cloud-sorage | 0 | 12789213 | <reponame>dan-omniscience/private-secure-cloud-sorage
import os.path, errno, Crypto
from getpass import getpass
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
from Crypto import Random
private_key_filename = "s3-encrypt-sync_private-key.pem"
public_key_filename = "s3-encrypt-sync_public-key.pem"... | 2.59375 | 3 |
hpopt/examples/dexter.py | knowledge-learning/hp-optimization | 4 | 12789214 | # coding: utf-8
import random
from hpopt.datasets.uci.dexter import load_corpus
from ..sklearn import SklearnClassifier
def main():
X, y = load_corpus()
random.seed(0)
classifier = SklearnClassifier(popsize=100, select=20, iters=10, timeout=10, verbose=True)
classifier.fit(X, y)
if __name__ == "__... | 2.25 | 2 |
models/__init__.py | mihamerstan/lidar_ordered_points | 1 | 12789215 | <reponame>mihamerstan/lidar_ordered_points<filename>models/__init__.py
import importlib
import os
import torch.nn as nn
MODEL_REGISTRY = {}
def build_model(args):
return MODEL_REGISTRY[args.model].build_model(args)
def build_model_gan(args):
return MODEL_REGISTRY[args.modelG].build_model(args), MODEL_REGIS... | 2.421875 | 2 |
xuan wang/test.py | weruioghvn/alphalens | 0 | 12789216 | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 24 16:12:40 2021
@author: Administrator
"""
import alphalens
import pandas as pd
import numpy as np
# import warnings
# warnings.filterwarnings('ignore')
ticker_sector = {
"ACN" : 0, "ATVI" : 0, "ADBE" : 0, "AMD" : 0, "AKAM" : 0, "ADS" : 0, "GOOGL" : 0, "GOOG" : 0... | 1.867188 | 2 |
bttn.py | yunojuno/bttn-webhook | 0 | 12789217 | <reponame>yunojuno/bttn-webhook
# -*- coding: utf-8 -*-
"""bttn webhook handler."""
from os import getenv
import flask
import hipchat
app = flask.Flask(__name__)
# set of valid channels
CHANNELS = ('hipchat', 'sms')
# set of required form keys
FORM_KEYS = ('channel', 'recipient', 'message')
HIPCHAT_API_TOKEN = geten... | 2.53125 | 3 |
adapter/acumos/setup.py | onap/dcaegen2-platform | 0 | 12789218 | # ============LICENSE_START====================================================
# org.onap.dcae
# =============================================================================
# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
# ========================================================================... | 1.484375 | 1 |
test/integ/test_s3_checkpoint_save_timeout.py | jmazanec15/sagemaker-tensorflow-containers | 1 | 12789219 | <gh_stars>1-10
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.... | 1.546875 | 2 |
goodread/helpers.py | frictionlessdata/goodread | 2 | 12789220 | import os
import shutil
import tempfile
def ensure_dir(path):
dirpath = os.path.dirname(path)
if dirpath and not os.path.exists(dirpath):
os.makedirs(dirpath)
def move_file(source, target):
ensure_dir(target)
shutil.move(source, target)
def copy_file(source, target):
if isinstance(sour... | 3.15625 | 3 |
Advanced/Exercises/Multi_Dimentional_Lists_Exercise_2/4_easter_bunny.py | tankishev/Python | 2 | 12789221 | # On the first line, you will be given a number representing the size of the field. On the following few lines, you will be given a field with:
# • One bunny - randomly placed in it and marked with the symbol "B"
# • Number of eggs placed at different positions of the field and traps marked with "X"
# Your job is to de... | 4.4375 | 4 |
syscall_gen/generator.py | Globidev/strace | 0 | 12789222 | <reponame>Globidev/strace
#!/usr/bin/env python3
from urllib.request import urlopen
from bs4 import BeautifulSoup
from gzip import GzipFile
from os.path import join
import sys
DATABASE_URL = 'https://filippo.io/linux-syscall-table'
CONST_QUALIFIER = 'const'
SYMBOLS = {
'int': 'int_',
's32': ... | 2 | 2 |
test/run_all_tests.py | wjchen84/rapprentice | 23 | 12789223 | import rapprentice, os, os.path as osp
from rapprentice.call_and_print import call_and_print
assert osp.basename(os.getcwd()) == "test"
call_and_print("python tps_unit_tests.py")
call_and_print("python ../scripts/download_sampledata.py ~/Data --use_rsync")
call_and_print("python ../scripts/generate_h5.py ~/Data/sampled... | 1.992188 | 2 |
pycloud/pycloud/network/finder.py | SEI-AMS/pycloud | 14 | 12789224 | # KVM-based Discoverable Cloudlet (KD-Cloudlet)
# Copyright (c) 2015 Carnegie Mellon University.
# All Rights Reserved.
#
# THIS SOFTWARE IS PROVIDED "AS IS," WITH NO WARRANTIES WHATSOEVER. CARNEGIE MELLON UNIVERSITY EXPRESSLY DISCLAIMS TO THE FULLEST EXTENT PERMITTEDBY LAW ALL EXPRESS, IMPLIED, AND STATUTORY WARRANTIE... | 0.953125 | 1 |
src/pygrambank/commands/issue1797.py | glottobank/pygrambank | 2 | 12789225 | <filename>src/pygrambank/commands/issue1797.py
"""
"""
import itertools
import functools
# flake8: noqa
DATAPOINTS = """\
GB146 | Double check with Daria if there really is no concstruction of this type. | Mishchenko, Daria (p.c. 2013) | HS_loma1260.tsv
GB146 | Double check with Elena if there really is no such cons... | 2.03125 | 2 |
api_demo/mydate.py | ntlinh16/api-demo | 0 | 12789226 | <filename>api_demo/mydate.py<gh_stars>0
from datetime import datetime
def countdown(date=datetime.now()):
new_year = datetime(date.year + 1, 1, 1)
days_left = (new_year - date).days
return days_left
| 3.109375 | 3 |
mutations/mutation_role/mutation.py | akarapun/elearning | 1 | 12789227 | <reponame>akarapun/elearning
import graphene
from mutation_role.createRole import CreateRoleMutation
from mutation_role.updateRole import UpdateRoleMutation
from mutation_role.deleteRole import DeleteRoleMutation
class RoleMutation(
CreateRoleMutation,
UpdateRoleMutation,
DeleteRoleMutation,
graphene.... | 1.476563 | 1 |
pollbot/PollBot.py | Breee/pokemon-raid-bot | 0 | 12789228 | <filename>pollbot/PollBot.py
"""
MIT License
Copyright (c) 2018 Breee@github
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, c... | 1.945313 | 2 |
src/data/1238.py | NULLCT/LOMC | 0 | 12789229 | from collections import deque
def main():
N, Q = map(int, input().split())
path_dat = [list(map(int, input().split())) for _ in range(N - 1)]
queries = [list(map(int, input().split())) for _ in range(Q)]
paths = [[] for _ in range(N)]
for a, b in path_dat:
a -= 1
b -= 1
pa... | 3.234375 | 3 |
lib/models/gpt.py | learning-at-home/clip_hivemind | 3 | 12789230 | <filename>lib/models/gpt.py
# coding=utf-8
# Copyright 2018 Google AI, Google Brain and the HuggingFace Inc. team.
#
# 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.or... | 1.789063 | 2 |
tools/build/v2/test/testing_primitives.py | mike-code/boost_1_38_0 | 130 | 12789231 | #!/usr/bin/python
# Copyright 2002 <NAME>
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
import BoostBuild
import re
def match_re(actual, expected):
return re.match(expected, actual, re.DOTALL) != None
t = BoostBu... | 2.171875 | 2 |
tests/conftest.py | DenMaslov/dz4 | 0 | 12789232 | import pytest
from dz4.calculator.calculator import Calculator
@pytest.fixture()
def calculator() -> Calculator:
return Calculator()
| 1.664063 | 2 |
message_creator/actions_pb2.py | jameshp/deviceadminserver | 0 | 12789233 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: actions.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.prot... | 1.171875 | 1 |
Diena_8_dictionaries/u2_g2.py | edzya/Python_RTU_08_20 | 8 | 12789234 | # def replace_dict_value(d, bad_val, good_val):
# myDict = d
# for x in myDict: # same as going through x in myDict.keys()
# if myDict[x] == bad_val:
# myDict[x] = good_val
# return myDict
# if i do not want to mutate the original dictionary
# then dictionary comprehension will be easie... | 3.84375 | 4 |
python version/katona/katona.py | psychology-experiments/Five-square-problem | 0 | 12789235 | from typing import Optional
from psychopy import core, visual
from katona.logic import eventsmeasures
from katona.logic.datasaver import DataSaver
from katona.logic.movement import StickMover
from katona.logic import eventhandler
from katona.logic import essential
from katona.visual import optional
from katona.visual... | 2.21875 | 2 |
recipes/site_listers/seriouseats.py | cfeenstra67/recipes | 0 | 12789236 | from recipes.site_listers.base import SitemapLister
class SeriousEatsLister(SitemapLister):
""" """
start_url = "https://www.seriouseats.com/sitemap_1.xml"
| 1.359375 | 1 |
Udacity_Course_Homeworks/HW1-4/Like_Lenet-5_1_cnn.py | ZLake/Deep_Learning_on_Tensorflow | 0 | 12789237 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 8 22:09:19 2017
@author: LinZhang
"""
# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import numpy as np
import tensorflow as tf
from six.moves impo... | 2.546875 | 3 |
setup.py | Dyend/django-mercadopago | 30 | 12789238 | <gh_stars>10-100
#!/usr/bin/env python
from setuptools import find_packages
from setuptools import setup
setup(
name="django-mercadopago",
description="MercadoPago integration for django",
author="<NAME>",
author_email="<EMAIL>",
url="https://github.com/WhyNotHugo/django-mercadopago",
license="... | 1.320313 | 1 |
class12pythoncbse-master/Practical3/studentrecordqueue.py | SubrataSarkar32/college3rdsem3035 | 0 | 12789239 | class Student:
def __init__(self,name,classs,section,rollno):
self.name=name
self.classs=classs
self.section=section
self.rollno=rollno
def __str__(self):
string='Student Name:'+str(self.name)+'\nS\
tudent Class:'+str(self.classs)+'\nStudent Section:'+\
str(self.section)+... | 3.953125 | 4 |
scripts/parsers/clover_parser.py | patrickjchap/Static-Bug-Detectors-ASE-Artifact | 1 | 12789240 | import os
import subprocess
import sys
from bs4 import BeautifulSoup
class CloverCoveredLine:
def __init__(self, image_tag, filepath, filename, line_number):
self.image_tag = image_tag
self.filepath = filepath
self.filename = filename
self.line_number = line_number
def __memb... | 2.671875 | 3 |
scikeras/utils/random_state.py | metasyn/scikeras | 1 | 12789241 | import os
import random
from contextlib import contextmanager
from typing import Generator
import numpy as np
import tensorflow as tf
from tensorflow.python.eager import context
from tensorflow.python.framework import config, ops
DIGITS = frozenset(str(i) for i in range(10))
@contextmanager
def tensorflow_random... | 2.46875 | 2 |
thumt/scripts/merge_translate_option.py | Glaceon31/NMTPhraseDecoding | 0 | 12789242 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2018 The THUMT Authors
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import operator
import os
import json
import math
def parseargs():
msg = "Merge translation options"
usage = "m... | 2.890625 | 3 |
python/032-LongestValidParentheses.py | vermouth1992/Leetcode | 0 | 12789243 | """
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring is "()", which has length = 2.
Another example is ")()())", where the longest valid parentheses substring is "()()", which has len... | 3.859375 | 4 |
src/sleuthdeck/plugins/sleuth/locks.py | sleuth-io/sleuth-deck | 0 | 12789244 | import threading
from os import path
from os.path import dirname
from typing import Optional
from sleuthdeck.deck import Deck
from sleuthdeck.deck import Key
from sleuthdeck.plugins.sleuth import Sleuth
class RepositoryLockKey(Key):
def __init__(self, sleuth: Sleuth, project: str, deployment: Optional[str] = Non... | 2.25 | 2 |
modules/utils.py | MinionAttack/conll-shared-task-tool | 0 | 12789245 | # -*- coding: utf-8 -*-
from csv import reader, writer
from pathlib import Path
from random import sample
from typing import Any, List
import requests as requests
from resources.constants import BROWSER_USER_AGENT
def handle_request(url: str) -> Any:
headers = {'User-Agent': BROWSER_USER_AGENT, 'Upgrade-Insecu... | 2.671875 | 3 |
training/src/training/logger.py | raman-nbg/model-serving | 0 | 12789246 | import logging
def get_logger(module_name: str):
suffix = ""
if module_name != "__main__":
suffix = "." + module_name
# logger = logging.getLogger("serving.model-server" + suffix)
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
logger.setLevel("INFO")
return... | 2.421875 | 2 |
src/models/loss_metric.py | shehel/traffic_forecasting | 0 | 12789247 | #!/usr/bin/env python3
from typing import Sequence, Union
import pdb
import torch
from ignite.exceptions import NotComputableError
from ignite.metrics.metric import Metric, reinit__is_reduced, sync_all_reduce
class ForwardLoss(Metric):
r"""Loss metric that simply records the loss calculated
in forward pass
... | 2.28125 | 2 |
mmcls/models/heads/am_head.py | ramosmy/open-speaker-verification | 31 | 12789248 | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init
from ..builder import HEADS
from .cls_head import ClsHead
@HEADS.register_module()
class AMSoftmaxClsHead(ClsHead):
"""AMSoftmax classifier head.
Args:
num_classes (int): Number of categories excludin... | 2.671875 | 3 |
tests/losses/test_neuralndcg.py | almajo/allRank | 473 | 12789249 | <filename>tests/losses/test_neuralndcg.py<gh_stars>100-1000
import math
from functools import partial
from pytest import approx
from allrank.data.dataset_loading import PADDED_Y_VALUE
from tests.losses.utils import neuralNDCG_wrap, ndcg_wrap
test_cases = [{"stochastic": False, "transposed": False},
{"... | 2.078125 | 2 |
src/repair/localization.py | jyi/fangelix | 0 | 12789250 | <reponame>jyi/fangelix
from math import sqrt, ceil
from runtime import TraceItem
from utils import LocationInfo as LI
import logging
logger = logging.getLogger(__name__)
class NoNegativeTestException(Exception):
pass
def ochiai(executed_passing, executed_failing, total_passing, total_failing):
if not tota... | 2.375 | 2 |