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 |
|---|---|---|---|---|---|---|
stx-metrics/footprint/tests/send_data_test.py | gaponcec/tools-contrib | 1 | 33000 | <reponame>gaponcec/tools-contrib<filename>stx-metrics/footprint/tests/send_data_test.py
#!/usr/bin/env python
__author__ = "<NAME>"
import random
import time
import argparse
from influxdb import InfluxDBClient
INFLUX_SERVER = ""
INFLUX_PORT = ""
INFLUX_PASS = ""
INFLUX_USER = ""
def send_data(json_file):
... | 2.59375 | 3 |
roll_the_dice/cli.py | pluralsight/tech-blog-roll-the-dice | 11 | 33001 | <gh_stars>10-100
import typer
from .dice import roll, roll_from_string
app = typer.Typer()
@app.command("hello")
def hello_world():
"""our first CLI with typer!
"""
typer.echo("Opening blog post...")
typer.launch(
"https://pluralsight.com/tech-blog/python-cli-utilities-with-poetry-and-typer"... | 3.546875 | 4 |
scripts/dfh.py | ldamewood/figures | 5 | 33002 | #!/usr/bin/env python
import numpy
import itertools
from pymatgen.core.lattice import Lattice
from pymatgen.core.operations import SymmOp
from pymatgen.core.structure import Structure
from crystal import fillcell, tikz_atoms
def dfh(single = True, defect = False):
if defect:
single = False
a = 5.43
... | 2.03125 | 2 |
instasave/__main__.py | hnrkcode/InstaSave | 1 | 33003 | <filename>instasave/__main__.py
import argparse
import os.path
from .instagram.post import Downloader
from .instagram.url import URLScraper
from .utils.webaddr import get_url, validate_url
from .web.client import HTTPHeaders
from .web.geckoloader import GeckoLoader
def get_arguments():
"""Get arguments passed to... | 3.015625 | 3 |
modules/dbnd-airflow/src/dbnd_airflow/web/airflow_app.py | dmytrostriletskyi/dbnd | 224 | 33004 | import logging
def create_app(config=None, testing=False):
from airflow.www_rbac import app as airflow_app
app, appbuilder = airflow_app.create_app(config=config, testing=testing)
# only now we can load view..
# this import might causes circular dependency if placed above
from dbnd_airflow.airfl... | 2.078125 | 2 |
runway/lookups/handlers/random_string.py | onicagroup/runway | 134 | 33005 | <gh_stars>100-1000
"""Generate a random string."""
# pyright: reportIncompatibleMethodOverride=none
from __future__ import annotations
import logging
import secrets
import string
from typing import TYPE_CHECKING, Any, Callable, List, Sequence, Union
from typing_extensions import Final, Literal
from ...utils import B... | 2.625 | 3 |
FinBot/intent/Loki_Exchange.py | Lanlanluuu/LokiHub | 17 | 33006 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
Loki module for Exchange
Input:
inputSTR str,
utterance str,
args str[],
resultDICT dict
Output:
resultDICT dict
"""
DEBUG_Exchange = True
userDefinedDICT = {"歐元":"E... | 2.90625 | 3 |
venv/Lib/site-packages/win32comext/directsound/test/ds_record.py | ajayiagbebaku/NFL-Model | 150 | 33007 | <filename>venv/Lib/site-packages/win32comext/directsound/test/ds_record.py
import pywintypes
import struct
import win32event, win32api
import os
import win32com.directsound.directsound as ds
def wav_header_pack(wfx, datasize):
return struct.pack(
"<4sl4s4slhhllhh4sl",
"RIFF",
36 + datasize... | 2 | 2 |
_unittests/ut_df/test_pandas_groupbynan.py | Pandinosaurus/pandas_streaming | 20 | 33008 | # coding: utf-8
"""
@brief test log(time=1s)
"""
import unittest
import pandas
import numpy
from scipy.sparse.linalg import lsqr as sparse_lsqr
from pyquickhelper.pycode import ExtTestCase, ignore_warnings
from pandas_streaming.df import pandas_groupby_nan, numpy_types
class TestPandasHelper(ExtTestCase):
d... | 2.484375 | 2 |
ros/src/tl_detector/tl_detector.py | irt24/Udacity-CarND-FinalProject | 0 | 33009 | #!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import TrafficLightArray, TrafficLight
from styx_msgs.msg import Lane
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from light_classification.tl_classifier import TLCla... | 2.390625 | 2 |
initGame.py | Sabsterrexx/PingPongGame | 0 | 33010 | #Import required Modules:
import pygame
import constants
from paddle import Paddle
from ball import Ball
from score import Score
from text import Text
from screenState import ScreenState
#This function basically executes everything in the "screenState" module's class
def init():
#Initialize all the c... | 3.59375 | 4 |
minmax.py | patello/subtracting_squares | 0 | 33011 | <reponame>patello/subtracting_squares<filename>minmax.py
class Game:
def __init__(self,span=[0,100],sub_fun="Square"):
self.span=span
self.func_dict = {
"Square":lambda x: pow(x,2),
"Odd":lambda x: 1 + (x-1)*2,
"Even":lambda x: x*2,
"Identity":lambda x... | 3.6875 | 4 |
fwl-automation-decisions/domain/src/domain/model/firewall/Firewall.py | aherculano/fwl-project | 0 | 33012 | <filename>fwl-automation-decisions/domain/src/domain/model/firewall/Firewall.py
from .FirewallName import FirewallName
from .FirewallUUID import FirewallUUID
from .FirewallAccessLayer import FirewallAccessLayer
class Firewall(object):
def __init__(self, uuid: FirewallUUID, name: FirewallName, access_layer: Firew... | 2.71875 | 3 |
inria/helloworld/datamodules.py | hernanlira/inria-anomaly_detection | 0 | 33013 | <gh_stars>0
from torchvision.datasets import MNIST
from torchvision import transforms
import pytorch_lightning as pl
from torch.utils.data import DataLoader, random_split
from multiprocessing import cpu_count
from typing import Any, Optional, Union
from pl_bolts.datamodules import CIFAR10DataModule
from pl_bolts.tran... | 2.625 | 3 |
ml3d/tf/modules/pointnet.py | eiiijiiiy/Open3D-ML | 0 | 33014 | import tensorflow as tf
from typing import List
from ..utils.tf_utils import gen_CNN
from ...utils import MODEL
from ..utils.pointnet import pointnet2_utils
class Pointnet2MSG(tf.keras.layers.Layer):
def __init__(
self,
in_channels=6,
use_xyz=True,
SA_config={
... | 2.3125 | 2 |
utils/config.py | PierreHao/YouGraph | 18 | 33015 | import argparse
import json
from easydict import EasyDict
def get_args():
argparser = argparse.ArgumentParser(description=__doc__)
argparser.add_argument(
'-c', '--config',
metavar='C',
default=None,
help='The Configuration file')
argparser.add_argument(
'-i', '--id... | 2.5625 | 3 |
data_prep/train_val_test_splitter.py | GIT-chandra/DeReflectionNet | 0 | 33016 | import shutil
import numpy as np
ALL_SYNTHS_LIST = 'synth_imgs.txt'
TRAIN_IMAGES_LIST = 'train_imgs.txt'
VAL_IMAGES_LIST = 'val_imgs.txt'
TEST_IMAGES_LIST = 'test_imgs.txt'
TRAIN_STOP = 342000
VAL_STOP = TRAIN_STOP + 38000
'''
390000 examples : 342000 train and 38000 val (90/10 splits on 380000), 10000 test
'''
wi... | 2.3125 | 2 |
example/fastapi/models.py | cnjlq84/oidc-op | 31 | 33017 | from typing import List
from typing import Optional
from pydantic import BaseModel
class WebFingerRequest(BaseModel):
rel: Optional[str] = 'http://openid.net/specs/connect/1.0/issuer'
resource: str
class AuthorizationRequest(BaseModel):
acr_values: Optional[List[str]]
claims: Optional[dict]
cla... | 2.40625 | 2 |
fnet/functions.py | HelmholtzAI-Consultants-Munich/pytorch_fnet | 0 | 33018 | import importlib
import json
import os
import pdb
import sys
import fnet
import pandas as pd
import tifffile
import numpy as np
from fnet.transforms import normalize
def pearson_loss(x, y):
#x = output
#y = target
vx = x - torch.mean(x)
vy = y - torch.mean(y)
cost = torch.sum(vx * vy) / (torch.sq... | 2.78125 | 3 |
scrape_mars.py | neilgbp/MissiontoMarsWebScrapingHW | 0 | 33019 | import os
import pandas as pd
import pymongo
import requests
import time
from splinter import Browser
from bs4 import BeautifulSoup
from selenium import webdriver
print(os.path.abspath("chromedriver.exe"))
def init_browser():
executable_path = {"executable_path": os.path.abspath("chromedriver.exe")}
return B... | 3.09375 | 3 |
indy_node/test/rich_schema/test_rich_schemas_disabled_by_default.py | Rob-S/indy-node | 627 | 33020 | <reponame>Rob-S/indy-node
import json
import pytest
from indy_common.constants import JSON_LD_CONTEXT, RS_CONTEXT_TYPE_VALUE, RS_ID, GET_RICH_SCHEMA_OBJECT_BY_ID, \
GET_RICH_SCHEMA_OBJECT_BY_METADATA, RS_NAME, RS_VERSION, RS_TYPE
from indy_node.test.api.helper import sdk_build_rich_schema_request, sdk_write_rich_... | 1.664063 | 2 |
__about__.py | a232319779/python_mmdt | 5 | 33021 | # -*- coding: utf-8 -*-
# @Time : 2021/01/05 22:53:23
# @Author : ddvv
# @Site : https://ddvvmmzz.github.io
# @File : about.py
# @Software: Visual Studio Code
__all__ = [
"__author__",
"__copyright__",
"__email__",
"__license__",
"__summary__",
"__title__",
"__uri__",
"__ver... | 1.382813 | 1 |
img_transforms.py | martinpflaum/image-augmentation-with-point-clouds | 0 | 33022 | import random
from torchvision.transforms import functional as F
from torchvision.transforms import transforms
from PIL import Image | 1.289063 | 1 |
sourse/ui/modules/current_settings.py | LeaveMyYard/BitmexGridTrader | 28 | 33023 | <gh_stars>10-100
from __future__ import annotations
from sourse.ui.modules.base_qdockwidget_module import BaseUIModule
from PyQt5 import QtWidgets, QtCore, QtGui
from sourse.marketmaker import MarketMaker
import typing
import json
class InputFormat:
def __init__(
self,
widget_type: typing.Type[Qt... | 1.960938 | 2 |
lyrics.py | JamesK2754/COVIDBot | 0 | 33024 | import lyricsgenius
geniustoken = "<KEY>"
genius = lyricsgenius.Genius(geniustoken)
songname = input("")
def lysearch(songname):
import lyricsgenius
geniustoken = "<KEY>"
genius = lyricsgenius.Genius(geniustoken)
songname = songname.split("/")
if len(songname) == 1:
song = genius.s... | 3.28125 | 3 |
network.py | wildarch/aiai | 1 | 33025 | import numpy as np
import numpy.random as rand
from functools import reduce
class Network:
def __init__(self, layer_sizes):
# layer_sizes: list of numbers representing number of neurons per layer
# Create a numpy array of biases for each layer except the (first) input layer
self.biases =... | 3.53125 | 4 |
al_helper/__init__.py | Taehun/al_helper | 0 | 33026 | """Let's score the unlabeled data for the active learning"""
from al_helper.apis import build
from al_helper.helpers import ALHelper, ALHelperFactory, ALHelperObjectDetection
__version__ = "0.1.0"
__all__ = ["build", "ALHelper", "ALHelperFactory", "ALHelperObjectDetection"]
| 1.070313 | 1 |
flocka/extensions.py | sleekslush/flocka | 1 | 33027 | <reponame>sleekslush/flocka
from flask_cache import Cache
from flask_debugtoolbar import DebugToolbarExtension
from flask_login import LoginManager
from flask_assets import Environment
from flask_migrate import Migrate
from flocka.models import User
# Setup flask cache
cache = Cache()
# Init flask assets
assets_env ... | 2.078125 | 2 |
django_rest_auth_embedded/tests/__init__.py | Volkova-Natalia/django_rest_auth_embedded | 0 | 33028 | <reponame>Volkova-Natalia/django_rest_auth_embedded
from .models import *
from .urls import *
from .views import *
from .integration import *
| 1.195313 | 1 |
pycwr/__init__.py | 1271756664/study | 144 | 33029 | from . import configure, core, draw, io, interp, retrieve, qc
__all__ = ["configure", "core", "draw", "io", "interp", "qc", "retrieve"]
| 0.988281 | 1 |
app/main.py | aturX/python-swagger-docker | 0 | 33030 | import sys
sys.path.append('../') # 新加入的
sys.path.append('.') # 新加入的
from flasgger import Swagger
from flask import Flask
from v1.sum_ab_controller import demo_sum
app = Flask(__name__)
# API 文档的配置
template = {
"swagger": "2.0",
"info": {
"title": "XXX 在线API",
"description": "在线API 调用测试",
"contact":... | 2.109375 | 2 |
tests/test_primary_beams.py | Song655/sdp-algorithm-reference | 1 | 33031 | <filename>tests/test_primary_beams.py<gh_stars>1-10
"""Unit tests for testing support
"""
import logging
import os
import unittest
import numpy
from astropy import units as u
from astropy.coordinates import SkyCoord
from arl.data.polarisation import PolarisationFrame
from arl.image.operations import export_image_t... | 2.015625 | 2 |
trees/tree_to_pairwisedistance.py | johned0/EdwardsLab | 30 | 33032 | <filename>trees/tree_to_pairwisedistance.py
"""
Start with a tree file, use ete3 to create a pairwise distance for all nodes. Basically this is the
distance matrix but as tuples.
if we have a tree like
----A
_____________|y
| |
| ... | 4 | 4 |
src/hitachi2020_b.py | 06keito/study-atcoder | 1 | 33033 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def main():
A,B,M = map(int,input().split())
A_prise = list(map(int,input().split()))
B_prise = list(map(int,input().split()))
Most_low_prise = min(A_prise)+min(B_prise)
for i in range(M):
x,y,c = map(int,input().split())
Post_coupon_ori... | 3.28125 | 3 |
gazoo_device/tests/unit_tests/utility_tests/adb_utils_test.py | dedsec-9/gazoo-device | 0 | 33034 | <gh_stars>0
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | 1.960938 | 2 |
webapp/apps/dynamic/urls.py | codekansas/PolicyBrain | 0 | 33035 | from django.conf.urls import patterns, include, url
from .views import (show_job_submitted, dynamic_input, dynamic_finished,
ogusa_results, dynamic_landing, dynamic_behavioral,
behavior_results, edit_dynamic_behavioral, elastic_results,
dynamic_elasticities, ... | 2.046875 | 2 |
gbdtmo/gbdtmo.py | samanemami/GBDTMO | 2 | 33036 | <gh_stars>1-10
import numpy as np
import numpy.ctypeslib as npct
import ctypes
from .histogram import get_bins_maps
from .lib_utils import *
class BoostUtils:
def __init__(self, lib):
self.lib = lib
self._boostnode = None
def _set_gh(self, g, h):
self.lib.SetGH(self._boostnode, g, h)
... | 2.234375 | 2 |
hold-tests/test_role_ans_dev.py | pahoughton/ansible-pahoughton | 0 | 33037 | <reponame>pahoughton/ansible-pahoughton<filename>hold-tests/test_role_ans_dev.py
#!/usr/bin/env python3
# 2018-10-13 (cc) <<EMAIL>>
'''
pips:
- testinfra
- molecule
- tox
'''
class test_role_ans_dev (object):
''' test_role_ans_dev useless class
'''
assert packages.installed(
yaml.array( pkg... | 1.664063 | 2 |
padertorch/contrib/cb/summary.py | jensheit/padertorch | 0 | 33038 |
import collections
import torch
import einops
import cached_property
import padertorch as pt
# loss: torch.Tenso r =None,
# losses: dict =None,
# scalars: dict =None,
# histograms: dict =None,
# audios: dict =None,
# images: dict =None,
class ReviewSummary(collections.abc.Mapping):
"""
>>> review_summary... | 2.03125 | 2 |
venv/FlightPlan2.py | zowegoop/DroneMapping | 0 | 33039 | <gh_stars>0
#!/usr/bin/env python3
# Rescue mission in the mountains 2
# if running locally, you need to install the djitello module
# run this on your linux or mac machine
# pip3 install djitello
######## PARAMETERS ###########
fspeed = 117/10 # Foward Speed in cm/s (15cm/s)
aspeed = 360/10 # Angular Speed Degrees... | 2.609375 | 3 |
ubertool/terrplant/tests/test_terrplant_unittest.py | qed-uber/ubertool | 2 | 33040 | <filename>ubertool/terrplant/tests/test_terrplant_unittest.py
import datetime
import inspect
import numpy.testing as npt
import os.path
import pandas as pd
import pandas.util.testing as pdt
import sys
from tabulate import tabulate
import unittest
# #find parent directory and import model
# parentddir = os.path.abspath... | 2.703125 | 3 |
mnist.py | a25765564/MLtest | 0 | 33041 | <reponame>a25765564/MLtest<gh_stars>0
import numpy as np
import sklearn.preprocessing as prep
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def xavier_init(fan_in,fan_out,constant = 1):
low = -constant * np.sqrt(6.0 /(fan_in + fan_out))
high = constant * np.sqrt(6.0 /(fan_... | 2.625 | 3 |
images/migrations/0001_initial.py | Hoofeycheng/Bookmarks | 0 | 33042 | # Generated by Django 2.1.4 on 2019-01-21 03:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | 1.757813 | 2 |
src/python/detectors/os_command_injection/os_command_injection.py | martinschaef/amazon-codeguru-reviewer-python-detectors | 18 | 33043 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# {fact rule=os-command-injection@v1.0 defects=1}
def exec_command_noncompliant():
from paramiko import client
from flask import request
address = request.args.get("address")
cmd = "ping -c 1 %s... | 2.34375 | 2 |
src/Dao/Parts.py | asarfara/PartCost | 0 | 33044 | <gh_stars>0
import logging
import json
from typing import List
from src.Entity.Part import Part
from datetime import date
from sqlite3 import Connection
class Parts:
def __init__(self, file_name: str, logger: logging, connection: Connection):
self.file_name = file_name
self.logger = logger
... | 3.21875 | 3 |
src/utils/plots.py | Light4Code/tensorflow-research | 5 | 33045 | <filename>src/utils/plots.py
import matplotlib.pyplot as plt
import numpy as np
import numpy.ma as ma
import utils.image_util as iu
from utils.custom_types import Vector
def plot_history(loss, acc, val_loss, val_acc):
plt.figure(figsize=(20, 10))
plt.subplot(2, 1, 1)
plt.title("Loss")
plt.grid()
... | 3.078125 | 3 |
pypi_starter/__init__.py | wuhaifengdhu/pypi-starter | 0 | 33046 | <gh_stars>0
"""
Your application
"""
from submodule.main import *
from main import *
| 1.148438 | 1 |
pocx/funcs/fofa.py | antx-code/pocx | 9 | 33047 | <filename>pocx/funcs/fofa.py
import httpx
import json
import base64
from loguru import logger
import urllib3
import ssl
try:
ssl_context = httpx.create_ssl_context()
except:
ssl_context = ssl.create_default_context()
ssl_context.options ^= ssl.OP_NO_TLSv1 # Enable TLS 1.0 back
urllib3.disable_warnings(urllib... | 2.15625 | 2 |
check_ec2_events.py | chartbeat/check_ec2_events | 2 | 33048 | #!/usr/bin/env python
#
# Author: <NAME>
# Copyright 2013 Chartbeat
# http://www.chartbeat.com
#
# Nagios check to alert on any retiring instances or
# instances that need rebooting
#
import getopt
import sys
import re
from datetime import datetime
from datetime import timedelta
from boto.ec2 import connect_to_region... | 2.5625 | 3 |
chc/api/CFunctionCandidateContract.py | Databean/CodeHawk-C | 10 | 33049 | <filename>chc/api/CFunctionCandidateContract.py
# ------------------------------------------------------------------------------
# CodeHawk C Analyzer
# Author: <NAME>
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2017-2020 Kestrel Technology ... | 1.367188 | 1 |
amplify/ext/phpfpm/util/version.py | dp92987/nginx-amplify-agent | 308 | 33050 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from amplify.agent.common.context import context
from amplify.agent.common.util import subp
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__ = ""
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
VERSION_CMD = "%s --version"
... | 1.929688 | 2 |
protera_stability/engine/__init__.py | stepp1/protera-stability | 1 | 33051 | from protera_stability.engine.default import get_cfg, setup_train, DefaultTrainer
from protera_stability.engine.lightning_train import (
default_cbs,
DataModule,
LitProteins,
TrainingPl,
)
__all__ = [
"DataModule",
"DefaultTrainer",
"LitProteins",
"TrainingPl",
"default_cbs",
"g... | 1.75 | 2 |
1122.py | wilbertgeng/LeetCode_exercise | 0 | 33052 | <gh_stars>0
"""1122. Relative Sort Array"""
class Solution(object):
def relativeSortArray(self, arr1, arr2):
"""
:type arr1: List[int]
:type arr2: List[int]
:rtype: List[int]
"""
####
pos = {num:i for i, num in enumerate(arr2)}
return sorted(arr1, key... | 2.703125 | 3 |
src/merge_sort.py | Gsllchb/4interview-python | 0 | 33053 | <gh_stars>0
import itertools
_THRESHOLD = 64
def merge_sort(arr, lo, hi):
if hi - lo <= _THRESHOLD:
_insert_sort(arr, lo, hi)
return
mi = (lo + hi) // 2
merge_sort(arr, lo, mi)
merge_sort(arr, mi, hi)
_merge(arr, lo, mi, hi)
def _insert_sort(arr, lo, hi):
for i in range(lo,... | 3.359375 | 3 |
code/client/munkilib/adobeutils.py | jlrgraham/munki | 0 | 33054 | #!/usr/bin/python
# encoding: utf-8
"""
adobeutils.py
Utilities to enable munki to install/uninstall Adobe CS3/CS4/CS5 products
using the CS3/CS4/CS5 Deployment Toolkits.
"""
# Copyright 2009-2014 <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complia... | 1.882813 | 2 |
examples/fore.py | LyQuid12/colorgb | 1 | 33055 | <filename>examples/fore.py
import colorgb
print(colorgb.fore("Hi!", "green"))
| 2.0625 | 2 |
prac/20200310/pygame_intro.py | yaroslavKonst/PythonPracticum | 2 | 33056 | import sys, pygame
pygame.init()
world_size = width, height = 10000, 9000
speed = [2, 2]
DX, DY = 0.1, 0.1
position = [width / 2, height / 2]
screen_size = int(DX * width), int(DY * height)
black = 0, 0, 0
screen = pygame.display.set_mode(screen_size)
ball = pygame.image.load("intro_ball.gif")
ballrect = ball.get_r... | 3.296875 | 3 |
gh.py | old-beans/isaac-gh-discord-bot | 2 | 33057 | <filename>gh.py<gh_stars>1-10
#! python
from airtable import Airtable
import discord, fstrings, re, random, os
from datetime import datetime
# datetime object containing current date and time
AIRTABLE_API_KEY = os.getenv('AIRTABLE_API_KEY') # stored in .env
AIRTABLE_BASE_KEY = os.getenv('AIRTABLE_BASE_KEY') # store... | 2.453125 | 2 |
bilbyweb/utility/job.py | ASVO-TAO/SS18B-PLasky | 0 | 33058 | <filename>bilbyweb/utility/job.py
"""
Distributed under the MIT License. See LICENSE.txt for more info.
"""
import json
import uuid
from ..utility.display_names import (
OPEN_DATA,
SIMULATED_DATA,
BINARY_BLACK_HOLE,
DYNESTY,
NESTLE,
EMCEE,
FIXED,
UNIFORM,
SKIP,
SUBMITTED,
Q... | 2.03125 | 2 |
activities/migrations/0003_alter_currentactivitie_importance_level.py | CiganOliviu/MyWorkflow | 0 | 33059 | # Generated by Django 3.2.5 on 2021-07-04 19:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activities', '0002_rename_currentactivity_currentactivitie'),
]
operations = [
migrations.AlterField(
model_name='currentactivit... | 1.726563 | 2 |
src/collector/wechat/wechat_utils.py | AI-xiaofour/2c | 0 | 33060 | <filename>src/collector/wechat/wechat_utils.py
#!/usr/bin/env python
"""
Created by howie.hu at 2021/4/9.
Description:微信相关通用函数
Changelog: all notable changes to this file will be documented
"""
from ruia import Request
from src.config import Config
from src.databases import MongodbManager
async def get_... | 2.046875 | 2 |
tests/v2/test_team_response_attributes.py | anbnyc/datadog-api-client-python | 0 | 33061 | <reponame>anbnyc/datadog-api-client-python
# coding: utf-8
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import sys
import unittest... | 2.09375 | 2 |
tests/unit/test_utility_item.py | luiscape/hdxscraper-worldpop | 0 | 33062 | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Unit tests for the item() utility function.
'''
import unittest
from collector.utilities.item import item
class TestUtilityItem(unittest.TestCase):
'''
Tests for the item() utility function.
'''
def test_item_returns_correct_type(self):
'''
Tests that the... | 3.0625 | 3 |
open/core/scripts/writeup_profile_prompt_generate_view.py | awesome-archive/open | 105 | 33063 | # flake8: noqa
import json
import time
import requests
from django.conf import settings
from websocket import create_connection
from open.core.scripts.swarm_ml_services import get_random_prompt
from open.core.writeup.constants import TEXT_GENERATION_URL
"""
this script's design was to compare performance behind djan... | 2.3125 | 2 |
utils/whatsthespotprice.py | New-Zealand-Zero/PowerMaker | 0 | 33064 | import http.client, urllib.request, urllib.parse, urllib.error, base64, time, json, ast, datetime, math, keys
import logging
logging.basicConfig(filename='io.log', level=logging.INFO, format='%(asctime)s %(message)s')
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': keys.OCP_APIM_SUBSCRIPTION_KEY,
... | 2.546875 | 3 |
gen/argo/events/client/__about__.py | argoproj-labs/argo-events-client-python | 0 | 33065 | <gh_stars>0
"""About this package."""
__all__ = [
"__title__",
"__summary__",
"__uri__",
"__version__",
"__author__",
"__email__",
"__license__",
"__copyright__",
]
__title__ = "argo-events"
__summary__ = "Community Maintained Python client for Argo Events"
__uri__ = "https://github.co... | 1.03125 | 1 |
mfctracker/management/commands/syncusers.py | kevans91/mfctracker | 3 | 33066 | <filename>mfctracker/management/commands/syncusers.py<gh_stars>1-10
# Copyright (c) 2016-2019 <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of sourc... | 1.671875 | 2 |
Exercises/015.py | GuilhermeRds1921/Python3-Guanabara | 0 | 33067 | # Escreva um programa que pergunte a quantidade de Km
# percorridos por um carro alugado e a quantidade de dias pelos
# quais ele foi alugado. Calcule o preço a pagar, sabendo que o carro
# custa R$60 por dia e R$0.15 por Km rodado.
km = float(input("Quantos km percorreu?: "))
dia = int(input("Quantos dias ele foi alu... | 3.734375 | 4 |
utils/make_package.py | j123123/llilc | 1,712 | 33068 | <filename>utils/make_package.py<gh_stars>1000+
#!/usr/bin/env python
import sys
import argparse
import os
import subprocess
import platform
import io
import string
try:
# For Python >= 3.0
from urllib.request import urlopen
except ImportError:
# For Python < 3.0
from urllib2 import urlopen
import shut... | 2.375 | 2 |
wireapp/wireapp/doctype/mpesa_payment/mpesa_payment.py | saleemdev/wireapp | 0 | 33069 | <filename>wireapp/wireapp/doctype/mpesa_payment/mpesa_payment.py
# Copyright (c) 2021, Salim and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class MPESAPayment(Document):
pass
| 0.980469 | 1 |
Adventure Game.py | CodeMaster7000/Adventure-Game | 0 | 33070 | import time
import random
def main():
print("You are trying to find your way to the centre of a maze where there is a pot of gold!")
time.sleep(2)
print("What you don't know is that this is a dangerous maze with traps and hazards.")
time.sleep(2)
start = input ("Do you want to enter the maze? (... | 4.15625 | 4 |
jcpdstools/view/mainwidget.py | SHDShim/JCPDSTools | 3 | 33071 | import os
from PyQt5 import QtWidgets
from .qtd import Ui_MainWindow
from version import __version__
from utils import SpinBoxFixStyle
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
"""
Main window
"""
def __init__(self, parent=None):
# initialization of the superclass
super(... | 2.375 | 2 |
tests/unit_tests/test_tethys_services/test_admin.py | msouff/tethys | 79 | 33072 | <reponame>msouff/tethys<filename>tests/unit_tests/test_tethys_services/test_admin.py
import unittest
from unittest import mock
from django.utils.translation import ugettext_lazy as _
from tethys_services.models import DatasetService, SpatialDatasetService, WebProcessingService, PersistentStoreService
from tethys_servi... | 2.203125 | 2 |
Codefights/arcade/intro/level-6/25.Array-Replace/Python/test.py | RevansChen/online-judge | 7 | 33073 | # Python3
from solution1 import arrayReplace as f
qa = [
([1, 2, 1], 1, 3,
[3, 2, 3]),
([1, 2, 3, 4, 5], 3, 0,
[1, 2, 0, 4, 5]),
([1, 1, 1], 1, 10,
[10, 10, 10]),
([1, 2, 1, 2, 1], 2, 1,
[1, 1, 1, 1, 1]),
([1, 2, 1, 2, 1], 2, 2,
[1, 2, 1, 2, 1]),
([3, 1], 3, 9,
[9... | 3.265625 | 3 |
tests/inception/test_inception_hardware_perf.py | ispras/avatar2 | 415 | 33074 | from avatar2 import *
import sys
import os
import logging
import serial
import time
import argparse
import pyudev
import struct
import ctypes
from random import randint
# For profiling
import pstats
logging.basicConfig(filename='/tmp/inception-tests.log', level=logging.INFO)
# ************************************... | 2.453125 | 2 |
tianshou/env/worker/dummy.py | Leeqh666/tianshou | 0 | 33075 | <gh_stars>0
import gym
import numpy as np
from typing import List, Callable, Optional, Any
from tianshou.env.worker import EnvWorker
class DummyEnvWorker(EnvWorker):
"""Dummy worker used in sequential vector environments."""
def __init__(self, env_fn: Callable[[], gym.Env]) -> None:
super().__init__... | 2.609375 | 3 |
beartype/_decor/conf.py | posita/beartype | 0 | 33076 | <reponame>posita/beartype
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2021 Beartype authors.
# See "LICENSE" for further details.
'''
**Beartype decorator configuration API** (i.e., enumerations, classes,
singletons, and other attributes e... | 2.0625 | 2 |
001-099/38/38.py | lunixbochs/project-euler | 6 | 33077 | <filename>001-099/38/38.py
ref = set('123456789')
def pans(n):
r = str(n)
i = 1
while True:
i += 1
r += str(i * n)
if len(r) > 9:
break
if len(r) == 9 and set(r) == ref:
yield i, r
m = 0
for i in xrange(2, 1000000000):
for z, n in pans(i):
... | 2.953125 | 3 |
sugaroid/version.py | blackxspade/sugaroid | 0 | 33078 | <filename>sugaroid/version.py
#!/usr/bin/env python3
VERSION = "v0.22.0"
| 0.878906 | 1 |
nixnet/_session/__init__.py | ni-ldp/nixnet-python | 16 | 33079 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import typing # NOQA: F401
__all__ = [] # type: typing.List[typing.Text]
| 1.1875 | 1 |
hedweb/services.py | hed-standard/hed-web | 0 | 33080 | <filename>hedweb/services.py<gh_stars>0
import os
import io
import json
from flask import current_app
from hed import models
from hed.errors import HedFileError
from hed import schema as hedschema
from hedweb.constants import base_constants
from hedweb import events, spreadsheet, sidecar, strings
app_confi... | 2.359375 | 2 |
Python/easy/e395.py | tlgs/dailyprogrammer | 4 | 33081 | <gh_stars>1-10
# 22/06/2021
import itertools
def nonogramrow(seq):
return [sum(g) for k, g in itertools.groupby(seq) if k]
assert nonogramrow([]) == []
assert nonogramrow([0, 0, 0, 0, 0]) == []
assert nonogramrow([1, 1, 1, 1, 1]) == [5]
assert nonogramrow([0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1]) == [5, 4]
assert nono... | 2.953125 | 3 |
paura_lite.py | 777AVY777/Clone_paura | 191 | 33082 | <filename>paura_lite.py
# paura_lite:
# An ultra-simple command-line audio recorder with real-time
# spectrogram visualization
import numpy as np
import pyaudio
import struct
import scipy.fftpack as scp
import termplotlib as tpl
import os
# get window's dimensions
rows, columns = os.popen('stty size', 'r').read().sp... | 2.59375 | 3 |
dataviva/apps/map/views.py | joelvisroman/dataviva-site | 126 | 33083 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template, g, request, make_response
from dataviva.apps.general.views import get_locale
from dataviva.translations.dictionary import dictionary
from dataviva import datavivadir
from config import GZIP_DATA
from dataviva.utils.cached_que... | 1.882813 | 2 |
TransfertFichier.py | Fabien034/TimeLaps | 0 | 33084 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright: <NAME>
# Version 0.1.1 - 19 Avril 2016
# Version 0.1.2 - 29 Avril 2016
## Debug VisualStudio
# import ptvsd
# ptvsd.enable_attach(None)
from __future__ import unicode_literals
from __future__ import print_function
import os
import sys
im... | 2.34375 | 2 |
posts/urls.py | xXcoronaXx/Dblog | 0 | 33085 | from django.conf.urls import include, url
urlpatterns = [
url(r'^admin/(?P<slug>[\w\-]+)/', 'posts.views.post_preview', name='post_preview'),
url(r'^tag/(?P<slug>[\w\-]+)/', 'posts.views.posts_view_tag', name='posts_tag'),
url(r'^popular/', 'posts.views.posts_view_popular', name='posts_popular'),
url(r... | 1.6875 | 2 |
Basic_if_then/movement.py | BH4/Halite3-bots | 0 | 33086 | from hlt.positionals import Position, Direction
from hlt import constants
import random
import logging
# Import my stuff
import helpers
def navigate_old(ship, destination, game_map):
curr_pos = ship.position
move_cost = game_map[curr_pos].halite_amount/constants.MOVE_COST_RATIO
if ship.halite_amount >=... | 3.046875 | 3 |
Bert/regressor.py | RohithYogi/Funniness-in-News-Headlines | 0 | 33087 | from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
from sklearn.svm import SVR
from sklearn.metrics import mean_squared_error
from sklearn.linear_model import HuberRegressor
import numpy as np
import pickle
from dataloader import HeadlineDataset
from csv import writer
import os, subprocess
im... | 2.40625 | 2 |
examples/blogprj/urls.py | pimentech/django-mongoforms | 1 | 33088 | from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^', include('apps.blog.urls')),
) | 1.304688 | 1 |
recursive_categories.py | singulart/wikiwalks | 0 | 33089 | <reponame>singulart/wikiwalks<gh_stars>0
import wikipediaapi
import os
import json
import progressbar
CATEGORY = 'Category:Feminist artists'
#CATEGORY = 'Category:Contemporary artists'
def traverse_categories_tree(categorymembers, level=0, max_level=100):
for c in categorymembers.values():
#print("%s: %s... | 3.015625 | 3 |
tests/test_handlers/test_yamlHandler/test_yamlHandler.py | UCHIC/ODMStreamingDataLoader | 0 | 33090 | <filename>tests/test_handlers/test_yamlHandler/test_yamlHandler.py
from os import getcwd
from os.path import join
from src.handlers.yamlHandler import YAMLHandler
from tests.test_utils import returnFiles
__author__ = 'jmeline'
class TestYAMLHandler:
def setup(self):
self.path = join(getcwd(), 'test_handler... | 2.53125 | 3 |
samples/donut.py | stoneskin/python-minecraft | 7 | 33091 | <reponame>stoneskin/python-minecraft
from mcpi_e.minecraft import Minecraft
from mcpi_e import block
from time import sleep
from random import *
from math import *
def draw_donut(mcx,mcy,mcz,R,r,mcblock):
for x in range(-R-r,R+r):
for y in range(-R-r,R+r):
xy_dist = sqrt(x**2 + y**2)
if (xy_dist... | 3.046875 | 3 |
britecoreproject/orm.py | alis0nc/britecore-project | 0 | 33092 | <filename>britecoreproject/orm.py
"""
Define ORM classes.
"""
from sqlobject import *
class RiskType(SQLObject):
"""Define RiskType ORM class."""
riskTypeName = StringCol()
fields = RelatedJoin('Field')
class Field(SQLObject):
"""Define Field ORM class."""
fieldName = StringCol()
fieldType = F... | 2.90625 | 3 |
plumbum.py | maxnasonov/cloudwatch-to-graphite | 0 | 33093 | <filename>plumbum.py
# -*- coding: UTF-8 -*-
"""
Usage:
plumbum <template> <namespace> [region] [options]...
Options:
template path to the jinja2 template
namespace AWS namespace. Currently supports: elasticache, elb, ec2, rds, asg, sqs
region AWS region [default: us-east-1]
options key value combi... | 2.453125 | 2 |
fixtures/aerl/fabfile.py | bbengfort/honu | 2 | 33094 | <gh_stars>1-10
# fabfile
# Fabric command definitions for running anti-entropy reinforcement learning.
#
# Author: <NAME> <<EMAIL>>
# Created: Tue Jun 13 22:26:00 2017 -0400
#
# Copyright (C) 2017 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: fabfile.py [] <EMAIL> $
"""
Fabric command definitions ... | 1.6875 | 2 |
python/657.robot-return-to-origin.py | Zhenye-Na/leetcode | 10 | 33095 | <gh_stars>1-10
#
# @lc app=leetcode id=657 lang=python3
#
# [657] Robot Return to Origin
#
# https://leetcode.com/problems/robot-return-to-origin/description/
#
# algorithms
# Easy (73.67%)
# Likes: 1228
# Dislikes: 692
# Total Accepted: 274.1K
# Total Submissions: 371K
# Testcase Example: '"UD"'
#
# There is a ... | 3.921875 | 4 |
src/python/pants/backend/swift/goals/tailor.py | danxmoran/pants | 0 | 33096 | # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from dataclasses import dataclass
from typing import Iterable
from pants.backend.swift.target_types import SWIFT_FILE_EXTENSIONS, SwiftSourcesGenerator... | 2 | 2 |
WP5/KU/SharedResources/get_incrementer.py | MONICA-Project/sfn | 1 | 33097 | # get_incrementer.py
"""Helper function to create counter strings with a set length throughout."""
__version__ = '0.2'
__author__ = '<NAME> (KU)'
def get_incrementer(num, num_digits):
if num >= 10**num_digits:
print('NUMBER IS LARGER THAN THE MAX POSSIBLE BASED ON num_digits')
return -1
else:
... | 4 | 4 |
Curso_Coursera/Ex1_ParImpar.py | shirleyguimaraes/Linguagem_Python | 0 | 33098 |
def main():
n = int(input("Digite um número inteiro: "))
resto = n % 2
if resto == 0:
print("Par")
else:
print("Impar")
main()
| 3.796875 | 4 |
pyro/contrib/oed/__init__.py | cweniger/pyro | 10 | 33099 | """
The :mod:`pyro.contrib.oed` module provides tools to create optimal experiment
designs for pyro models. In particular, it provides estimators for the
expected information gain (EIG) criterion.
To estimate the EIG for a particular design, use::
def model(design):
...
# Select an appropriate EIG es... | 2.03125 | 2 |