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 |
|---|---|---|---|---|---|---|
frameworks/helloworld/tests/test_soak.py | jorgelopez1/hdfs | 0 | 41700 | import logging
import os
import pytest
import shakedown # required by sdk_utils version checks
import sdk_cmd
import sdk_plan
import sdk_tasks
import sdk_upgrade
import sdk_utils
from tests import config
log = logging.getLogger(__name__)
FRAMEWORK_NAME = "secrets/hello-world"
NUM_HELLO = 2
NUM_WORLD = 3
# check en... | 1.96875 | 2 |
PhotoOrg.py | rdgao/PhotoOrg | 2 | 41701 | #<NAME>, 2014
#Library of code for image file manipulation
#and statistic gathering
from os import listdir, path, rename
from datetime import datetime
import PhotoOrg
def findFiles(dir):
#get a list of all pictures in the directory
dir = checkFolder(dir)
if dir is None: return
#search for target extensions
img... | 3.09375 | 3 |
torchlib/utils/random/sampler.py | vermouth1992/torchlib | 3 | 41702 | """
A sampler defines a method to sample random data from certain distribution.
"""
from typing import List
import numpy as np
class BaseSampler(object):
def __init__(self):
pass
def sample(self, shape, *args):
raise NotImplementedError
class IntSampler(BaseSampler):
def __init__(self... | 3.71875 | 4 |
src/euler_python_package/euler_python/easiest/p206.py | wilsonify/euler | 0 | 41703 | <reponame>wilsonify/euler
# The major optimization is to do arithmetic in base 10 in the main loop, avoiding division and modulo
def problem206():
"""
Find the unique positive integer whose square has the form
1_2_3_4_5_6_7_8_9_0,
where each “_” is a single digit.
"""
# Initialize
n = ... | 3.25 | 3 |
archive/wingnut.py | kringen/wingnut | 0 | 41704 | <filename>archive/wingnut.py<gh_stars>0
from head import Head
import time
from adafruit_servokit import ServoKit
def survey(head, angle_increment, time_increment):
start_angle = 0
end_angle = 180
angle = start_angle
while head.angle < end_angle:
head.turn(angle)
time.sleep(time_increment)
... | 3.03125 | 3 |
web_scrapping/Shutil.py | Mainak1792/Data_scrapping | 0 | 41705 | <filename>web_scrapping/Shutil.py
import time
from selenium import webdriver
import requests
from PIL import Image
import os
import io
from tqdm import tqdm
import cv2
def scroll_to_end(wd):
wd.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(6)
def extract_img(wd, page_num, save_... | 2.828125 | 3 |
tests/api/endpoints/admin/test_institution_users.py | weimens/seahub | 420 | 41706 | import json
import logging
from django.urls import reverse
from seahub.test_utils import BaseTestCase
from tests.common.utils import randstring
from seahub.institutions.models import Institution, InstitutionAdmin
from seahub.profile.models import Profile
logger = logging.getLogger(__name__)
class AdminInstitutionUs... | 2.390625 | 2 |
AmazonOA/turnstile.py | SadiHassan/leet | 1 | 41707 | '''
A warehouse has one loading dock that workers use to load and unload goods.
Warehouse workers carrying the goods arrive at the loading dock at different times. They form two queues, a "loading" queue and an "unloading" queue. Within each queue, the workers are ordered by the time they arrive at the dock.
The arri... | 4.4375 | 4 |
StatisticsFunctions/standardDeviation.py | mkm99/TeamProject_StatsCalculator | 0 | 41708 | import numpy as np
class StandardDeviation():
@staticmethod
def standardDeviation(data):
return np.std(data) | 2.1875 | 2 |
backend/admin/views/__init__.py | gsw945/flask-bigger | 29 | 41709 | # -*- coding: utf-8 -*-
'''admin视图''' | 0.957031 | 1 |
tests/unit_tests/v1/test_kubernetes_methods.py | ddeka2910/hvac | 1 | 41710 | <reponame>ddeka2910/hvac
from unittest import TestCase
import requests_mock
from parameterized import parameterized
from hvac import Client
class TestKubernetesMethods(TestCase):
"""Unit tests providing coverage for Kubernetes auth backend-related methods/routes."""
@parameterized.expand([
("defaul... | 3.0625 | 3 |
turnero/turnero_app/task.py | Juannauta/Turnero | 0 | 41711 | <filename>turnero/turnero_app/task.py<gh_stars>0
import time
import redis
import os
import json
from config import celery_app
redis_client = redis.StrictRedis(host=os.environ.get('REDIS_SERVER_HOST'), port=6379, db=0)
@celery_app.task()
def task_notification(pk=None):
"""
the request is very fast and the da... | 2.03125 | 2 |
Bugscan_exploits-master/exp_list/exp-2016.py | csadsl/poc_exp | 11 | 41712 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#refer:http://www.wooyun.org/bugs/wooyun-2014-081469
'''
Created on 2015-12-19
@author: 真个程序员不太冷
'''
import re
import urlparse
def assign(service, arg):
if service == "zte":
arr = urlparse.urlparse(arg)
return True, '%s://%s/' % (arr.sche... | 2.078125 | 2 |
login/migrations/0002_auto_20200404_2123.py | bbsddn2020/django-user-LinHai-v1.0 | 0 | 41713 | <filename>login/migrations/0002_auto_20200404_2123.py<gh_stars>0
# Generated by Django 3.0.4 on 2020-04-04 13:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('login', '0001_initial'),
]
operations = [
migrations.AlterField(
... | 1.46875 | 1 |
HexChat/notificationcenter.py | FichteForks/tingping-plugins | 1 | 41714 | <reponame>FichteForks/tingping-plugins
from __future__ import print_function
import hexchat
__module_name__ = 'notification-center'
__module_author__ = 'TingPing'
__module_version__ = '0'
__module_description__ = 'Integrate with the Notification Center on OSX'
loaded = False
try:
from pync import Notifier
except Imp... | 1.953125 | 2 |
script/util/MixIn.py | demetoir/MLtools | 0 | 41715 | from multiprocessing.pool import Pool
from script.util.Logger import Logger
from script.util.misc_util import dump_pickle, load_pickle, dump_json, load_json
class LoggerMixIn:
def __init__(self, verbose=0):
self.verbose = verbose
@property
def log(self):
level = Logger.verbose_... | 2.5 | 2 |
sdk/python/pulumi_azure/appservice/public_certificate.py | henriktao/pulumi-azure | 109 | 41716 | <reponame>henriktao/pulumi-azure<filename>sdk/python/pulumi_azure/appservice/public_certificate.py
# 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... | 2.203125 | 2 |
environments/var_voltage_control/voltage_barrier/bowl.py | eddie-atkinson/MAPDN | 30 | 41717 | import numpy as np
def bowl(vs, v_ref=1.0, scale=.1):
def normal(v, loc, scale):
return 1 / np.sqrt(2 * np.pi * scale**2) * np.exp( - 0.5 * np.square(v - loc) / scale**2 )
def _bowl(v):
if np.abs(v-v_ref) > 0.05:
return 2 * np.abs(v-v_ref) - 0.095
else:
return ... | 2.828125 | 3 |
examples/features/dry.runs/run-cmaes.py | JonathanLehner/korali | 43 | 41718 | #!/usr/bin/env python3
import sys
sys.path.append('_model')
from model import *
import korali
k = korali.Engine()
e = korali.Experiment()
e["Problem"]["Type"] = "Optimization"
e["Problem"]["Objective Function"] = model
e["Solver"]["Type"] = "Optimizer/CMAES"
e["Solver"]["Population Size"] = 5
e["Solver"]["Terminati... | 2.046875 | 2 |
config.py | tomoyan/blurtblock | 1 | 41719 | import os
from datetime import timedelta
class Config(object):
SECRET_KEY = os.environ.get('SECRET_KEY') or 'YOUR_SECRET_KEY'
SESSION_TYPE = 'filesystem'
PERMANENT_SESSION_LIFETIME = timedelta(minutes=30)
UPVOTE_ACCOUNT = os.environ.get('UPVOTE_ACCOUNT') or 'YOUR_USERNAME'
UPVOTE_KEY = os.environ.... | 2.078125 | 2 |
taxi_zebra/ui.py | sephii/taxi-zebra | 5 | 41720 | <reponame>sephii/taxi-zebra
import inspect
from collections import namedtuple
import click
from taxi.aliases import aliases_database
from taxi.backends import PushEntryFailed
from .roles import NEVER_SAVE_ROLE_ID
from .utils import get_role_id_from_alias, update_alias_mapping
class CancelInput(Exception):
pass... | 2 | 2 |
source/bazel/rules/tree_hcp/string_tree_to_static_tree_parser.bzl | luxe/CodeLang-compiler | 33 | 41721 | load("//bazel/rules/cpp:object.bzl", "cpp_object")
load("//bazel/rules/hcp:hcp.bzl", "hcp")
load("//bazel/rules/hcp:hcp_hdrs_derive.bzl", "hcp_hdrs_derive")
def string_tree_to_static_tree_parser(name):
#the file names to use
target_name = name + "_string_tree_parser_dat"
in_file = name + ".dat"
outfile... | 1.695313 | 2 |
exceptions.py | udartsev/django-geodata | 0 | 41722 | class BaseServerException(Exception):
def __init__(self, detail, status_code, message):
super().__init__(message)
self.detail = detail
self.status_code = status_code
class SearchFieldRequiered(BaseServerException):
def __init__(self):
super().__init__(detail='entity', status_co... | 2.515625 | 3 |
tests/test_urls.py | erwinelling/wagtailnews | 35 | 41723 | import datetime
from django.core.cache import cache
from django.test import TestCase, override_settings
from django.utils import timezone
from wagtail.core.models import Page, Site
from wagtail.tests.utils import WagtailTestUtils
from tests.app.models import NewsIndex, NewsItem
def dt(*args):
return datetime.da... | 2.125 | 2 |
src/github_automation/management/project_manager.py | ShahafBenYakir/github-automation | 6 | 41724 | <gh_stars>1-10
from __future__ import absolute_import
from github_automation.common.utils import (get_column_items_with_prev_column,
get_first_column_items,
is_matching_project_item, get_labels,
... | 2.28125 | 2 |
stackoverflow/spiders/items.py | Janeho454199/stackoverflow-spider | 131 | 41725 | <filename>stackoverflow/spiders/items.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import scrapy
class StackoverflowItem(scrapy.Item):
links = scrapy.Field()
views = scrapy.Field()
votes = scrapy.Field()
answers = scrapy.Field()
tags = scrapy.Field()
questions = scrapy.Field()
| 1.96875 | 2 |
csdn/blog-click-read-num.py | Adsryen/python-spiders | 31 | 41726 | #!/usr/bin/env python
# encoding: utf-8
'''
#-------------------------------------------------------------------
# CONFIDENTIAL --- CUSTOM STUDIOS
#-------------------------------------------------------------------
# ... | 2.75 | 3 |
cogs/utils/db.py | NextChai/FURYBot | 0 | 41727 | """
The MIT License (MIT)
Copyright (c) 2020-present NextChai
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, me... | 2.09375 | 2 |
python/tvm/relay/op/_transform.py | Rasterer/tvm | 2 | 41728 | #pylint: disable=invalid-name, unused-argument
"""Backend compiler related feature registration"""
from __future__ import absolute_import
from . import op as _reg
from .op import schedule_injective
# strided_slice
_reg.register_schedule("strided_slice", schedule_injective)
| 1.289063 | 1 |
misc/noise.py | exoplanetvetting/DAVE | 7 | 41729 | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 7 13:43:01 2016
@author: fergal
A series of metrics to quantify the noise in a lightcurve:
Includes:
x sgCdpp
x Marshall's noise estimate
o An FT based estimate of 6 hour artifact strength.
o A per thruster firing estimate of 6 hour artifact strength.
$Id$
$URL$
"""
... | 2.03125 | 2 |
tests/test_parse_data.py | physimals/fslpy | 6 | 41730 | #!/usr/bin/env python
#
# test_parse_data.py -
#
# Author: <NAME> <<EMAIL>>
#
import argparse
from fsl.utils import parse_data, tempdir, path
import os.path as op
from fsl.data.vtk import VTKMesh
from fsl.data.gifti import GiftiMesh
from fsl.data.image import Image
from fsl.data.atlases import Atlas
from pytest import... | 2.265625 | 2 |
tests/test_covar.py | ComputationalCryoEM/ASPIRE | 0 | 41731 | <gh_stars>0
import os
import numpy as np
from scipy.cluster.vq import kmeans2
from unittest import TestCase
from unittest.mock import patch
import pytest
from aspyre.source import SourceFilter
from aspyre.source.simulation import Simulation
from aspyre.basis.fb_3d import FBBasis3D
from aspyre.imaging.filters import R... | 1.96875 | 2 |
polls/application/bungou.py | jphacks/B_2015 | 0 | 41732 | <gh_stars>0
# 以下ほぼ彩花ちゃんのコピペ
"""import requests
headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36'}
url_1 = 'https://www.aozora.gr.jp/cards/000035/files/301_ruby_5915.zip'
url_2 = 'https://www.aozora.gr.jp/cards/000035/f... | 2.703125 | 3 |
556.py | RafaelHuang87/Leet-Code-Practice | 0 | 41733 | <filename>556.py
class Solution:
def nextGreaterElement(self, n: int) -> int:
s = list(str(n))
i = len(s) - 1
while i - 1 >= 0 and s[i - 1] >= s[i]:
i -= 1
if i == 0:
return -1
j = len(s) - 1
while s[j] <= s[i - 1]:
j -= 1
... | 2.8125 | 3 |
raco/myrial/exceptions.py | uwescience/raco | 61 | 41734 |
class MyrialCompileException(Exception):
pass
class MyrialUnexpectedEndOfFileException(MyrialCompileException):
def __str__(self):
return "Unexpected end-of-file"
class MyrialParseException(MyrialCompileException):
def __init__(self, token):
self.token = token
def __str__(self):
... | 2.796875 | 3 |
entity/query_item.py | will4906/PatentCrawler | 136 | 41735 | <reponame>will4906/PatentCrawler<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Created on 2017/3/19
@author: will4906
"""
import re
def handle_item_group(item_group):
"""
处理item_group函数
:param item_group:
:return:
"""
AND = ' AND '
OR = ' OR '
NOT = ' NOT '
exp_str = ""
keyand... | 2.53125 | 3 |
preference/models.py | ASL-19/outline-distribution | 5 | 41736 | # Copyright 2020 ASL19 Organization
#
# 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 wr... | 2.046875 | 2 |
utils/pandasscatter.py | akhandait/models | 54 | 41737 | <gh_stars>10-100
from matplotlib import figure
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
def cpandasscatter(inFile, x, y, outFile='output.png', height=10, width=10):
dataset = pd.read_csv(inFile)
fig = dataset.plot(kind="scatter", x=x, y=y, alpha=0.1, figsize=(wid... | 2.734375 | 3 |
deprecated/ipport-list-to-script-nmap-portgroup-cmds.py | NullByte8080/ipport | 10 | 41738 | #!/usr/bin/env python
'''
convert ip port list nmap commands sorrounded in script statements
'''
import sys,re
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
sys.stderr.write('Usage: '+sys.argv[0]+' <in-file>\n')
sys.exit(1)
ips = []
ports = dict()
for ip,port in map(lambda x: x.split(), filter(lambda x: re.ma... | 3.21875 | 3 |
server/ticketing.py | mocsi/ticketing | 0 | 41739 | #!/usr/bin/env python
import base64, json, pika
from xml.etree.ElementTree import Element, tostring, fromstring
# RabbitMQ Connection Information
RABBIT_HOST = 'vcd-cell1.lab.orange.sk'
RABBIT_HOST = 'oblak.orange.sk'
RABBIT_PORT = '5672'
RABBIT_USER = 'vcdext'
RABBIT_PASSWORD = '<PASSWORD>.'
# Exchange and Queue we ... | 1.804688 | 2 |
falmer/schema/middleware.py | sussexstudent/services-api | 2 | 41740 | <gh_stars>1-10
import sys
import logging
class SentryMiddleware(object):
def resolve(self, next, root, info, **args):
try:
return next(root, info, **args)
except:
err = sys.exc_info()
logging.error(err)
return err[1]
| 2.40625 | 2 |
app/db/repositories/user.py | Max-Zhenzhera/my_vocab_backend | 1 | 41741 | from datetime import datetime
from uuid import uuid4
from typing import (
ClassVar,
TypeVar,
Union
)
from sqlalchemy import update as sa_update
from sqlalchemy.future import select as sa_select
from sqlalchemy.sql.elements import BinaryExpression
from .base import BaseRepository
from .types_ import ModelT... | 2.25 | 2 |
docs/index-7.py | farisachugthai/rtdpy | 5 | 41742 | from scipy import optimize
# Generate noisy data from NCSTR system with tau=10 and n=2
a = rtdpy.Ncstr(tau=10, n=2, dt=1, time_end=50)
xdata = a.time
noisefactor = 0.01
ydata = a.exitage \
+ (noisefactor * (np.random.rand(a.time.size) - 0.5))
def f(xdata, tau, n):
a = rtdpy.Ncstr(tau=tau, n=n, dt=1, time_end=... | 2.6875 | 3 |
blotto.py | didrikjonassen/ea | 0 | 41743 | <reponame>didrikjonassen/ea
from __future__ import division
import binary_gtype
import evoalg
from math import log
from pylab import plot, show, figure, fill_between, xlabel, ylabel, title, legend, savefig
from copy import deepcopy
class blotto_ptype(binary_gtype.binary_genotype):
phenotype = None
fitness = 0
moral... | 2.640625 | 3 |
data_loader.py | dmsquare/CalendarGNN | 8 | 41744 | <filename>data_loader.py
"""
Load dataset
"""
import datetime
import collections
from config import *
def load_info_f(info_f, _del='\t'):
ids = []
with open(info_f, 'r') as f:
next(f)
for line in f:
ts = line.strip().split(_del)
assert len(ts) >= 2
ids.app... | 2.65625 | 3 |
controllers/admin.py | PP-HashInclude/cfc-quiz | 0 | 41745 | import os
from flask import Flask, flash, request, redirect, url_for, session, render_template
from werkzeug.utils import secure_filename
from common import utility, config
from repositories import db, cos
def admin():
try:
player_id = session.get("mobileno")
if player_id is None:
flash... | 2.421875 | 2 |
feature_engine/imputation/drop_missing_data.py | kylegilde/feature_engine | 196 | 41746 | # Authors: <NAME> <<EMAIL>>
# License: BSD 3 clause
from typing import List, Optional, Union
import pandas as pd
from feature_engine.dataframe_checks import _is_dataframe
from feature_engine.imputation.base_imputer import BaseImputer
from feature_engine.variable_manipulation import _check_input_parameter_variables
... | 3.890625 | 4 |
examples/simple.py | sambyers/webexteamssdk | 1 | 41747 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple webexteamssdk demonstration script.
Very simple script to create a demo room, post a message, and post a file.
If one or more rooms with the name of the demo room already exist, it will
delete the previously existing rooms.
The package natively retrieves your W... | 2.46875 | 2 |
Bugscan_exploits-master/exp_list/exp-2405.py | csadsl/poc_exp | 11 | 41748 | <filename>Bugscan_exploits-master/exp_list/exp-2405.py
#!usr/bin/env python
# *-* coding:utf-8 *-*
'''
name: TRS学位论文系统papercon处SQL注入
author: yichin
refer: http://www.wooyun.org/bugs/wooyun-2010-0124453
description:
paper/submit1.jsp POST
stacked queries; AND/OR time-based blind
google dork: intitle:"... | 1.882813 | 2 |
natsort/__init__.py | altendky/natsort | 0 | 41749 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import warnings
from natsort.natsort import (
as_ascii,
as_utf8,
decoder,
humansorted,
index_humansorted,
index_natsorted,
index_realsorted,
index_versorted,
natsor... | 1.960938 | 2 |
Linear-Regression/LinearRegression.py | ausaafnabi/Machine-Learning-Projects | 1 | 41750 | <gh_stars>1-10
from matplotlib import pyplot as plt
import pandas as pd
import pylab as pl
import numpy as np
import os
DOWNLOAD_ROOT = "https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/ML0101ENv3/labs/FuelConsumptionCo2.csv"
DATASET_PATH = os.path.join("../","datasets")
DATASET_URL = ... | 3.03125 | 3 |
migrations/0007_doubleentry_account.py | PyUnchained/books | 0 | 41751 | # Generated by Django 2.2.6 on 2020-01-24 00:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('books', '0006_auto_20200124_0048'),
]
operations = [
migrations.AddField(
model_name='doubleent... | 1.539063 | 2 |
bomb_runner/bomb_runner.py | copsahl/Bomb_Runner_Python_game | 0 | 41752 | <filename>bomb_runner/bomb_runner.py
import os
import random
import time
import bomb_modules as bm
import msvcrt
gameBoard = [
['+','+','+','+','+','+','+','+','+','+','+','+','+'], # x 1-11
['+',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','+'], # y 1-3
['+',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','+']... | 1.828125 | 2 |
submissions/abc133/d.py | m-star18/atcoder | 1 | 41753 | <reponame>m-star18/atcoder<gh_stars>1-10
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 = list(map(lambda x: int(x)*2, readline().split()))
ans = [0] * n
for i in range(n):
if i % 2 == 0:
... | 2.234375 | 2 |
0_numpy_lineare_algebra/assignments/learntools/challenges/challenge2.py | layerwise/training | 0 | 41754 | <filename>0_numpy_lineare_algebra/assignments/learntools/challenges/challenge2.py
import pandas as pd
import os
import numpy as np
from learntools.core import *
class Evaluation(CodingProblem):
show_solution_on_correct = False
_vars = ["data_path", "results"]
_hints = [
"""Checking your solution ... | 3.5625 | 4 |
pydatpiff/backend/config.py | cbedroid/datpiff | 16 | 41755 | """
This file will stored all dynamic class and methods.
These methods will be used throughout the whole program.
"""
import sys
import concurrent.futures as cf
import threading
from functools import wraps
from ..utils.request import Session
from ..errors import BuildError
def Threader(f):
@wraps(f)... | 2.75 | 3 |
myapp/decorators.py | menghao2015/MyBlog | 0 | 41756 | <reponame>menghao2015/MyBlog<filename>myapp/decorators.py
from functools import wraps
from flask import abort
from flask.ext.login import current_user
from .models import Permission
def permission_required(permission):
def decorators(f):
@wraps(f)
def decorators_function(*args, **kwargs):
if not current_user.... | 2.234375 | 2 |
wechat_config/customize_userManual.py | William-An/wechat_server | 0 | 41757 | import requests
import os
import sys # provide option
import argparse # parse options
import json
PATH = os.path.abspath(os.path.dirname(sys.argv[0]))
token_url = "https://api.weixin.qq.com/cgi-bin/token" # Change to control server
create_interface = "https://api.weixin.qq.com/cgi-bin/menu/create"
get_Allinterface = "... | 2.765625 | 3 |
ocg.py | kushimoto/ocg | 0 | 41758 | <filename>ocg.py
import cv2
import numpy as np
import random
import os
charcters = ['a', 'b', 'c', 'd',
'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p',
'q', 'r', 's', 't',
'u', 'v', 'w', 'x',
'y', 'z', 'A', 'B',
'C',... | 2.234375 | 2 |
Taller de Estrucuras de Control Repeticion/Punto01.py | Ricardoppp/Talleres_De_Algoritmos_Ricardo | 0 | 41759 | #punto 1
#entradas
n=int(input("Escriba el primer digito "))
k=int(input("Escriba el primer digito "))
#caja negra y salidas
while True:
n=0
if(k<n):
n=n-1
print(n)
elif(n==k):
print(k)
break | 3.78125 | 4 |
tests/test-cli.py | zondo/pypkg | 0 | 41760 | # TODO: update or remove this file
from pytest import raises
from pypkg import cli
def test_main(capsys):
cli.main([])
captured = capsys.readouterr()
assert "write me" in captured.err
def test_usage(capsys):
with raises(SystemExit):
cli.main(["-h"])
captured = capsys.readouterr()
... | 2.203125 | 2 |
examples/_todo/http2-upload.py | karpierz/libcurl | 0 | 41761 | #***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|... | 1.921875 | 2 |
tasks.py | joeblackwaslike/pyramid_bootstrap | 1 | 41762 | <gh_stars>1-10
from invoke import task
@task
def test(ctx):
ctx.run('pytest --cov tests')
@task
def install(ctx):
ctx.run('pip3 install -e ".[testing]"')
@task
def check(ctx):
ctx.run('pyroma .')
ctx.run('pylint pyramid_bootstrap')
ctx.run('pycodestyle')
@task
def clean(ctx):
ctx.run('rm... | 1.710938 | 2 |
lastimport.py | rafi/beets-lastimport | 4 | 41763 | # coding=utf-8
# Copyright 2014, <NAME> http://github.com/rafi
# vim: set ts=8 sw=4 tw=80 et :
import logging
import requests
from beets.plugins import BeetsPlugin
from beets import ui
from beets import dbcore
from beets import config
log = logging.getLogger('beets')
api_url = 'http://ws.audioscrobbler.com/2.0/?meth... | 2.015625 | 2 |
test/linkage-agent/manual/run_small_test_with_matches-single-schema.py | greshje/linkage-agent-tools | 1 | 41764 | import test_util.linkage.run_full_linkage_test as flt
def run_test():
print("Starting test...")
flt.run_full_linkage_test("test-data/envs/small-no-households-with-matches-single-schema/config.json")
print("Done with test")
if __name__ == "__main__":
run_test()
| 1.453125 | 1 |
bluebottle/assignments/tests/test_tasks.py | jayvdb/bluebottle | 0 | 41765 | <reponame>jayvdb/bluebottle
import mock
from datetime import timedelta
from django.core import mail
from django.db import connection
from django.utils import timezone
from django.utils.timezone import now
from bluebottle.assignments.models import Applicant
from bluebottle.assignments.tasks import assignment_tasks
from... | 1.8125 | 2 |
Autonomous_Control/Image_Processing/3_Coordinate_Transformation.py | tatsujin16/Intellectual_Robot_Contest_2019 | 0 | 41766 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
import cv2
import math
import numpy as np
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
from geometry_msgs.msg import Twist
class first(object):
def __init__(self):
#sub
self._sub_tag0 = rospy.Subscriber('/tag0_info', Twis... | 2.203125 | 2 |
temp-uplift-submission/keras/criteo_keras.py | damslab/reproducibility | 4 | 41767 | # Notes from this experiment:
# 1. adapt() is way slower than np.unique -- takes forever for 1M, hangs for 10M
# 2. TF returns error if adapt is inside tf.function. adapt uses graph inside anyway
# 3. OOM in batch mode during sparse_to_dense despite of seting sparse in keras
# 4. Mini-batch works but 15x(g)/20x slower ... | 2.46875 | 2 |
dev/examples/tungraph.py | Cam2337/snap-python | 242 | 41768 | <gh_stars>100-1000
import random
import sys
sys.path.append("../swig-r")
import snap
def PrintGStats(s, Graph):
'''
Print graph statistics
'''
print "graph %s, nodes %d, edges %d, empty %s" % (
s, Graph.GetNodes(), Graph.GetEdges(),
"yes" if Graph.Empty() else "no")
def DefaultConst... | 2.859375 | 3 |
testsuite/driver/src/case/case_pipeline/cicd_run.py | openmaple/MapleCompiler | 5 | 41769 | <reponame>openmaple/MapleCompiler
#
# Copyright (c) [2021] Huawei Technologies Co.,Ltd.All rights reserved.
#
# OpenArkCompiler is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVID... | 1.773438 | 2 |
weighted_round_robin.py | ppd0705/cheatsheet | 0 | 41770 | from typing import List
class ServerConfig:
def __init__(self, addr: str, weight: int):
self.addr: str = addr
self.weight: int = weight
self.cur_weight: int = 0
def __repr__(self):
return f"\n [Server]addr:{self.addr}, weigh:{self.weight}, cur_weight:{self.cur_weight}"
cl... | 3.65625 | 4 |
project/store/migrations/0014_auto_20220225_2209.py | aliharby12/Book-Store | 0 | 41771 | <gh_stars>0
# Generated by Django 3.2.12 on 2022-02-25 22:09
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('store', '0013_auto_20220224_2311'),
]
operations = [
migratio... | 1.6875 | 2 |
generate_datasets/subset_data.py | ExaScience/ICU72hReadmissionMIMICIII | 0 | 41772 | <gh_stars>0
# Author: T.J.Ashby
import sys, yaml
import logging as lg
import pandas as pd
import numpy as np
writeOpts = {"index": False}
def splitByPercentage(df_in, perc, seed=42):
df = df_in.copy()
df.loc[:, "Subset"] = "B"
frac = perc / 100
df.loc[df.sample(frac=frac, random_state=seed).in... | 2.671875 | 3 |
tutorial/client.py | kangjunseo/GraphQL | 0 | 41773 | <reponame>kangjunseo/GraphQL<filename>tutorial/client.py
from gql import Client
from gql.transport.requests import RequestsHTTPTransport
transport = RequestsHTTPTransport(url='http://localhost:8080/v1/graphql')
client = Client(transport=transport, fetch_schema_from_transport=True) | 2.28125 | 2 |
EBooks/doub/deal/MergeBooks.py | Zhangsongsong/BookCreeper | 0 | 41774 | <filename>EBooks/doub/deal/MergeBooks.py<gh_stars>0
import json
import os
import time
import requests
from bs4 import BeautifulSoup
dir_path = '../tags'
book_count = 0 # 书的统计
book_current_index = 0 # 当前获取进度
search_url = 'https://search.jd.com/Search?keyword='
is_test_url = True
test_url = 'https://item.jd.com/348... | 2.875 | 3 |
doc/source/conf.py | Steap/glance | 309 | 41775 | # Copyright (c) 2010 OpenStack Foundation.
#
# 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... | 1.273438 | 1 |
multidynet/lsm.py | joshloyal/multidynet | 0 | 41776 | import warnings
import numpy as np
import scipy.sparse as sp
from joblib import Parallel, delayed
from scipy.special import expit
from sklearn.exceptions import ConvergenceWarning
from sklearn.utils import check_array, check_random_state
from sklearn.linear_model import LogisticRegression
from tqdm import tqdm
from ... | 1.914063 | 2 |
SciGen/Classification/SupportVectorClassification.py | SamuelSchmidgall/SciGen | 1 | 41777 | #!/usr/bin/env python
__author__ = "<NAME>"
__license__ = "MIT"
__email__ = "<EMAIL>"
__credits__ = "<NAME> -- An amazing Linear Algebra Professor"
import cvxopt
import numpy as np
class SupportVectorClassification:
"""
Support Vector Machine classification model
"""
def __init__(self):
"""
... | 3.25 | 3 |
apicrawler/recipeAPIcrawler_edeka.py | kuehlfrank/database | 0 | 41778 | import os
import requests
import json
import time
import random
import math
baseUrl = "https://www.edeka.de/rezepte/rezept/suche"
external_baseUrl = "https://www.edeka.de"
resultsPerPage = 50
pageQuery = f"?size={resultsPerPage}&page="
def getJson(url):
jsonText = requests.get(url).json()
retur... | 3.078125 | 3 |
winney/mock.py | olivetree123/Winney | 0 | 41779 | <filename>winney/mock.py
import json
class Mock(object):
data = None
def to_string(self):
if not isinstance(self.data,
(bytes, str, int, float, list, tuple, dict)):
raise NotImplementedError(
"to_string should be self defined for data type = {}".... | 3.0625 | 3 |
robotcode/language_server/common/parts/code_lens.py | mardukbp/robotcode | 0 | 41780 | <reponame>mardukbp/robotcode
from __future__ import annotations
from asyncio import CancelledError
from typing import TYPE_CHECKING, Any, List, Optional
from ....jsonrpc2.protocol import rpc_method
from ....utils.async_event import async_tasking_event
from ....utils.logging import LoggingDescriptor
from ..has_extend_... | 2.03125 | 2 |
train_utils.py | BenTimor/Tensorflow-CharRNN | 1 | 41781 | <filename>train_utils.py
import argparse
import os
import pickle
import tensorflow as tf
from pathlib import Path
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return Fal... | 2.4375 | 2 |
Python/interview/wordLadder.py | darrencheng0817/AlgorithmLearning | 2 | 41782 | '''
Created on 2015年12月1日
https://leetcode.com/problems/word-ladder/
@author: Darren
'''
def wordLadder(startWord,endWord,wordDic,path,visited):
for index in range(len(startWord)):
for i in range(26):
newWord=startWord[:index]+chr(ord("a")+i)+startWord[index+1:]
if newWord==startWor... | 3.515625 | 4 |
dogs/migrations/0004_event_owner.py | Shovatandukar/dog-meetup-backend | 0 | 41783 | # Generated by Django 3.1.8 on 2021-10-31 02:47
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),
('dogs', '0003_auto_202109... | 1.78125 | 2 |
PythonClient/ros/car_pose.py | jeyong/AirSim | 81 | 41784 | <filename>PythonClient/ros/car_pose.py
#!/usr/bin/env python
import setup_path
import airsim
import rospy
import tf
from std_msgs.msg import String
from geometry_msgs.msg import PoseStamped
import time
def airpub():
pub = rospy.Publisher("airsimPose", PoseStamped, queue_size=1)
rospy.init_node('airpub', a... | 2.5 | 2 |
afk-q-babyai/babyai/levels/query.py | IouJenLiu/AFK | 1 | 41785 | <gh_stars>1-10
import gym
import re
import numpy as np
import time
other_places = ['kitchen', 'restroom', 'livingroom']
other_colors = ['red', 'yellow', 'white']
other_directions = ['east', 'west', 'second floor']
import random
class Query(gym.Wrapper):
def __init__(self, env, n_q_type=2, n_color=6, n_object_type=1... | 2.390625 | 2 |
candemachine/exceptions.py | Ricyteach/candemachine | 0 | 41786 | <reponame>Ricyteach/candemachine<filename>candemachine/exceptions.py<gh_stars>0
class CandeError(Exception):
pass
class CandeSerializationError(CandeError):
pass
class CandeDeserializationError(CandeError):
pass
class CandeReadError(CandeError):
pass
class CandePartError(CandeError):
pass
... | 1.695313 | 2 |
ui/tkinter/versionchooser.py | adpoliak/NSAptr | 0 | 41787 | """
Copyright 2016 adpoliak
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,... | 1.992188 | 2 |
schematool/db/db.py | jonahgeorge/schema-tool | 40 | 41788 | # stdlib imports
import subprocess
import sys
# local imports
from errors import AppliedAlterError
# TODO: Move connection management to schema.py. Instantiate a connection
# before each run() method and close it at the end, using the DB.conn() method.
class Db(object):
"""
Do not instantiate directly.
C... | 2.6875 | 3 |
library_old/iworkflow_service_template.py | Larsende/f5_ansible | 12 | 41789 | <filename>library_old/iworkflow_service_template.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2017 F5 Networks Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwar... | 1.21875 | 1 |
active_learning/archive/json2sql.py | kant/CameraTraps | 0 | 41790 | <filename>active_learning/archive/json2sql.py
import json
import sqlite3
def get_type(val):
if isinstance(val,str):
return "TEXT";
elif isinstance(val,int):
return "INTEGER"
elif isinstance(val,float):
return "REAL"
else:
print("Unknown Type Error")
raise
def create_sql(n... | 3.640625 | 4 |
volunteerapp/views.py | mclark4386/volunteer_connection | 0 | 41791 | from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import authenticate, login
from django.views.generic import View
from django.contrib.auth.models import User
from .forms import UserForm
from .models import UserProfile, Project, Tag
from .search import get_query
def Leaderboard... | 2.015625 | 2 |
dbr/log.py | RogueScholar/debreate | 97 | 41792 | # -*- coding: utf-8 -*-
## \package dbr.log
# MIT licensing
# See: docs/LICENSE.txt
import os, sys
from fileio.fileio import AppendFile
from globals.dateinfo import GetDate
from globals.dateinfo import GetTime
from globals.dateinfo import dtfmt
from globals.paths import PATH_logs
from globals.strings import GetM... | 2.546875 | 3 |
utils/cnn_dm_reader.py | ruiyiw/VT-summ | 0 | 41793 | import torch
import torch.utils.data as data
import random
import math
import os
import logging
from utils import config
import pickle
from tqdm import tqdm
import numpy as np
import pprint
pp = pprint.PrettyPrinter(indent=1)
import re
import time
import nltk
class Lang:
def __init__(self, init_index2word):
... | 2.53125 | 3 |
wetterdienst/dwd/__init__.py | kmuehlbauer/wetterdienst | 1 | 41794 | # Load Pandas DataFrame extension.
import wetterdienst.dwd.pandas # noqa:F401
| 1.375 | 1 |
registration.py | shubham9019/omega_attendance_manager | 0 | 41795 | from tkinter import *
from tkinter import messagebox
import sys
import os
import signal
import time
from subprocess import *
from tkinter.scrolledtext import ScrolledText
import sqlite3
def file_previous_close():
try:
with open('home_id.txt', 'r') as f:
lines = f.read().splitlines()
... | 2.953125 | 3 |
DigitizationUtilities/ErrorMapsToPDFGenerator.py | annusgit/forestcoverUnet | 25 | 41796 | <gh_stars>10-100
from fpdf import FPDF
import os
rgb_path = 'E:\Forest Cover - Redo 2020\Trainings and Results\Error Maps\model_48_topologyENC_4_DEC_4_lr1e-06_bands3'
full_spectrum_path = 'E:\Forest Cover - Redo 2020\Trainings and Results\Error Maps\model_14_topologyENC_4_DEC_4_lr1e-06_bands11'
augmented_path = 'E:\Fo... | 2.21875 | 2 |
tester/tester/timeout.py | cppseminar/testscripts | 4 | 41797 | <filename>tester/tester/timeout.py<gh_stars>1-10
import logging
import os
import time
import math
logger = logging.getLogger(__name__)
class TimeoutManager:
# we will keep 15s for mantainance in this python app, it should be very
# generous and should be enough for everyone
TIMEOUT = max(int(os.getenv('T... | 2.8125 | 3 |
katana/pedals/effects/pedal_wah.py | leon3110l/katana_tsl_patch | 0 | 41798 | <reponame>leon3110l/katana_tsl_patch
from ..wah import WahSubType
from .. import FXType, FXPedal
class PedalWah(FXPedal):
FX_TYPE = FXType.PEDAL_WAH
def __init__(self,
_type: WahSubType = WahSubType.DEFAULT,
direct_mix: int = 0,
effect_level: int = 100,
... | 2.4375 | 2 |
bezos.py | cmcai0104/bezos | 1 | 41799 | import argparse
from yaml import load
from utils import print_dic
from io import open
from toolz.dicttoolz import merge
from runner import Runner
from evaluator import Evaluator
parser = argparse.ArgumentParser(description='Bezos')
parser.add_argument('--config', default='test.yaml',
help='Configur... | 2.28125 | 2 |