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 |
|---|---|---|---|---|---|---|
application.py | ane4katv/python_training | 0 | 35700 | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
class Application:
def __init__(self):
self.wd = webdriver.Chrome(executable_path='/Users/atvelova/Documents/python_training/chromedriver')
self.wd.implicitly_wait(60)
d... | 2.875 | 3 |
codes/network/__init__.py | upzheng/Electrocardio-Panorama | 33 | 35701 | <gh_stars>10-100
from .model_nefnet import Model_nefnet
from torch.nn import MSELoss, L1Loss, CrossEntropyLoss
from .loss import losswrapper, MSELead
def build_model(cfg):
model_name = cfg.MODEL.model
if model_name == 'model_nefnet':
return Model_nefnet(theta_encoder_len=cfg.MODEL.theta_L, l... | 2.25 | 2 |
guild/deps.py | Jim-Holmstroem/guildai | 0 | 35702 | # Copyright 2017-2020 TensorHub, Inc.
#
# 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 writ... | 1.765625 | 2 |
perm_hmm/policies/belief_tree.py | usnistgov/perm_hmm | 0 | 35703 | r"""Provides functions used by strategies that use a tree to select the
permutation.
To compute optimal permutations, we use the belief states
.. math::
b(y^{k-1}) := \mathbb{P}(s_0, s_k|y^{k-1}),
where the :math:`s_k` are the states of the HMM at step :math:`k`, and the
superscript :math:`y^{k-1}` is the sequen... | 3.453125 | 3 |
setup.py | zhul9311/XFNTR | 0 | 35704 | # All .ui files and .so files are added through keyword: package_data, because setuptools doesn't include them automatically.
import sys
import os
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name = "xfntr",
version = "0.3.0",
autho... | 1.320313 | 1 |
scripts/subsample_model_files.py | musicpiano/mlmicrophysics | 4 | 35705 | <reponame>musicpiano/mlmicrophysics
import xarray as xr
import argparse
from glob import glob
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="Input File Directory")
parser.add_argument("-o", "--output", help="Output file directory")
parser.add_argument("-x", "-... | 2.640625 | 3 |
main.py | dddzg/MoCo | 41 | 35706 | <filename>main.py
from torchvision import transforms, datasets
from torch.utils.data import DataLoader
import config
from dataset import custom_dataset
import pretrainedmodels as models
import torch
from tqdm import tqdm
from torch.nn import functional as F
import types
from utils import AverageMeter, get_shuffle_idx
i... | 2.421875 | 2 |
covid_briefing.py | jron-reb/CA-3 | 0 | 35707 | """
module contains a function that polls the ukcovid api in order to find up to date
information about coronavirus in the UK
"""
import json
import logging
from uk_covid19 import Cov19API
from requests import get
logging.basicConfig(level=logging.DEBUG, filename='sys.log')
def get_covid() -> str:
"""... | 3.734375 | 4 |
TaskManage/models.py | CooloiStudio/django-hotel-manager | 1 | 35708 | # coding: utf-8
from django.db import models
from django.contrib.auth.models import User
from RoomManage.models import Room, Customs
# Create your models here.
class Task(models.Model):
context = models.TextField()
date = models.DateTimeField()
task_status = models.CharField(max_length=20, default='und... | 2.140625 | 2 |
test/pypendency/test_parser.py | Taschenbergerm/pypendency | 0 | 35709 | import pathlib
import pytest
from pypendency.parser.yaml import Parser
from pypendency.lexer import LarkRelationLexer
def test_read_yaml_node_length():
file = pathlib.Path(__file__).parent / "example.yml"
lexer = LarkRelationLexer()
p = Parser(lexer=lexer, folder=pathlib.Path(__file__).parent)
g = p... | 2.375 | 2 |
tests.py | fredrikaverpil/python-rust | 1 | 35710 | <reponame>fredrikaverpil/python-rust
import re
import string
import random
import mylib
# Python ZIP version
def count_doubles(val):
total = 0
# there is an improved version later on this post
for c1, c2 in zip(val, val[1:]):
if c1 == c2:
total += 1
return total
# Python REGEXP v... | 3.3125 | 3 |
feapder/network/user_pool/__init__.py | ibryang/feapder | 876 | 35711 | __all__ = [
"GuestUserPool",
"GuestUser",
"NormalUserPool",
"NormalUser",
"GoldUserPool",
"GoldUser",
"GoldUserStatus",
]
from .gold_user_pool import GoldUserPool, GoldUser, GoldUserStatus
from .guest_user_pool import GuestUserPool, GuestUser
from .normal_user_pool import NormalUserPool, No... | 1.21875 | 1 |
src/rez/cli/memcache.py | maxnbk/rez | 0 | 35712 | <filename>src/rez/cli/memcache.py<gh_stars>0
# Copyright Contributors to the Rez project
#
# 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
#
#... | 2.4375 | 2 |
core/data/Cityscape/__init__.py | js-fan/MCIC | 1 | 35713 | from .cs_loader import CSPointDataset
from .cs_class_loader import CSClassDataset
from .cs_seed_loader import CSSeedDataset
| 1.015625 | 1 |
lib/sxc/actuator.py | GoogleCloudPlatform/SourceXCloud | 3 | 35714 | # Copyright 2015 Google Inc.
#
# 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, ... | 2.375 | 2 |
linuxjournalarchiver.py | jcjordyn130/linuxjournalarchiver | 0 | 35715 | # linuxjournalarchiver - Some hacky code I wrote to archive the Linux Journal.
# Licensed under the BSD-3-Clause license.
from bs4 import BeautifulSoup
import requests
import re
import pathlib
# Download the download page.
print("Downloading magazine list...")
session = requests.session()
# Update the User Agent to c... | 2.796875 | 3 |
mtianyan/listname.py | mtianyan/mtianyan | 0 | 35716 | import os.path
filepathlist=[]
filenamelist=[]
def processDirectory ( args, dirname, filenames ):
for filename in filenames:
file_path=os.path.join(dirname,filename)
if os.path.isfile(file_path):
filepathlist.append(file_path)
filenamelist.append(filename)
def ... | 2.890625 | 3 |
artifacts/pull_sources.py | onedata/bamboo | 0 | 35717 | #! /usr/bin/env python3
"""
Pulls artifacts from external repo using branches defined in branchConfig.yaml
file.
Run the script with -h flag to learn about script's running options.
"""
__author__ = "<NAME>"
__copyright__ = "Copyright (C) 2018 ACK CYFRONET AGH"
__license__ = "This software is released under the MIT li... | 2.359375 | 2 |
setup.py | strath-sdr/rfsoc_notebooks | 8 | 35718 | import os
import shutil
from distutils.dir_util import copy_tree
from setuptools import find_packages, setup
# global variables
nb_dir = os.environ['PYNQ_JUPYTER_NOTEBOOKS']
package_name = 'pystrath_rfsoc'
pip_name = 'pystrath-rfsoc'
data_files = []
# copy common notebooks to jupyter home
def copy_common_notebooks()... | 2.0625 | 2 |
test/test_query.py | jayvdb/version-query | 0 | 35719 | """Tests of querying tools."""
import contextlib
import importlib
import io
import logging
import os
import pathlib
import sys
import tempfile
import unittest
from version_query.version import VersionComponent, Version
from version_query.git_query import query_git_repo, predict_git_repo
from version_query.py_query im... | 2.390625 | 2 |
app/main/forms.py | Ag-nes/Blog | 0 | 35720 | <gh_stars>0
from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, SelectField ,SubmitField
from wtforms.validators import input_required
class EditProfile(FlaskForm):
about = TextAreaField('Tell us about yourself.',validators = [input_required()])
submit = SubmitField('Update')
cla... | 2.75 | 3 |
test/lit/memberfield/__init__.py | sivachandra/gala | 4 | 35721 | <filename>test/lit/memberfield/__init__.py
import gdb
def print_field(f):
print("========")
print("name: %s" % f.name)
print("type: %s" % f.type)
if hasattr(f, "bitpos"):
print("bitpos: %d" % f.bitpos)
else:
print("No bitpos attribute.")
print("bitsize: %d" % f.bitsize)
print("parent_type: %s" % ... | 2.421875 | 2 |
source/main.py | psythefirst/bibrarian | 4 | 35722 | import argparse
import getpass
import glob
import hashlib
import itertools
import json
import logging
import os
import sys
import threading
import time
import traceback
import subprocess
import urllib
import urllib.request
import urllib.parse
import urwid
import pybtex
import pybtex.database
class BibEntry:
cla... | 2.203125 | 2 |
pipeline_scripts/pre_linkage/E_CCS_Households.py | Data-Linkage/ccslink | 0 | 35723 | # ----------------------- #
# -------- SETUP -------- #
# ----------------------- #
# Import PySpark, Parameters, File Paths, Functions & Packages
import pyspark
from CCSLink import Parameters
from CCSLink.Parameters import FILE_PATH
from CCSLink import Person_Functions as PF
from CCSLink import Household_Functions as... | 2.265625 | 2 |
abc130/b/b.py | KeiNishikawa218/atcoder | 0 | 35724 | <reponame>KeiNishikawa218/atcoder<gh_stars>0
n, x = map(int, input().split())
ll = list(map(int, input().split()))
ans = 1
d_p = 0
d_c = 0
for i in range(n):
d_c = d_p + ll[i]
if d_c <= x:
ans += 1
d_p = d_c
print(ans) | 2.359375 | 2 |
Django/ballon/admin.py | ballon3/GRAD | 0 | 35725 | <reponame>ballon3/GRAD<gh_stars>0
from django.contrib import admin
from ballon.models import Pkg, Resume, Main, Education, Project, Work, Skill, Testimonial, Social, Address
#admin.site.register(Category)
admin.site.register(Resume)
admin.site.register(Main)
admin.site.register(Education)
admin.site.register(Work)
adm... | 1.40625 | 1 |
docs/scripts/add_labels_without_proto.py | daachi/tezos | 0 | 35726 | <gh_stars>0
#!/usr/bin/env python3
# Add unversioned labels to a page, before each versioned label
## Overview
# This script adds unversioned labels (i.e. Sphinx labels without the _N suffix,
# where N is the name of the protocol) to one doc page before every versioned
# label, unless an unversioned label already exi... | 2.265625 | 2 |
ds/eurito_indicators/getters/arxiv_getters.py | nestauk/eurito_indicators | 0 | 35727 | # Get arxiv data
import json
import logging
import os
import pickle
from collections import Counter
from datetime import datetime
from io import BytesIO
from zipfile import ZipFile
import numpy as np
import pandas as pd
import requests
from kaggle.api.kaggle_api_extended import KaggleApi
from eurito_indicators impor... | 2.09375 | 2 |
StatusWindow.py | BlackXanthus/PyBirch5 | 0 | 35728 |
####
#Made reduntant in Alpha 0.4
#
# As this provided no extra functionality from the Channel, and is, in essance,
# simply a speciall channel, various additions were made to Channel.py
# To perform the same function. This has meant less duplication of code.
####
import sys, sip
from PyQt5 import QtCore, QtGui
#fro... | 2.140625 | 2 |
utils/config_objects.py | spikingevolution/evolution-strategies | 0 | 35729 | <gh_stars>0
from collections import namedtuple
Config = namedtuple('Config', [
'env_id',
'env_seed',
'population_size',
'timesteps_per_gen',
'num_workers',
'learning_rate',
'noise_stdev',
'snapshot_freq',
'return_proc_mode',
'calc_obstat_prob',
'l2coeff',
'eval_prob'
])... | 1.765625 | 2 |
scripts/run_burner_bench.py | joye1503/cocrawler | 166 | 35730 | <reponame>joye1503/cocrawler<filename>scripts/run_burner_bench.py
import sys
import logging
import functools
import asyncio
import cocrawler.burner as burner
import cocrawler.parse as parse
import cocrawler.stats as stats
test_threadcount = 2
loop = asyncio.get_event_loop()
b = burner.Burner(test_threadcount, loop, ... | 2.609375 | 3 |
examples/crankd/sample-of-events/generate-event-plist.py | timgates42/pymacadmin | 112 | 35731 | #!/usr/bin/env python
"""
Generates a list of OS X system events into a plist for crankd.
This is designed to create a large (but probably not comprehensive) sample
of the events generated by Mac OS X that crankd can tap into. The generated
file will call the 'tunnel.sh' as the command for each event; said fail can
... | 2.078125 | 2 |
submissions/available/NNSlicer/NNSlicer/eval/eval_by_reduced_point.py | ziqi-zhang/fse20 | 0 | 35732 | import csv
import random
from functools import partial
from typing import Callable, Optional
from pdb import set_trace as st
import os
import random
import pandas as pd
from typing import Any, Callable, Dict, Iterable, List, Tuple, Union
import numpy as np
import tensorflow as tf
from foolbox.attacks import (
FGSM... | 1.640625 | 2 |
PRESUBMIT.py | iamtheonedaone1/n | 69 | 35733 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 2.0625 | 2 |
python_advanced_retake_18_08_2021/fill_the_box.py | ivan-yosifov88/python_oop_june_2021 | 1 | 35734 | <reponame>ivan-yosifov88/python_oop_june_2021<filename>python_advanced_retake_18_08_2021/fill_the_box.py
def fill_the_box(*args):
height = args[0]
length = args[1]
width = args[2]
cube_size = height * length * width
for i in range(3, len(args)):
if args[i] == "Finish":
return f"T... | 4.1875 | 4 |
neurokit2/ecg/ecg_process.py | danibene/NeuroKit | 0 | 35735 | <gh_stars>0
# -*- coding: utf-8 -*-
import pandas as pd
from ..signal import signal_rate, signal_sanitize
from .ecg_clean import ecg_clean
from .ecg_delineate import ecg_delineate
from .ecg_peaks import ecg_peaks
from .ecg_phase import ecg_phase
from .ecg_quality import ecg_quality
def ecg_process(ecg_signal, sampli... | 3.15625 | 3 |
lab3/lab3a.py | Speedy905/ops435 | 1 | 35736 | #!/usr/bin/env python3
#<NAME>
# return_text_value function
def return_text_value():
name = 'Terry'
greeting = 'Good Morning ' + name
return greeting
# return_number_value function
def return_number_value():
num1 = 10
num2 = 5
num3 = num1 + num2
return num3
# Main program
if __name__ == '__main__':
prin... | 3.9375 | 4 |
sightpy/geometry/sphere.py | ulises1229/Python-Raytracer | 326 | 35737 | <reponame>ulises1229/Python-Raytracer
import numpy as np
from ..utils.constants import *
from ..utils.vector3 import vec3
from ..geometry import Primitive, Collider
class Sphere(Primitive):
def __init__(self,center, material, radius, max_ray_depth = 5, shadow = True):
super().__init__(center, mat... | 2.90625 | 3 |
src/lib/worker/worker_1.py | sankhaMukherjee/celeryTest | 0 | 35738 | <filename>src/lib/worker/worker_1.py
from logs import logDecorator as lD
import json, psycopg2
from lib.celery.App import app
config = json.load(open('../config/config.json'))
logBase = config['logging']['logBase'] + 'lib.worker.worker_1'
@app.task
@lD.log(logBase + '.add')
def add(logger, a, b):
try:
... | 2.171875 | 2 |
chapter-3/foreach.py | outerbounds/dsbook | 27 | 35739 | from metaflow import FlowSpec, step
class ForeachFlow(FlowSpec):
@step
def start(self):
self.creatures = ['bird', 'mouse', 'dog']
self.next(self.analyze_creatures, foreach='creatures')
@step
def analyze_creatures(self):
print("Analyzing", self.input)
self.creature ... | 2.75 | 3 |
www/wotd/models.py | nullsym/sachiye | 0 | 35740 | <reponame>nullsym/sachiye
# Imports from our app
from wotd import db, app
# Flask-Login works via the LoginManager class: Thus, we need
# to start things off by telling LoginManager about our Flask app
from flask_login import LoginManager
login_manager = LoginManager(app)
login_manager.init_app(app)
# Password hashing... | 2.578125 | 3 |
Aula07/03EstruturaDeRepeticaoFor.py | gutoffline/curso-python-2021 | 0 | 35741 | """
for x in range(10):
print(x)
for x in range(20, 30):
print(x)
for x in range(10,100,5):
print(x)
for x in range(10,1,-1):
print(x)
print(range(10))
"""
frutas = ["maçã", "laranja", "banana", "morango"]
for x in range(len(frutas)):
print(frutas[x])
for fruta in frutas:
print(fruta)
| 4.25 | 4 |
twitter_functions.py | SakiFu/Twitter | 0 | 35742 | import twitter
import util
from config import *
BOSTON_WOEID = 2367105
api = twitter.Api(consumer_key=key,consumer_secret=secret,access_token_key=access_key,access_token_secret=access_secret)
def search(searchTerm):
"""
Print recent tweets containing `searchTerm`.
To test this function, at the command li... | 3.390625 | 3 |
tests/test_download.py | HeavyTony2/downloader-cli | 301 | 35743 | <gh_stars>100-1000
"""Tests various methods of the Download
class.
All the methods that start with test are used
to test a certain function. The test method
will have the name of the method being tested
seperated by an underscore.
If the method to be tested is extract_content,
the test method name will be test_extrac... | 3.171875 | 3 |
Yuanjunling1/boss-xiadan.py | yuanjunling/PycharmProjects | 0 | 35744 | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException... | 2.484375 | 2 |
notification.py | phillco/talon-accessibility | 10 | 35745 | from dataclasses import dataclass, field
from itertools import chain
from typing import Optional
from talon import Context, Module, actions, app, cron, ui
# XXX(nriley) actions are being returned out of order; that's a problem if we want to pop up a menu
mod = Module()
mod.list("notification_actions", desc="Notific... | 2.3125 | 2 |
emulation_system/emulation_system/consts.py | Opentrons/ot3-emulator | 0 | 35746 | <gh_stars>0
"""System-wide constants."""
from __future__ import annotations
import os
# Mode Names
PRODUCTION_MODE_NAME = "prod"
DEVELOPMENT_MODE_NAME = "dev"
# Latest Git Commit
LATEST_KEYWORD = "latest"
# Root of repo
ROOT_DIR = os.path.normpath(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "..",... | 1.585938 | 2 |
multiagent/scenarios/simple_hockey.py | johan-kallstrom/multiagent-particle-envs | 0 | 35747 | import numpy as np
from multiagent.core import World, Agent, Landmark
from multiagent.scenario import BaseScenario
class Scenario(BaseScenario):
def make_world(self):
world = World()
# set any world properties first
world.dim_c = 2
num_agents = 2
num_adversaries = 1
... | 2.578125 | 3 |
pyshocks/continuity/schemes.py | alexfikl/pyshocks | 0 | 35748 | <filename>pyshocks/continuity/schemes.py
from dataclasses import dataclass
from typing import Optional
import jax.numpy as jnp
from pyshocks import Grid, ConservationLawScheme
from pyshocks import flux, numerical_flux, predict_timestep
from pyshocks.weno import WENOJSMixin, WENOJS32Mixin, WENOJS53Mixin
# {{{ base
... | 2.328125 | 2 |
finitewave/core/command/__init__.py | ArsOkenov/Finitewave | 0 | 35749 | <filename>finitewave/core/command/__init__.py
from finitewave.core.command.command import Command
from finitewave.core.command.command_sequence import CommandSequence
| 1.492188 | 1 |
smart_meter/apps.py | GPXenergy/gpx_server_api | 0 | 35750 | <reponame>GPXenergy/gpx_server_api<filename>smart_meter/apps.py
from django.apps import AppConfig
class SmartMeterConfig(AppConfig):
name = 'smart_meter'
| 1.367188 | 1 |
settings.py | nopogo/twitchplaysturtle | 0 | 35751 | import secrets
channel_name = "nopogo_tv"
server_ip = "0.0.0.0"
server_port = 8000
channel_id = 28092036
ws_host = "wss://pubsub-edge.twitch.tv"
ws_local = secrets.local_ip
topics = [
"channel-bits-events-v2.{}".format(channel_id),
"channel-points-channel-v1.{}".format(channel_id),
"channel-subscribe-events-v1.{}... | 1.421875 | 1 |
piv/framed/framed.py | LaCumbancha/piv-algorithm | 0 | 35752 | # Imports
import numpy as np
# Single to double frame
# Combines images by 2, returning an array with two frames (one for each image).
#
# Input: 5 images with step 1.
# Output: 4 double-framed images.
# FrameA: 1 2 3 4
# FrameB: 2 3 4 5
#
# Input: 8 images with step 3.
# Output: 5 doubled... | 3.046875 | 3 |
paccmann_proteomics/data/datasets/seq_clf.py | xueeinstein/paccmann_proteomics | 28 | 35753 | import os
import time
from dataclasses import dataclass, field
from enum import Enum
from typing import List, Optional, Union
import torch
from filelock import FileLock
from transformers import PreTrainedTokenizer, RobertaTokenizer, RobertaTokenizerFast, XLMRobertaTokenizer
from transformers.data.datasets import GlueDa... | 2.15625 | 2 |
code/shell_scripts/fcs_processing.py | RPGroup-PBoC/rnaseq_barcode | 0 | 35754 | #! /usr/bin/env python
"""
This script parses and cleans up a provided Flow Cytometry Standard (fcs) file
and saves it as a Comma Separated Value (csv).
"""
import os
import re
import numpy as np
import pandas as pd
import optparse
import fcsparser
# ####################################################################... | 2.828125 | 3 |
test/utils/enums.py | alvintangz/cscc43-a2-sql-queries-test | 3 | 35755 | from enum import Enum
class Semester(Enum):
FALL = 9
WINTER = 1
SUMMER = 5
| 2.578125 | 3 |
day06/day6_part1.py | raistlin7447/AoC2021 | 0 | 35756 | <reponame>raistlin7447/AoC2021<gh_stars>0
with open("day6_input.txt") as f:
initial_fish = list(map(int, f.readline().strip().split(",")))
fish = [0] * 9
for initial_f in initial_fish:
fish[initial_f] += 1
for day in range(80):
new_fish = [0] * 9
for state in range(9):
... | 3.03125 | 3 |
util.py | atush-dhakal/GT-MW-Notifier | 1 | 35757 | import requests
import configparser
from email_validator import validate_email, EmailNotValidError
from mailchimp import OnCampusJobList
import email_notifier
import groupme_bot
config = configparser.ConfigParser()
config.read('config.ini')
google_config = config['GOOGLE']
def is_valid_recaptcha(recaptcha_response) ... | 2.515625 | 3 |
datagokr/kma/VilageFcstInfoService_2_0.py | uujei/datagokr | 0 | 35758 | import logging
import os
from datetime import datetime
from enum import Enum
from typing import Optional
from pydantic import BaseModel, Field, HttpUrl, SecretStr, ValidationError
from ..DataGoKr import DataGoKr
# logging
logger = logging.getLogger(__file__)
# debug only
KMA_API_KEY = os.getenv("KMA_API_KEY")
####... | 2.28125 | 2 |
tests/test_io.py | OpenPIV/pivpy | 8 | 35759 | <filename>tests/test_io.py
import numpy as np
from pivpy import io, pivpy
import matplotlib.pyplot as plt
import os
import pkg_resources as pkg
path = pkg.resource_filename("pivpy", "data")
fname = os.path.join(path, "Insight", "Run000002.T000.D000.P000.H001.L.vec")
# def test_get_dt():
# """ test if we get corr... | 2.40625 | 2 |
test_hig.py | xiaohan2012/lst | 1 | 35760 | <reponame>xiaohan2012/lst<gh_stars>1-10
import unittest
import networkx as nx
from nose.tools import assert_equal, assert_raises, \
assert_true
from .util import json_load
from .test_util import make_path
from hig import construct_hig_from_interactions
from interactions import InteractionsUtil as IU
class HIGTest... | 2.28125 | 2 |
euler_angle_visualization/lib/TaitBryanRotation.py | klosteraner/Euler-Angles-Visual | 0 | 35761 | from traits.api import HasTraits, Bool, Enum, List, Str
from numpy import array, cos, sin
class ElementalRotationDefinition(HasTraits):
'''
A definition of an elemental rotation and its angle's name
'''
angle_name = Str("undefined angle")
axis = Enum('around_x', 'around_y', 'around_z')
isClock... | 2.890625 | 3 |
w2020/w9/w9_19/sort.py | abrance/mine | 0 | 35762 |
def merge_sort(ls: list):
# 2020/9/19 二路归并排序
length = len(ls)
if length <= 1:
return ls
idx = length // 2
piece1 = ls[:idx]
piece2 = ls[idx:]
piece1 = merge_sort(piece1)
piece2 = merge_sort(piece2)
sorted_ls = []
# 2020/9/19 合并的算法
while len(piece1) != 0 and len(pie... | 3.984375 | 4 |
training.py | oakwood44267/scooter | 4 | 35763 | <reponame>oakwood44267/scooter
#!/usr/bin/python3
import pandas as pd
import numpy as np
from glob import glob
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
from sklearn.metrics import classification_report, confusion_matrix
from tensorflow.keras.models import Sequential
from... | 2.515625 | 3 |
test/test_files/pylops/pytests/test_sliding.py | SoftwareUnderstanding/inspect4py | 2 | 35764 | <reponame>SoftwareUnderstanding/inspect4py<filename>test/test_files/pylops/pytests/test_sliding.py
import pytest
import numpy as np
from numpy.testing import assert_array_almost_equal
from pylops.utils import dottest
from pylops import LinearOperator
from pylops.basicoperators import MatrixMult
from pylops.signalproc... | 2.03125 | 2 |
tests/binding/test_binders_errors.py | jimcarreer/dinao | 1 | 35765 | <gh_stars>1-10
"""Tests various errors that can be thrown by binding."""
from typing import Generator, List, Tuple, Union
from dinao.backend import Connection
from dinao.binding import FunctionBinder
from dinao.binding.binders import BoundedGeneratingQuery
from dinao.binding.errors import (
BadReturnTypeError,
... | 2.46875 | 2 |
gcsa/serializers/base_serializer.py | DirkReiners/Google-Calendar-Simple-API | 0 | 35766 | <filename>gcsa/serializers/base_serializer.py<gh_stars>0
import json
class BaseSerializer:
type_ = None
def __init__(self, obj):
if isinstance(obj, self.type_):
self.data = self.to_json(obj)
elif isinstance(obj, str):
self.data = json.loads(obj)
elif isinstance... | 2.84375 | 3 |
scripts/quest/q30006s.py | G00dBye/YYMS | 54 | 35767 | # [Root Abyss] Guardians of the World Tree
MYSTERIOUS_GIRL = 1064001 # npc Id
sm.removeEscapeButton()
sm.lockInGameUI(True)
sm.setPlayerAsSpeaker()
sm.sendNext("We need to find those baddies if we want to get you out of here.")
sm.setSpeakerID(MYSTERIOUS_GIRL)
sm.sendNext("But... they all left")
sm.setPlayerAsSpeake... | 1.757813 | 2 |
nfbackend/env_vars.py | neuralfoo/neuralfoo | 2 | 35768 | seaweedfs_master = "http://localhost:9333" #do not add slash to end (after port) | 1.03125 | 1 |
test.py | sasha42/c3lingo-stats | 2 | 35769 | #!/usr/bin/env python3
import unittest
from textwrap import dedent
from datetime import timedelta
from parse import parse_block, TranslationShift
class TestTranslationShift(unittest.TestCase):
def test_eq(self):
self.assertEqual(TranslationShift('name', 'lang'), TranslationShift('name', 'lang'))
... | 2.921875 | 3 |
base/shortener/admin.py | elijah74/django-url-shortener | 0 | 35770 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import Shortener
@admin.register(Shortener)
class ShortenerAdmin(admin.ModelAdmin):
list_display = ('id', 'short_url', 'link_url', 'status', 'created')
fields = ('short_url', 'link_url', 'status', '... | 2.03125 | 2 |
terraform/stacks/analytics/cloud_sniper_beaconing_detection/cloud_sniper_beaconing_detection.py | houey/cloud-sniper | 160 | 35771 | import os
import ipaddress
import numpy as np
import pandas as pd
import datetime
import boto3
import gzip
import json
from signal_processing import signalProcess
BUCKET_NAME = os.environ.get("BUCKET_NAME", None)
VPC_FLOW_LOGS_PATH = os.environ.get("VPC_FLOW_LOGS_PATH", None)
FINDINGS_PATH = os.environ.get("FINDINGS_... | 2.296875 | 2 |
examples/KEPLER/Pretrain/convert.py | MichalPitr/KEPLER | 98 | 35772 | import argparse
import json
parser = argparse.ArgumentParser()
parser.add_argument("--text", type=str, help="path to original text file")
parser.add_argument("--train", type=str, help="path to original training data file")
parser.add_argument("--valid", type=str, help="path to original validation data file")
parser.ad... | 3.21875 | 3 |
mabel/data/formats/dictset/group_by.py | mabel-dev/mabel | 0 | 35773 | <reponame>mabel-dev/mabel
from typing import Callable, Iterator
from mabel.data.formats import dictset as ds
class Groups:
__slots__ = "_groups"
def __init__(self, dictset: Iterator, column: str, dedupe: bool = False):
"""
Group By functionality for Iterables of Dictionaries
Paramete... | 3.21875 | 3 |
geonet/region.py | bbengfort/geonet | 1 | 35774 | # geonet.region
# Interface for managing region objects
#
# Author: <NAME> <<EMAIL>>
# Created: Wed Jan 17 06:49:35 2018 -0500
#
# ID: region.py [] <EMAIL> $
"""
Interface for managing region objects
"""
##########################################################################
## Imports
###########################... | 2.015625 | 2 |
src/kdenlive_tools/__main__.py | kdeldycke/kdenlive-tools | 5 | 35775 | <gh_stars>1-10
import cli
cli.cli()
| 1.046875 | 1 |
tests/test_webframe.py | vmiklos/osm-gimmisn | 8 | 35776 | #!/usr/bin/env python3
#
# Copyright (c) 2019 <NAME> and contributors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The test_webframe module covers the webframe module."""
from typing import List
from typing import TYPE_CHECKING
from typing import Tuple
from... | 2.421875 | 2 |
Python Snippets with Documentation/05 Data Structures/11 List Comprehensions.py | AhmedRaja1/Python-Beginner-s-Starter-Kit | 1 | 35777 | <reponame>AhmedRaja1/Python-Beginner-s-Starter-Kit
# 11 List Comprehensions
products = [
("Product1", 15),
("Product2", 50),
("Product3", 5)
]
print(products)
# prices = list(map(lambda item: item[1], products))
# print(prices)
prices = [item[1] for item in products] # With list comprehensions we can ac... | 4.3125 | 4 |
wes_service/util.py | DailyDreaming/dev-workflow-service | 0 | 35778 | <reponame>DailyDreaming/dev-workflow-service<filename>wes_service/util.py
from six import itervalues
def visit(d, op):
"""Recursively call op(d) for all list subelements and dictionary 'values' that d may have."""
op(d)
if isinstance(d, list):
for i in d:
visit(i, op)
elif isinstan... | 2.890625 | 3 |
ss/projectilesystem.py | slode/spaceshooter | 0 | 35779 | from triton.ecs import System
from .events import *
from .components import *
class ProjectileSystem(System):
def initialize(self):
self.on(TickEvent, self.handle_cooldowns)
self.on(TickEvent, self.on_shootevent)
def handle_cooldowns(self, event):
for e, (g,) in self.registry.get_comp... | 2.46875 | 2 |
List/ArrayBaseList.py | alstn2468/Python_Data_Structure | 2 | 35780 | <filename>List/ArrayBaseList.py
# ArrayBaseList.py
# 배열 기반 리스트 클래스
class ArrayBaseList :
def __init__(self) :
self.list = []
self.count = 0
# 배열 기반 리스트 삽입 함수
def add(self, data) :
self.list.append(data)
self.count += 1
# 배열 기반 리스트 탐색 함수
def search(self, data) :
... | 3.71875 | 4 |
gui/examples/hello_0.py | t20100/silx-training | 7 | 35781 | <filename>gui/examples/hello_0.py
from PyQt5.QtWidgets import QApplication, QLabel, QMainWindow
app = QApplication([])
main_window = QMainWindow()
first_widget = QLabel('hello world !!!', parent=main_window)
main_window.setCentralWidget(first_widget)
main_window.show()
app.exec_() | 2.765625 | 3 |
day_09/main.py | 7Rocky/AoC-2021 | 1 | 35782 | from functools import reduce
def bfs(root, points):
queue = [root]
visited_states = {root}
basin_size = 1
while len(queue) > 0:
i, j = queue[0]
queue = queue[1:]
ps = [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]
for n in ps:
if n not in visited_states... | 3.125 | 3 |
kolibri/logger/test/factory_logger.py | aronasorman/kolibri | 0 | 35783 | <filename>kolibri/logger/test/factory_logger.py
import datetime
import factory
import uuid
from kolibri.auth.test.test_api import FacilityUserFactory
from .. import models
class ContentSessionLogFactory(factory.DjangoModelFactory):
class Meta:
model = models.ContentSessionLog
user = factory.SubFact... | 2.046875 | 2 |
lists/urls.py | Tawakalt/todo_list | 0 | 35784 | from django.urls import path
from . import views
urlpatterns = [
path('new', views.new_list, name='new_list'),
path('<list_id>/', views.view_list, name='view_list'),
path('users/<email>/', views.my_lists, name='my_lists'),
] | 1.742188 | 2 |
populate_chijri.py | J471/Telegram-ID_AzanBot | 2 | 35785 | <reponame>J471/Telegram-ID_AzanBot
#!/usr/bin/env python
import logging
from pymongo import MongoClient
from credentials import DBNAME, DBUSER, DBPASS, DBAUTH
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s:%(lineno)d - %(levelname)s - %(message)s',
level=logging.INFO)
logger ... | 2.046875 | 2 |
sources/iam_online.py | X-rayLaser/keras-auto-hwr | 0 | 35786 | <filename>sources/iam_online.py
import os
import random
from xml.etree import ElementTree as ET
import numpy as np
from PIL import Image
from PIL.ImageDraw import ImageDraw
from sources import BaseSource
from sources.preloaded import PreLoadedSource
class OnlineSource(BaseSource):
def __init__(self, data_root):... | 2.390625 | 2 |
mission_control/navigator_missions/navigator_missions/start_gate_marshall.py | MarshallRawson/NaviGator | 0 | 35787 | <reponame>MarshallRawson/NaviGator<filename>mission_control/navigator_missions/navigator_missions/start_gate_marshall.py
#!/usr/bin/env python
from __future__ import division
import txros
import numpy as np
import mil_tools
from mil_misc_tools.text_effects import fprint
from navigator import Navigator
import math
from ... | 2.1875 | 2 |
misc bots/mtg info bot.py | b9king/Discord-Bots | 0 | 35788 |
import discord
import random
from asd import *
from mtgsdk import Card
from mtgsdk import Set
from mtgsdk import Type
from mtgsdk import Supertype
from mtgsdk import Subtype
from mtgsdk import Changelog
client=discord.Client()
@client.event
async def on_ready():
print('logged in as')
print... | 2.328125 | 2 |
docs/webflask/quiz_orm/quiz2_sa/app.py | damiankarol7/python101 | 44 | 35789 | <filename>docs/webflask/quiz_orm/quiz2_sa/app.py
# -*- coding: utf-8 -*-
# quiz-orm/app.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import os
app = Flask(__name__)
# konfiguracja aplikacji
app.config.update(dict(
SECRET_KEY='bardzosekretnawartosc',
DATABASE=os.path.join(app.root_path, ... | 2.046875 | 2 |
web/cache.py | therealplato/vim-awesome | 1,379 | 35790 | <reponame>therealplato/vim-awesome
"""Module to hold the instance of the cache"""
from flask.ext.cache import Cache
cache = Cache()
| 1.5 | 2 |
ontologyExtraction/testOntologyExtractionPerformance.py | mikiec84/linkshop | 6 | 35791 | #!/usr/bin/env python3
import datetime
import json
import loadPath # Adds the project path.
import linkograph.labels as llabels
import linkograph.linkoCreate as llinkoCreate
import ontologyExtraction as oe
import os
import sys
def print_usage():
print("usage:", sys.argv[0], "<JSON commands filename> ...")
def ... | 2.046875 | 2 |
app/v2/template/post_template.py | alphagov/notify-notifications-api | 51 | 35792 | <filename>app/v2/template/post_template.py
from flask import jsonify, request
from app import authenticated_service
from app.dao import templates_dao
from app.schema_validation import validate
from app.v2.errors import BadRequestError
from app.v2.template import v2_template_blueprint
from app.v2.template.template_sche... | 2.40625 | 2 |
mdm_inventory/clients/graphql/query.py | TeamWalls/mdm-backend-django | 0 | 35793 | <gh_stars>0
import graphene
from graphene_django import DjangoObjectType
#models
from mdm_inventory.clients.models import Client
#types
from mdm_inventory.clients.graphql.types import ClientType
class QueryClient(graphene.ObjectType):
clients = graphene.List(ClientType)
def resolve_clients(root, info):
... | 1.914063 | 2 |
bnn_vi/data_sampling.py | Daniil-Selikhanovych/bnn-vi | 3 | 35794 | import torch
from torch.utils.data import Dataset, DataLoader
from torch.distributions.multivariate_normal import MultivariateNormal
import numpy as np
from tqdm import tqdm
import random
def get_rotation(theta):
rad = np.radians(theta)
c, s = np.cos(rad), np.sin(rad)
R = np.array([[c, -s],
... | 2.4375 | 2 |
damgard_jurik/__init__.py | NCGThompson/damgard-jurik | 7 | 35795 | <reponame>NCGThompson/damgard-jurik
#!/usr/bin/env python3
from damgard_jurik.crypto import EncryptedNumber, PrivateKeyRing, PrivateKeyShare, PublicKey, keygen
| 0.917969 | 1 |
src/todo/service/sqlalchemy_todo_service.py | MarkStefanovic/todo-api | 0 | 35796 | import datetime
import typing
from src import core
from src.todo import domain, adapter
__all__ = ("SqlAlchemyTodoService",)
class SqlAlchemyTodoService(domain.TodoService):
def __init__(self, /, uow: core.SqlAlchemyUnitOfWork):
self._uow = uow
def all(self, /, user_id: int) -> typing.List[domain.T... | 2.453125 | 2 |
tests/parties/participants/test_view.py | PartyGwam/api | 1 | 35797 | <gh_stars>1-10
import datetime
from django.test import TestCase
from django.utils import timezone
from rest_framework import status
from rest_framework.test import APIRequestFactory, force_authenticate
from api.parties.participants.views import ParticipantsAPIView
from apps.parties.models import Party
from apps.users.... | 2.328125 | 2 |
setup.py | anthonyvallee/bettejpeg | 1 | 35798 | <reponame>anthonyvallee/bettejpeg<gh_stars>1-10
from setuptools import (find_packages, setup)
from rap import betterjpeg
setup(
name=betterjpeg.__pkgname__,
description=betterjpeg.__description__,
version=betterjpeg.__version__,
packages=["rap.betterjpeg"],
entry_points="""
[cons... | 1.4375 | 1 |
engine/db/org/db_org_parameter.py | datapunk2078/torro_community | 0 | 35799 | <filename>engine/db/org/db_org_parameter.py<gh_stars>0
class orgApiPara:
setOrg_POST_request = {"host": {"type": str, "default": ''},
"port": {"type": int, "default": 636},
"cer_path": {"type": str, "default": ''},
"use_sll": {"type"... | 1.953125 | 2 |