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 |
|---|---|---|---|---|---|---|
bandit/containers/portfolio.py | zmy920423/bandit_portfolio_version | 0 | 48500 | from bandit.containers.container import Container
import torch as torch
from collections import OrderedDict
from bandit.functional import estimator_sample,estimator_ledoit_wolf
class Portfolio(Container):
"""
portfolio class
"""
def __init__(self, container_id=-1, module={"file": "eg", "name": "EG"}, ... | 2.25 | 2 |
python/tblink_rpc_gw/rt/cocotb/__main__.py | tblink-rpc/tblink-rpc-gw | 0 | 48501 | '''
Created on Mar 1, 2022
@author: mballance
'''
import importlib
import sys
from tblink_rpc_core.endpoint import Endpoint
from tblink_rpc_gw.rt.cocotb.mgr import Mgr
def run_cocotb(ep : Endpoint):
# cocotb has a native module for interfacing with the
# simulator. We need to provide our own cocotb 'simula... | 2.421875 | 2 |
exercicios_curso_em_video/Exercicio 46.py | Sposigor/Caminho_do_Python | 1 | 48502 | <filename>exercicios_curso_em_video/Exercicio 46.py
from time import sleep
print('Fogos de artifício vai começar em:')
for i in range(10, -1, -1):
sleep(1)
print(i)
print('BUAAAAAAAAAAAAA') | 2.609375 | 3 |
Jarvis/blink.py | pkopoku/Morse-Pi | 0 | 48503 | <reponame>pkopoku/Morse-Pi
#! /usr/bin/env python
# this script is just to test stuff. You should probably ignore this.
import RPi.GPIO
import time
gpio = RPi.GPIO
gpio.setmode(gpio.BCM) # So I can refer to each pin by it's GPIO number
gpio.setup(2, gpio.OUT)
i = 0
while i < 10:
gpio.output(2, True) #or gpio.HIGH ... | 2.9375 | 3 |
mailtrigger/trigger/trigger.py | craftslab/mailtrigger | 0 | 48504 | # -*- coding: utf-8 -*-
import abc
class TriggerException(Exception):
def __init__(self, info):
super().__init__(self)
self._info = info
def __str__(self):
return self._info
class Trigger(object):
__metaclass__ = abc.ABCMeta
@staticmethod
def help():
return ''
... | 3.0625 | 3 |
src/modules/tcp/ssh.py | The-Cracker-Technology/nullscan | 46 | 48505 | #!/usr/bin/env python3
# -*- coding: utf-8 -*- ########################################################
# ____ _ __ #
# ___ __ __/ / /__ ___ ______ ______(_) /___ __ #
# / _ \/ // / / (_-</ -_) __/ // / __/ / __/ // / ... | 2.125 | 2 |
area/migrations/0004_alter_area_admin_alter_area_hoodimage.py | Lenus254/NeighbourHood-App | 0 | 48506 | <reponame>Lenus254/NeighbourHood-App<filename>area/migrations/0004_alter_area_admin_alter_area_hoodimage.py
# Generated by Django 4.0.3 on 2022-03-22 07:01
import cloudinary.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | 1.484375 | 1 |
exercices/perfect-numbers/perfect_numbers.py | gkaeso/exercism-python | 0 | 48507 | <gh_stars>0
def classify(number):
return _classify(number) if number != 1 else 'deficient'
def _classify(number) -> str:
classif: str
aliquot: int = _aliquot(number)
if aliquot > number:
classif = 'abundant'
elif aliquot < number:
classif = 'deficient'
else:
classif = ... | 3.46875 | 3 |
Lesson8_1/ff.py | shinkai-tester/python_beginner | 2 | 48508 | def f(a):
a += 2
return a
b = 1
b = f(b)
print(b)
| 3.5 | 4 |
system/dynamic_connection_creation.py | airflow-plugins/example_dags | 297 | 48509 | """
Dynamic Connection Creation from a Variable
This file contains one ongoing DAG that executes every 15 minutes.
This DAG makes use of one custom operator:
- CreateConnectionsFromVariable
https://github.com/airflow-plugins/variable_connection_plugin/blob/master/operator/variable_connection_operator.py#L36
... | 2.421875 | 2 |
src/verify.py | RaISy-Net/Intelligent_picking | 1 | 48510 | <gh_stars>1-10
import glob
import os
import matplotlib.pyplot as plt
from src.utils.dataset_processing import grasp, image
from src.utils.data.grasp_data import GraspDatasetBase
def save_img(rgb_img,gtbbs,name):
fig = plt.figure(figsize=(10, 10))
plt.ion()
plt.clf()
ax = plt.subplot(111)
ax.imshow(rgb_img)
g=g... | 2.359375 | 2 |
tests/test_fastapi.py | Asphalt-framework/asphalt-web | 0 | 48511 | from __future__ import annotations
import json
from collections.abc import Callable, Sequence
from typing import Any
import pytest
import websockets
from asgiref.typing import ASGI3Application, HTTPScope, WebSocketScope
from asphalt.core import Component, Context, inject, require_resource, resource
from fastapi impor... | 2.109375 | 2 |
Pre-train/refers/data/__init__.py | funnyzhou/REFERS | 46 | 48512 | <filename>Pre-train/refers/data/__init__.py
from .datasets.captioning import CaptioningDataset
from .datasets.masked_lm import MaskedLmDataset
from .datasets.multilabel import MultiLabelClassificationDataset
from .datasets.downstream import (
ImageNetDataset,
INaturalist2018Dataset,
VOC07ClassificationDatas... | 1.578125 | 2 |
pdf_parser/pdfparser.py | Sanardi/bored | 0 | 48513 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 7 17:56:07 2020
Author: <NAME>"""
import regex as re
import pandas as pd
import time;
from random import randint
import os
import os.path
import errno
from datetime import datetime
from tika import parser
import zipfile
import csv
class PdfParser:
"""A simple pyth... | 3.0625 | 3 |
marker/tests/test_pythagorean_therom/pythagorean_theorem.py | tahamian/autograder | 0 | 48514 | import math
def pythagorean(a, b):
return math.sqrt(a ** 2 + b ** 2)
| 2.9375 | 3 |
alembic/versions/7ddd008bcaaa_add_root_cause_table.py | oulabla/store | 0 | 48515 | """add root_cause table
Revision ID: 7ddd008bcaaa
Revises: <PASSWORD>
Create Date: 2021-11-06 19:20:07.167512
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7ddd008bcaaa'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
... | 1.632813 | 2 |
test/_test_sample_z.py | yiruiliu110/eegnn | 0 | 48516 | <reponame>yiruiliu110/eegnn
import torch
from torch.distributions import Gamma, Dirichlet
from estimation import compute_z
i = [[0, 1, 1, 2],
[2, 0, 2, 1]]
v_graph = [1, 1, 1, 1]
v_c = [0, 1, 1, 0]
graph = torch.sparse_coo_tensor(i, v_graph, (3, 3))
c = torch.sparse_coo_tensor(i, v_c, (3, 3))
max_K = 10
node_nu... | 2.125 | 2 |
cs15211/MirrorReflection.py | JulyKikuAkita/PythonPrac | 1 | 48517 | __source__ = 'https://leetcode.com/problems/mirror-reflection/'
# Time: O(logP)
# Space: O(1)
#
# Description: Leetcode # 858. Mirror Reflection
#
# There is a special square room with mirrors on each of the four walls.
# Except for the southwest corner, there are receptors on each of the remaining corners, numbered 0... | 3.515625 | 4 |
ldt/utils/usaf/bcsd_preproc/forecast_task_05.py | andrewsoong/LISF | 67 | 48518 | #!/usr/bin/env python3
"""
#------------------------------------------------------------------------------
#
# SCRIPT: forecast_task_05.py
#
# PURPOSE: Computes the bias correction for the NMME dataset. Based on
# FORECAST_TASK_03.sh.
#
# REVISION HISTORY:
# 24 Oct 2021: <NAME>, first version
#
#-----------------------... | 2.40625 | 2 |
symjax/data/dclde.py | RandallBalestriero/TheanoXLA | 67 | 48519 | import io
import os
import time
import urllib.request
import zipfile
import numpy as np
from scipy.io.wavfile import read as wav_read
from tqdm import tqdm
class dclde:
"""
The high-frequency dataset consists of marked encounters with echolocation
clicks of species commonly found along the US Atlantic Co... | 2.828125 | 3 |
Snippets and Basic Functions/Cryptography/ecdsa-ops.py | sckulkarni246/python-snippets-for-embedded-programmers | 0 | 48520 | import ecdsa
import hashlib
sk = ecdsa.SigningKey.generate(curve=ecdsa.NIST256p)
vk = sk.get_verifying_key()
a = b"Hello World!"
sig = sk.sign(a,hashfunc=hashlib.sha256)
result = vk.verify(sig,a,hashfunc=hashlib.sha256)
strsk = sk.to_string()
strvk = vk.to_string()
sk2 = ecdsa.SigningKey.from_string(strsk,curve=ec... | 2.578125 | 3 |
main.py | angmont/PIA_PC | 1 | 48521 | import subprocess
import cifrado
import enviocorreos
import puertos
import metadata
import webscraping
import argparse
import os, time
import logging
logging.basicConfig(filename='app.log', level=logging.INFO)
if __name__ == "__main__":
description= ("Este script realiza una gran diversa cantidad de tareas " +
"... | 2.546875 | 3 |
server/routes/status.py | narengan/Prometeo-Web-App | 1 | 48522 | #import requests
import json
import os
import mariadb
import logging
from dotenv import load_dotenv
class status(object):
def __init__(self):
load_dotenv()
self.logger = logging.getLogger('prometeo.status.status_webapp')
self.logger.debug('creating an instance of status')
def get_all... | 2.40625 | 2 |
features.py | Amirktb1994/infamous-werewolves | 0 | 48523 | <filename>features.py
import numpy as np
import pandas as pd
def preprocess(df):
df.rename(columns = {'Load [MWh]':'load', 'Time [s]':'time', 'City':'city'}, inplace = True)
df.time = pd.to_datetime(df.time)
return df
def encode(df, col, max_val):
df[col + '_sin'] = np.sin(2 * np.pi * df[col]/ma... | 3.09375 | 3 |
BancoDeDados_Local.py | gpenello/ControleDeUso | 0 | 48524 | import sqlite3
from sqlite3 import Error
import datetime
import csv
import urllib.request as urllib2
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
class BancoDeDados():
def __init__(self, arquivo):
try:
os.makedirs(os.path.join(dir_path, 'log'))
... | 3.34375 | 3 |
module4-software-testing-documentation-and-licensing/yeetroot.py | rselent/DS-Unit-3-Sprint-1-Software-Engineering | 0 | 48525 | """
Simple yeetroot example
"""
def yeetRoot():
num = int( input( "which number would you like the square root of? "))
# return print( "the square root of {} is: {:.5f}".format( num, num**.5) )
return num**.5 | 4.0625 | 4 |
scenarios/SambaShare/config.py | dasec/ForTrace | 1 | 48526 |
imagename = "smbScenario"
author = "<NAME>"
hostplatform = "windows"
poolpath = "/home/wurstfingersalat/Downloads/fortracepool/"
smbname = "smbServer"
smbplatform = "unix"
sourcePath = "C:\Users\fortrace\Desktop\TestFile.txt"
targetPath = r"\\192.168.103.102\public"
username = "bla"
password = "<PASSWORD>"
| 1.195313 | 1 |
config.py | caly-pso/disease_explorer_app | 2 | 48527 | db = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv"
# database file downloaded from
# https://www.weather.gov/source/gis/Shapefiles/County/c_03mr20.zip
# to get the lat and long values for US counties
dbf = "./c_03mr20.dbf"
| 1.359375 | 1 |
CronJob.py | scimone/Notion_Sync | 0 | 48528 | from apscheduler.schedulers.blocking import BlockingScheduler
from Todoist import TodoIstAPI
from Notion import NotionAPI
from Gcal import GCalAPI
import json
import os
from Main import run_sync
def create_notion_api():
notion_config = json.loads(os.environ['notion_config'])
notion = NotionAPI(os.environ['tz'... | 2.3125 | 2 |
pyjswidgets/pyjamas/ui/DropWidget.py | takipsizad/pyjs | 739 | 48529 | # Copyright (C) 2010 <NAME>
#
# 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, s... | 2.28125 | 2 |
okr/migrations/0045_auto_20210114_1812.py | wdr-data/wdr-okr | 2 | 48530 | <reponame>wdr-data/wdr-okr
# Generated by Django 3.1.5 on 2021-01-14 17:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("okr", "0044_auto_20210113_2354"),
]
operations = [
migrations.AlterField(
model_name="sophoraid",
... | 1.460938 | 1 |
kivy-greeter.py | jegger/kivy-lightdm-greeter | 4 | 48531 | import sys
from kivy.app import App
from kivy.support import install_gobject_iteration
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.config import Config
from gi.repository import LightDM
kv = '''
FloatLayout:
username_spinner: username_spinner
session_spinner: session_spinner
... | 2.328125 | 2 |
alipay/aop/api/response/AlipayPayAppSmartwearStatusQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 48532 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayPayAppSmartwearStatusQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayPayAppSmartwearStatusQueryResponse, self).__init__()
self... | 1.992188 | 2 |
SAM.py | Tks4Fish/SAM | 0 | 48533 | <reponame>Tks4Fish/SAM
import requests
import sqlite3
import json
import re
from requests_oauthlib import OAuth1
from sopel import module
SAM_DB = "/home/ubuntu/.sopel/modules/SAM.db"
CONTACT_OP = "You are not configured. Please contact Operator873."
def addtomemory(user, payload):
result = {}
db ... | 2.390625 | 2 |
tests/cli_snippets/test_cli_versioning.py | shalevy1/DataFS | 7 | 48534 |
import pytest
import os
@pytest.mark.examples
@pytest.mark.cli_snippets
def test_cli_versioning_snippets(cli_validator):
cli_validator(r'''
.. EXAMPLE-BLOCK-1-START
.. code-block:: bash
$ datafs create my_archive \
> --my_metadata_field 'useful metadata'
created versioned archive <DataArchive l... | 1.992188 | 2 |
saleor/graphql/payment/tests/queries/test_payments_filter.py | victor-abz/saleor | 1,392 | 48535 | <reponame>victor-abz/saleor
import graphene
from .....payment.models import Payment
from ....tests.utils import get_graphql_content
PAYMENT_QUERY = """ query Payments($filter: PaymentFilterInput){
payments(first: 20, filter: $filter) {
edges {
node {
id
gateway
... | 2.203125 | 2 |
src/commands/posts/kernel.py | MineHubCZ/MH-DOS | 2 | 48536 | <reponame>MineHubCZ/MH-DOS
from commands.posts.show import show
from commands.posts.all import all
def posts(arguments):
if not arguments:
all()
return
if int(arguments[0]):
show(arguments[0])
| 2.171875 | 2 |
tests/test_features.py | resuelve/silk-ml | 6 | 48537 | import unittest
import pandas as pd
import random as rd
from silk_ml.features import split_classes
class TestFeatures(unittest.TestCase):
def test_split(self):
x = {
'label1': [rd.random() + 5 for _ in range(100)],
'label2': [rd.random() * 3 - 1 for _ in range(100)],
... | 3.0625 | 3 |
generateFunctions.py | yudasong/Reinforcement-Learning-Branch-and-Bound | 14 | 48538 | #This file will generate functions in polynomials
import numpy as np
import random
import matplotlib.pyplot as plt
class generateFunctions():
#the initial function taking 4 inputs
def __init__(self, x_vector, high_degree_vector, rangeLow, rangeHigh):
#the input processing
self.x_vector = x_vector
self.hi... | 3.59375 | 4 |
corehq/apps/locations/tests/test_location_import.py | SEL-Columbia/commcare-hq | 1 | 48539 | from corehq.apps.commtrack.helpers import make_supply_point
from corehq.apps.commtrack.tests.util import CommTrackTest, make_loc
from corehq.apps.commtrack.const import DAYS_IN_MONTH
from corehq.apps.locations.models import Location
from corehq.apps.locations.bulk import import_location
from mock import patch
from core... | 2.0625 | 2 |
tests/domain/test_Track_remove_devices.py | josiah-wolf-oberholtzer/tloen | 3 | 48540 | import asyncio
import pytest
from supriya.synthdefs import SynthDefFactory
from tloen.domain import Application, AudioEffect
@pytest.fixture
def synthdef_factory():
return (
SynthDefFactory()
.with_channel_count(2)
.with_input()
.with_signal_block(lambda builder, source, state: (... | 2.21875 | 2 |
split_exon_realign_jobs.py | hillerlab/TOGA | 32 | 48541 | #!/usr/bin/env python3
"""Create CESAR joblist.
According to predicted orthologous chains create CESAR jobs.
Merge them into joblists.
"""
import argparse
import os
import sys
import math
from collections import defaultdict
from datetime import datetime as dt
from re import finditer, IGNORECASE
import ctypes
from twob... | 2.03125 | 2 |
portfolio_project/guestbook/models.py | KimEunYeol/web-portfolio | 0 | 48542 | from django.db import models
from django.utils import timezone
from user.models import User
class GuestBook(models.Model):
username = models.ForeignKey(User, models.DO_NOTHING, verbose_name='username')
title = models.CharField(verbose_name='Title', max_length=64, blank=False)
content = models.TextField(verbose_nam... | 2.296875 | 2 |
bin/exemple_with_processors.py | xgodon/ssxtd | 1 | 48543 | import gzip
import zlib
import io
from ssxtd import parsers
import time
my_file = io.StringIO('''<doc farm = "456">
<i species = "lapin" sex = "male" >John</i>
<i species = "chien"><sub subspec = "Kooikerhondje">Tristan</sub></i>
<i species = "cheval">
<count>1.1</count>
</i>
<i>
<mo... | 2.953125 | 3 |
src/cheesyutils/discord_bots/paginator.py | e-Lisae/cheesyutils | 0 | 48544 | import discord
from discord.ext import commands
from typing import Any, Iterator, List, NoReturn, Optional, Sequence
class Paginator:
def __init__(self):
self.pages: List[discord.Embed] = []
def insert_page_at(self, index: int, page: discord.Embed):
"""Inserts a new page at a particular posit... | 3.109375 | 3 |
22. Workshop - Custom List/tests/tests_case_base.py | elenaborisova/Python-OOP | 1 | 48545 | <reponame>elenaborisova/Python-OOP<gh_stars>1-10
from unittest import TestCase
class TestCaseBase(TestCase):
def assertEmpty(self, iterable):
if type(iterable) == dict:
return self.assertDictEqual({}, dict(iterable))
elif type(iterable) == set:
return self.assertSetEqual(se... | 3.578125 | 4 |
examples/Town_v2/test1.py | hxb1997/Menge | 0 | 48546 | <filename>examples/Town_v2/test1.py
import sys
import numpy as np
import os
if __name__ == '__main__':
'''
agent_shopping_moment = []
for i in range(0, 10):
agent_shopping_moment.append([])
for j in range(0, 2):
agent_shopping_moment[i].append([])
#agent_shopping_... | 2.703125 | 3 |
caid-gui/geometry.py | ratnania/caid | 4 | 48547 | <filename>caid-gui/geometry.py
# -*- coding: UTF-8 -*-
from caid.cad_geometry import cad_geometry
from evaluator import CurveEvaluator, SurfaceEvaluator, VolumeEvaluator
from numpy import array, asarray
from OpenGL.GL import *
from theme import theme as Theme
from global_vars import strtoArray
theme = Theme()
ALPHA ... | 2.03125 | 2 |
guess.py | emacslisp/pythonlib | 0 | 48548 | <filename>guess.py
from random import randint
def guess():
target = randint(0,100)
while True:
num = int(input('guess a number between 0 100:\n'))
if num == target:
print('you guess right number {}'.format(target))
return
elif num < target:
print(f'{n... | 4.21875 | 4 |
tensorflow/linear regression.py | hongjun7/Python | 0 | 48549 | import tensorflow as tf
#initialize data
X = [2, 5, 7]
Y = [3, 4, 6]
W = tf.Variable(tf.random_normal([1]), name='weight')
b = tf.Variable(tf.random_normal([1]), name='bias')
#hypothesis H = WX+b
H = W * X + b
#cost/loss function
cost = tf.reduce_mean(tf.square(H - Y))
#minimize
optimizer = tf.trai... | 3.203125 | 3 |
realtime_plot_window.py | krogk/Webcam-morse-decoder | 0 | 48550 | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 15 17:22:01 2020
@author: Kamil
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import morse_decoder
import iir_filter
class RealtimeWindow:
def __init__(self, channel: str):
# create a plot window
se... | 3 | 3 |
library/gcloud_accessor/rest_library/shared/gcloud_rest_lib_base.py | anchitarnav/gcloud-resource-cleanup | 0 | 48551 | from library.utilities.misc import parse_link, get_resource_type
from library.utilities.logger import get_logger
from google.auth.transport.requests import AuthorizedSession
from google.auth import default
from requests import codes, exceptions
import time
import re
from json import JSONDecodeError
class GcloudRestL... | 2.453125 | 2 |
ObjectWrapper/GlyphsApp/UI/HTMLView.py | Mark2Mark/GlyphsSDK | 58 | 48552 | <filename>ObjectWrapper/GlyphsApp/UI/HTMLView.py
# -*- coding: utf-8 -*-
from __future__ import print_function
__all__ = ["HTMLView"]
from WebKit import WebView
from vanilla.vanillaBase import VanillaBaseObject
class HTMLView(VanillaBaseObject):
"""
A view that allows for showing HTML
from vanilla import *
fr... | 2.84375 | 3 |
scripts/build_stubs.py | alflanagan/vscode-circuitpython | 62 | 48553 | #!/usr/bin/env python3
# This is a script for using circuitpython's repo to make pyi files for each board type.
# These need to be bundled with the extension, which means that adding new boards is still
# a new release of the extension.
# import mypy
import json
import pathlib
import re
def main():
repo_root = p... | 2.5625 | 3 |
ts_charting/span.py | csullivan/ts-charting | 32 | 48554 | <reponame>csullivan/ts-charting<filename>ts_charting/span.py
"""
Span highlighting
"""
import ts_charting as charting
def highlight_span(start=None, end=None, color='g', alpha=0.5, grapher=None):
"""
A quick shortcut way to highlight regions of a chart. Uses the Grapher.df.index
to translate non int-positi... | 2.921875 | 3 |
benchmarks/geometry/align.py | martimunicoy/offpele-benchmarks | 0 | 48555 | """
It takes to peleffy's molecule representations, aligns them and calculates
the RMSD using RDKit.
"""
from multiprocessing import Pool
from copy import deepcopy
from rdkit.Chem import AllChem
from rdkit import Chem
class Aligner(object):
"""
It aligns two molecule representations as much as possible and... | 3.15625 | 3 |
source_code/data_structures/linked_list.py | itsjunqing/fit1008-introduction-to-computer-science | 7 | 48556 | from data_structures.node import Node
class LinkedList:
def __init__(self):
self.head = None
self.list_size = 0
def is_empty(self):
return self.list_size == 0
def is_full(self):
return False
def __len__(self):
return self.list_size
def size(self):
return self.list_size
def _get_node(self, index... | 4 | 4 |
edsnlp/pipelines/factories.py | aphp/edsnlp | 32 | 48557 | <gh_stars>10-100
# flake8: noqa: F811
from .core.advanced.factory import create_component as advanced
from .core.context.factory import create_component as context
from .core.endlines.factory import create_component as endlines
from .core.matcher.factory import create_component as matcher
from .core.normalizer.accents.... | 1.34375 | 1 |
neuraldistributions/utility/__init__.py | mohammadbashiri/bashiri-et-al-2021 | 2 | 48558 | from .reproducibility import set_random_seed
from .training import EarlyStopping
from .dataset import get_dataloader, imread
from .model_evaluation import (
get_conditional_means,
get_conditional_variances,
spearman_corr,
)
from .scoring_functions import (
Correlation,
get_loglikelihood,
) | 1.351563 | 1 |
Web/Member/FunctionForPI/RoundAdd.py | tratitude/BridgeMaster | 1 | 48559 | <reponame>tratitude/BridgeMaster
import time
import json
import requests
def AddRound(T_id,bid,leader,contract,N,E,W,S,vulnerable,result,declarer,Rnum,score):
Round = {
'T_id':T_id,
'bid':bid,
'leader':leader,
'contract':contract,
'N':N,
'E':E,
'W':W,
... | 2.359375 | 2 |
tests/test_ultimate_tic_tac_toe.py | farshiana/monte-carlo-tree-search | 0 | 48560 | <filename>tests/test_ultimate_tic_tac_toe.py
import unittest
from src.ultimate_tic_tac_toe import UltimateTicTacToe, BOARD_CELLS
from src.utils import PLAYER_ONE, PLAYER_TWO
class TestUltimateTicTacToe(unittest.TestCase):
def test_get_moves(self):
game = UltimateTicTacToe()
indexes = range(BOARD_CE... | 3.125 | 3 |
skp_edu_docker/code/master/services/service_manager.py | TensorMSA/hoyai_docker | 8 | 48561 | class ServiceManager() :
"""
1. definition
2. table
"""
def get_view_obj(self):
"""
get view data for net config
:return:
"""
pass
def set_view_obj(self, obj):
"""
set net config data edited on view
:param obj:
:return:
... | 2.25 | 2 |
bazel/toolchain/cpp_toolchain.bzl | BeeswaxIO/nectar | 1 | 48562 | load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"action_config",
"feature",
"flag_group",
"flag_set",
"tool",
"tool_path",
"with_feature_set",
)
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
def _impl(ctx):
if (ctx.attr.cpu == "k8" and ctx.a... | 1.515625 | 2 |
vasp/format/old2new-xyz.py | hsulab/DailyScripts | 2 | 48563 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import numpy as np
MAXLINE = 10000
MAXFRAME = 10000
def read_xyz(xyz,natoms):
#
fopen = open(xyz,'r')
frames = []
for i in range(MAXLINE):
line = fopen.readline()
if line.strip():
assert int(line.strip().split()[0... | 2.625 | 3 |
mapElites/createMap.py | Sascha0912/SAIL | 2 | 48564 | <gh_stars>1-10
import numpy as np
import numpy.matlib
import pandas as pd
import sys
from pprint import pprint
def createMap(featureResolution, genomeLength, featureMin, featureMax, *args):
class Map:
def __init__(self):
self.edges = []
self.fitness = None
self.genes = N... | 2.6875 | 3 |
analyse_Z_data/Train_ASR/asr_train_analysis.py | mgarnerin/mathesis_genderbias | 0 | 48565 | import os
def get_path(path):
return os.path.split(path)[0]
def get_filename(path):
return os.path.splitext(os.path.basename(path))[0]
def extract_turns(input):
"""
Génère automatiquement un fichier contenant le nombre de tours par locuteur à partir du fichier de tours
:param input:
:retu... | 3.25 | 3 |
src/updater_thread.py | antze-k/gw2-addon-updater | 0 | 48566 | # (C) <EMAIL> released under the MIT license (see LICENSE)
import os
import requests
import threading
import time
import sys
import win32con
import win32gui
import common
def threaded_function(thread_data, thread_static, env, addons, hWnd, log):
while not thread_data.stop:
time.sleep(0.01)
will_update_ca_b... | 2.046875 | 2 |
project/tests/test_templatetags.py | erayerdin/django-persistent-settings | 2 | 48567 | import pytest
@pytest.mark.describe("`var` tag")
class TestGetVarTag:
tag_name = "var"
@pytest.mark.it("Only with variable name")
def test_only_var_name(self, template_factory, context_factory, variable_factory):
variable_factory(5, "V_INT")
t_int = template_factory("V_INT", tag_name=self... | 2.640625 | 3 |
server.py | Parzival129/SockChat | 1 | 48568 | <filename>server.py
import socket
import threading
import random
import time
from rich.console import Console
console = Console()
hostname = socket.gethostname()
print ("")
print(" _____ ")
print(" / ____| ")
print(" | (___ ___ _ ____ _____ _ __ ")
p... | 3.359375 | 3 |
trade/admin.py | dc74089/oneshirt | 0 | 48569 | from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(OneshirtUser)
admin.site.register(Item)
admin.site.register(Trade)
admin.site.register(PasswordResetRequest)
| 1.40625 | 1 |
nvidia-dla-blocks/hw/verif/regression/testplans/nvdla_test_list_L10.py | minisparrow/freedom | 0 | 48570 | for i in range(plan_arguments['RUN_NUM']):
############################################# CC #############################################
add_test(name='cc_feature_rtest',
tags=['L10', 'cc'],
args=[' -rtlarg +uvm_set_config_int=uvm_test_top,layers,%d ' % plan_arguments['LAYER_NUM'], ge... | 1.8125 | 2 |
avod/core/bev_generators/bev_slices.py | Fredrik00/avod | 14 | 48571 | <reponame>Fredrik00/avod
import numpy as np
from wavedata.tools.core.voxel_grid_2d import VoxelGrid2D
from avod.core.bev_generators import bev_generator
class BevSlices(bev_generator.BevGenerator):
NORM_VALUES = {
'lidar': np.log(16),
'distance': 1
}
def __init__(self, config, kitti_ut... | 2.625 | 3 |
nodefinder/search/result/__init__.py | zx-sdu/NodeFinder | 2 | 48572 | # -*- coding: utf-8 -*-
# © 2017-2019, ETH Zurich, Institut für Theoretische Physik
# Author: <NAME> <<EMAIL>>
"""
Submodule defining the result classes of the search step.
"""
from ._minimization import *
from ._search_result_container import *
from ._controller_state import *
__all__ = _minimization.__all__ + _sea... | 1.429688 | 1 |
sabueso/_private_tools/molecular_system/guess_form.py | dprada/sabueso | 0 | 48573 | from sabueso.tools.string_pdb_text import is_pdb_text
from sabueso.tools.string_pdb_id import is_pdb_id
from sabueso.tools.string_uniprot_id import is_uniprot_id
def guess_form(string):
output = None
if is_pdb_text(string):
output = 'string:pdb_text'
elif is_pdb_id(string):
output = 'stri... | 2.4375 | 2 |
web-app/app/main/modules.py | sandbernar/anti-corona-crm | 0 | 48574 | <reponame>sandbernar/anti-corona-crm
from flask import request
import math
from wtforms import SelectField
from wtforms.validators import DataRequired
from flask_wtf import FlaskForm
class TableModule:
class WrongPageError(Exception):
pass
class WrongSortingParameterError(Exception):
pass
... | 2.34375 | 2 |
apps/gui/tests/basics.py | devtank-ltd/devtank-dtlib | 0 | 48575 | '''Example test script.
Basic checks of device before processed
Input Variables:
args - arguments dictionary given to demo tester that may be used to
changed nature of test.
dev - Example device under test
name - Name of test being run.
results - Results map of all tests.
Test Specifi... | 2.53125 | 3 |
exprail/parser.py | piller-imre/exprail-python | 0 | 48576 | """
Parser class definition
"""
from exprail.node import NodeType
from exprail import router
from exprail.state import State
class Parser(object):
"""The base class for other parsers"""
def __init__(self, grammar, source):
"""
Initialize the parser.
:param grammar: a grammar object
... | 3.296875 | 3 |
unmasked_viral/wrapper.py | avilab/vs-wrappers | 1 | 48577 | from Bio import SeqIO
import pandas as pd
def subset_unmasked_csv(blast_csv, unmasked_fasta, output):
# blast hits
hits = pd.read_csv(blast_csv)
# keep query id until first whitespace
queryid_with_hits = hits["query"].str.extract("(^[^\\s]+)", expand=False)
# convert to list
queryid_with_hits ... | 2.859375 | 3 |
alipay/aop/api/domain/MemberCardOperator.py | Anning01/alipay-sdk-python-all | 213 | 48578 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MemberCardOperator(object):
def __init__(self):
self._op_id = None
self._op_type = None
@property
def op_id(self):
return self._op_id
@op_id.setter
def o... | 2.09375 | 2 |
Platforms/Web/Processing/Api/Discord/errors.py | HeapUnderfl0w/Phaazebot | 0 | 48579 | from typing import TYPE_CHECKING
if TYPE_CHECKING:
from Platforms.Web.index import WebIndex
import json
from aiohttp.web import Response, Request
async def apiDiscordGuildUnknown(cls:"WebIndex", WebRequest:Request, **kwargs:dict) -> Response:
"""
Takes from kwargs:
msg:str
guild_id:str
guild_name:str
""... | 2.484375 | 2 |
tripsSplice.py | JackCurragh/SC2-Portal | 0 | 48580 | import sqlite3
import matplotlib as mpl
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import networkx as nx
from sqlitedict import SqliteDict
gene = "phpt1"
transcript = "ENST00000463215"
sqlite_path_organism = "homo_sapiens.v2.sqlite"
sqlite_path_reads = ["SRR2433794.sqlite"]
def get_gene_i... | 3.28125 | 3 |
Py exercises/My code/CSS exercises/03_01alternate.py | arvindkarir/python-pandas-code | 0 | 48581 | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 4 20:13:02 2018
@author: User
"""
def checkit(s1, s2):
for i in s1:
for j in s2:
if i == j:
s1 = s1[1:]
s2 = s2[1:]
print(i,j, s1, s2)
if len(s1) >=1 and len(s2) ==0:
... | 3.65625 | 4 |
src/layouts/overlay/glade/overlay.py | webpedrovinicius/gui-python-gtk | 1 | 48582 | <reponame>webpedrovinicius/gui-python-gtk<filename>src/layouts/overlay/glade/overlay.py
# -*- coding: utf-8 -*-
"""Contêiner do tipo Overlay Layout"""
import gi
gi.require_version(namespace='Gtk', version='3.0')
from gi.repository import Gtk
class Handler:
def __init__(self):
overlay = builder.get_obje... | 2.609375 | 3 |
test/conftest.py | dmillington/lunchroulette | 1 | 48583 | import pytest
from lunchroulette.app import app as _app
from lunchroulette.app import db as _db
from sqlalchemy import event
from sqlalchemy.orm import sessionmaker
@pytest.fixture(scope="session")
def app(request):
return _app
@pytest.fixture(scope="function")
def db(app, request):
with app.app_context():
... | 2.09375 | 2 |
src/pages/db/__init__.py | kryvokhyzha/bert-for-ukranian-ner | 0 | 48584 | <filename>src/pages/db/__init__.py
from pages.db.db import db_clean, db_creation, db_insert, db_select
| 1.367188 | 1 |
Pipeline/Fitting.py | riccardomarin/FARM-ZOSR | 2 | 48585 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 26 13:47:15 2018
%%%%%
% Code for article:
% <NAME>. and <NAME>. and <NAME>. and <NAME>., High-Resolution Augmentation for Automatic Template-Based Matching of Human Models, 3DV 2019
% Github: https://github.com/riccardomarin/FARM-ZOSR
%%%%%
"""
imp... | 2.15625 | 2 |
cf2kv.py | kodecharlie/cf2kv | 0 | 48586 | import argparse
import configparser
import json
import logging.config
import time
import urllib.parse
import urllib.request
import yaml
######################################################################################################
# Parse command line.
##########################################################... | 2.21875 | 2 |
jamjar/parsers/_dc.py | phmc/jamjar | 0 | 48587 | # ------------------------------------------------------------------------------
# _dc.py
#
# Parser for the jam 'c' debug flag output - which contains the names of files
# that cause rebuilds - ie new sources, missing targets
#
# November 2015, <NAME>
# -----------------------------------------------------------------... | 2.34375 | 2 |
utils/xmlrpc.py | NullReferenceError/rtorrent_orphan_cleanup | 27 | 48588 | import socket
import xmlrpc.client
""" referemce: https://stackoverflow.com/a/14397619 """
class ServerProxy:
def __init__(self, url, timeout=10):
self.__url = url
self.__timeout = timeout
self.__prevDefaultTimeout = None
def __enter__(self):
try:
if self.__timeou... | 3.203125 | 3 |
Fcos_seg/detector/fcos_post.py | ricky40403/Fcos_seg | 0 | 48589 | import torch
from torchvision import ops
from Fcos_seg.utils.box_list import BoxList
from Fcos_seg.utils.boxlist_ops import cat_boxlist
from Fcos_seg.utils.boxlist_ops import boxlist_ml_nms
from Fcos_seg.utils.boxlist_ops import remove_small_boxes
class FcosPost(torch.nn.Module):
def __init__(self, cfg):
... | 2.046875 | 2 |
pmedapp/common/utilities.py | ibadkureshi/tnk-locationallocation | 1 | 48590 | <gh_stars>1-10
from pandas.api.types import is_numeric_dtype
from celery.result import AsyncResult
import json
#import redis
from django.http import HttpResponseBadRequest, HttpResponse
import mimetypes
def column_numeric(column):
"""
Ensure that the dataframe has only numeric values
"""
# numeric onl... | 2.859375 | 3 |
nic/evaluation.py | StiliyanDr/neural-image-caption | 0 | 48591 | from tqdm import tqdm
from nic import (
captioning as cptn,
datapreparation as dp,
metrics as mcs,
)
from nic.datapreparation import utils
def bleu_score_of(model,
*,
is_decoder_only=True,
path_to_data,
batch_size=32,
... | 2.46875 | 2 |
gitlabenv2csv/__main__.py | zales/gitlabenv2csv | 1 | 48592 | <reponame>zales/gitlabenv2csv
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
gitlabenv2csv GitLab ENV downloader/uploader.
"""
import sys
from datetime import datetime
import re
import os
import logging
import gitlab
import configargparse
import pandas as pd
from pandas_schema.validation import CustomElementValid... | 2.4375 | 2 |
common/utils/file.py | BruceWW/flask-basic | 1 | 48593 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/13 13:58
# @Author : <NAME>
# @Site :
# @File : file
# @Software: PyCharm
from os import path
from application import app
from common.utils.format_time import stamp_to_date
class File(object):
@staticmethod
def get_upload_file_path():
... | 2.359375 | 2 |
json_conf.py | luhouxiang/UnitTestServer | 0 | 48594 | <reponame>luhouxiang/UnitTestServer
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
json配置文件类,调用方法
data_dict = {"a":"1", "b":"2"}
JsonConf.set(data_dict)
即可在当前目录下生成json文件:config.json
'''
import json
import os
class JsonConf:
"""
json配置文件类
"""
json_data = {}
@staticmethod
... | 2.75 | 3 |
test/units/utils/amazon_placebo_fixtures.py | Container-Projects/ansible-provider-docs | 37 | 48595 | <gh_stars>10-100
import errno
import os
import time
import mock
import pytest
boto3 = pytest.importorskip("boto3")
botocore = pytest.importorskip("botocore")
placebo = pytest.importorskip("placebo")
"""
Using Placebo to test modules using boto3:
This is an example test, using the placeboify fixture to test that a mo... | 2.484375 | 2 |
tests/catalyst/metrics/test_segmentation.py | tadejsv/catalyst | 2,693 | 48596 | <gh_stars>1000+
# flake8: noqa
from typing import Dict, List, Union
import pytest
import torch
from catalyst.metrics import DiceMetric, IOUMetric, TrevskyMetric
base_outputs = torch.tensor([[0.8, 0.1, 0], [0, 0.4, 0.3], [0, 0, 1]])
base_targets = torch.tensor([[1.0, 0, 0], [0, 1, 0], [1, 1, 0]])
base_outputs = torc... | 1.9375 | 2 |
noise.py | basp/notes | 1 | 48597 | <filename>noise.py<gh_stars>1-10
def init(seed = 0):
pass | 0.957031 | 1 |
led_blink.py | combatwombat16/piplay | 0 | 48598 | import RPi.GPIO as GPIO
import time
import socket
def init():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)
GPIO.setup(11,GPIO.OUT)
GPIO.setup(13,GPIO.OUT)
GPIO.setup(29,GPIO.OUT)
GPIO.setup(31,GPIO.OUT)
GPIO.setup(33,GPIO.OUT)
GPIO.setup(12,GPIO.IN,pull_up_down=GPIO.PUD_UP)
def star... | 2.84375 | 3 |
main.py | 1blackghost/Fall_Management | 2 | 48599 | <filename>main.py
from flask import *
app=Flask(__name__)
app.config['SECRET_KEY']="thisisasecretkey"
@app.route("/logout")
def logout():
if 'user' in session and 'role' in session:
session.pop('user',None)
session.pop('role',None)
return redirect(url_for('home'))
@app.route('/home',methods=['GET','POST'])
de... | 2.984375 | 3 |