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 |
|---|---|---|---|---|---|---|
setup.py | jowanpittevils/Databasemanager_Signalplotter | 0 | 12781951 | <gh_stars>0
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="signalplotterV2", # Replace with your own username
version="0.0.1",
author="<NAME>; <NAME>",
author_email="<EMAIL>",
description="A package for exploring data... | 1.507813 | 2 |
SecureWitness/accounts/admin.py | vivianbuan/cs3240-s15-team20 | 0 | 12781952 | from django.contrib import admin
from accounts.models import UserGroup, UserProfile
# Register your models here.
class UserAdmin(admin.ModelAdmin):
pass
class GroupAdmin(admin.ModelAdmin):
pass
admin.site.register(UserProfile, UserAdmin)
admin.site.register(UserGroup, GroupAdmin) | 1.695313 | 2 |
A1/python_scripts/draw_scripts.py | ankurshaswat/COL819 | 0 | 12781953 | <reponame>ankurshaswat/COL819
import os
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
CHORD_LOGS_PATH = '../chord/logs/'
PASTRY_LOGS_PATH = '../pastry/logs/'
def read(path):
lis = []
with open(path, 'r') as file:
lines = file.readlines()... | 2.4375 | 2 |
hydrachain/examples/native/fungible/test_fungible_contract.py | bts/hydrachain | 406 | 12781954 | from ethereum import tester
import hydrachain.native_contracts as nc
from fungible_contract import Fungible, Transfer, Approval
import ethereum.slogging as slogging
log = slogging.get_logger('test.fungible')
def test_fungible_instance():
state = tester.state()
creator_address = tester.a0
creator_key = tes... | 2.1875 | 2 |
CrittersProto/generator/fileout_test.py | nickjbenson/Kami | 1 | 12781955 | # fileout_test.py
fi = | 0.929688 | 1 |
videoTOvideo_language.py | MuskanM1/Ingenious_hackathon_Enigma | 2 | 12781956 | <gh_stars>1-10
# Video to Audio
"""
import moviepy.editor as mp
clip = mp.VideoFileClip("/content/drive/My Drive/Hackathon_2020_Enigma/Video.mp4")
clip.audio.write_audiofile("/content/drive/My Drive/Hackathon_2020_Enigma/Video.wav")
'''
# convert mp4 to mp3
audio = AudioSegment.from_file("/content/drive/My Drive/Ha... | 3.015625 | 3 |
UpdateAllRepositories.py | alencodes/SVN_Repo_Update | 0 | 12781957 | import os
import subprocess
import time
import logging
from re import sub
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-p", "--path", dest="root_path",
help="set root path to start search", metavar="PATH")
(options, args) = parser.parse_args()
root_path = options.roo... | 2.453125 | 2 |
tests/plugins/test_kubejobs.py | ufcg-lsd/asperathos-integration-tests | 1 | 12781958 | import requests
import pytest
import subprocess
from datetime import datetime
from helpers import wait_for_grafana_url_generation, create_job
from helpers import stop_job, MANAGER_URL, VISUALIZER_URL, get_jobs, delete_job
from helpers import restart_container, wait_for_job_complete
from helpers.fixtures import job_pay... | 2.1875 | 2 |
repos/system_upgrade/el7toel8/actors/addupgradebootentry/libraries/library.py | brammittendorff/leapp-repository | 0 | 12781959 | <reponame>brammittendorff/leapp-repository
import os
import re
from leapp.exceptions import StopActorExecutionError
from leapp.libraries.stdlib import api, run
from leapp.models import BootContent
def add_boot_entry():
debug = 'debug' if os.getenv('LEAPP_DEBUG', '0') == '1' else ''
kernel_dst_path, initram_... | 2.140625 | 2 |
porcupine/plugins/rstrip.py | rscales02/porcupine | 0 | 12781960 | <filename>porcupine/plugins/rstrip.py
"""Remove trailing whitespace when enter is pressed."""
from porcupine import get_tab_manager, tabs, utils
def after_enter(textwidget):
"""Strip trailing whitespace at the end of a line."""
lineno = int(textwidget.index('insert').split('.')[0]) - 1
line = textwidget.... | 3.125 | 3 |
scripts/06_plot_orthogroups_venn.py | cmdoret/Acastellanii_genome_analysis | 5 | 12781961 | <gh_stars>1-10
import pandas as pd
from matplotlib_venn import venn2, venn3
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use("Agg")
vdf = pd.read_csv(snakemake.input["pres_compact"], sep="\t").drop(
"Orthogroup", axis=1
)
vdf = vdf.astype(bool)
# vdf = vdf.rename(columns={'NEFF_v1_hgt_cds': 'v1'})
... | 2.40625 | 2 |
var_conv_dq.py | TeodorPoncu/variational-conv-dequantization | 0 | 12781962 | <reponame>TeodorPoncu/variational-conv-dequantization
import torch
from torch import nn
from torch.nn import functional as F
from typing import Tuple
from torch.distributions import Normal
class TestConvDequantize(nn.Module):
"""
Please refer to VariationalConvDequantize class down bellow for implementation d... | 2.515625 | 3 |
gauss.py | pituca292/calculo-numerico-algoritmos | 0 | 12781963 | #!/usr/bin/env
# -*- coding: utf-8 -*-
# Módulo de Gauss:
# Métodos de calculo da solução de um sistema linear por eliminação de gauss
# Método para calculo do erro da solução de gauss em relação a solução real
import numpy as np
import construtor
import solve
# Calcula o vetor solução pelo método de Ga... | 3.5625 | 4 |
backend/course/views.py | ducluongtran9121/Web-Application-Project | 1 | 12781964 | <reponame>ducluongtran9121/Web-Application-Project
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.parsers import FormParser, MultiPartParser, JSONParser
from rest_framework.views import APIView
from rest_framework import mixins
from rest_framework... | 2.09375 | 2 |
pydefect/input_maker/defect.py | KazMorita/pydefect | 20 | 12781965 | # -*- coding: utf-8 -*-
# Copyright (c) 2020. Distributed under the terms of the MIT License.
import re
from dataclasses import dataclass
from typing import List, Optional
from monty.json import MSONable
@dataclass(frozen=True)
class Defect(MSONable):
name: str
charges: tuple
@property
def str_lis... | 2.890625 | 3 |
pages/managers.py | GrAndSE/django-pages | 0 | 12781966 | '''Managers for pages classes, can be used to easies access for models
'''
from django.db import models
class ActiveQuerySet(models.query.QuerySet):
'''QuerySet has additional methods to siplify access to active items
'''
def active(self):
'''Get only active items
'''
return self.... | 2.59375 | 3 |
Products/PloneGetPaid/browser/upgrade.py | collective/Products.PloneGetPaid | 2 | 12781967 | <filename>Products/PloneGetPaid/browser/upgrade.py<gh_stars>1-10
from Products.Five.browser import BrowserView
from Products.PloneGetPaid import generations
class AdminUpgrade( BrowserView ):
log = None
def __call__( self ):
if self.request.form.has_key('upgrade'):
self.log = sel... | 2.3125 | 2 |
dictionary.py | rgoshen/Python-Dictionary | 1 | 12781968 | """
This program allows the user to enter in a word, proper
noun or acronym to search in data file and returns definition(s).
Created by: <NAME>
Date: 10-25-2020
I followed a tutorial from a course named "The Python Mega Course:
Build 10 Real World Applications" on stackskills.
"""
import json
from difflib impor... | 4.1875 | 4 |
bpy_utilities/material_loader/shaders/source1_shaders/refract.py | tltneon/SourceIO | 199 | 12781969 | <reponame>tltneon/SourceIO<filename>bpy_utilities/material_loader/shaders/source1_shaders/refract.py
import numpy as np
from typing import Iterable
from ...shader_base import Nodes
from ..source1_shader_base import Source1ShaderBase
class Refract(Source1ShaderBase):
SHADER: str = 'refract'
@property
def... | 2.34375 | 2 |
tests/features/steps/simple_class_test.py | Lreus/python-behave | 0 | 12781970 | <gh_stars>0
from sample.classes.simple_class import SimpleClass
from sample.classes.subclasses.simple_subclass import SimpleSubClass
from urllib.error import URLError, HTTPError
from http.client import HTTPResponse
from requests import Response
from behave import *
def class_mapping():
"""
:return:
:rty... | 3 | 3 |
elements-of-programming-interviews/5-arrays/5.7-buy-and-sell-stock-twice/buy_and_sell_stock_twice.py | washimimizuku/python-data-structures-and-algorithms | 0 | 12781971 | '''
Write a program that computes the maximum profit that
can be made by buying and selling a share at most twice.
The second buy must be made on another date after the
first sale.
'''
def buy_and_sell_stock_twice(prices): # Time: O(n) | Space: O(n)
min_price_so_far = float('inf') # Infinite value
max_total... | 3.890625 | 4 |
MalwareViz.py | MalwareViz/MalwareViz | 8 | 12781972 | #!/usr/bin/env python
# coding: utf8
"""
Download a webpage -> parse Name, IP, URL, Dropped Files.
Create Graphviz gv file -> convert to svg -> post to web.
------------ ------------
| URL | ----> | IP |
... | 2.09375 | 2 |
test_cvfill.py | xbcReal/ssd_fcn_multitask_text_detection_pytorch1.0 | 2 | 12781973 | <filename>test_cvfill.py
import cv2
import numpy as np
image = np.ones((720,1280, 3), np.uint8) * 255
triangle = np.array([[1131,122,1161,125,1165,107,1119,123]])
triangle = np.reshape(triangle,(-1,4,2))
print(np.shape(triangle))
cv2.circle(image, (triangle[0][0][0], triangle[0][0][1]), 5, (0, 255, 0), 5)
cv2.circle(im... | 2.984375 | 3 |
text_classification/UCAS_NLP_TC/data_11_baidu_cws_api_fill.py | q759729997/qyt_clue | 1 | 12781974 | """
百度词法分析API,补全未识别出的:
pip install baidu-aip
"""
import time
import os
import sys
import codecs
import json
import traceback
from tqdm import tqdm
from aip import AipNlp
sys.path.insert(0, './') # 定义搜索路径的优先顺序,序号从0开始,表示最大优先级
from data import baidu_config # noqa
""" 你的 APPID AK SK """
APP_ID = baidu_config.APP_ID # ... | 2.359375 | 2 |
example/change_date.py | MadSkittles/Switch-Fightstick | 0 | 12781975 | from NXController import Controller
ctr = Controller()
for i in range(30):
ctr.A()
if i == 0:
ctr.RIGHT()
ctr.RIGHT()
else:
ctr.LEFT()
ctr.LEFT()
ctr.LEFT()
ctr.UP()
ctr.RIGHT(0.4)
ctr.A()
ctr.close() | 2.609375 | 3 |
auth.py | computerbox124/Hey-Hajiyevs | 0 | 12781976 | from support import *
import chat
def main():
#Creating Login Page
global val, w, root,top,username,name
root = tk.Tk()
username = tk.StringVar()
name = tk.StringVar()
#root.attributes('-fullscreen',True)
top = Toplevel1 (root)
init(root, top)
root.mainloop()
def authenticatio... | 2.96875 | 3 |
app/database.py | yaoelvon/flask-sqlalchemy-custom-query-demo | 0 | 12781977 | # -*- coding: utf-8 -*-
# @date 2016/06/03
# @author <EMAIL>
# @desc custom methods of the query class in Flask-SQLAlchemy
# @record
#
from flask import request
from flask_sqlalchemy import (
BaseQuery,
Model,
_BoundDeclarativeMeta,
SQLAlchemy as BaseSQLAlchemy,
_QueryProperty)
from sqlalchemy.ext... | 2.765625 | 3 |
datasets/sofc_materials_articles/sofc_materials_articles.py | NihalHarish/datasets | 9 | 12781978 | # coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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/lice... | 1.601563 | 2 |
scheduler/migrations/0001_initial.py | FelixTheC/beak_emailer_list | 0 | 12781979 | <reponame>FelixTheC/beak_emailer_list<gh_stars>0
# Generated by Django 3.1.1 on 2021-04-15 20:05
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ScheduleCo... | 1.796875 | 2 |
python_modules/libraries/dagster-papertrail/dagster_papertrail/loggers.py | rpatil524/dagster | 4,606 | 12781980 | <gh_stars>1000+
import logging
import socket
from dagster import Field, IntSource, StringSource, logger
class ContextFilter(logging.Filter):
hostname = socket.gethostname()
def filter(self, record):
record.hostname = ContextFilter.hostname
return True
@logger(
{
"log_level": Fi... | 2.5 | 2 |
riskGame/classes/agent/real_time_aStar.py | AmrHendy/RiskGame | 4 | 12781981 | from sys import maxsize
from riskGame.classes.evaluations.sigmoidEval import SigmoidEval
from riskGame.classes.agent.passive_agent import Passive
class RTAStar:
def __init__(self, evaluation_heuristic=SigmoidEval()):
self.__hash_table = {}
self.__evaluate = evaluation_heuristic
self.__pas... | 2.71875 | 3 |
labml_db/serializer/pickle.py | labmlai/db | 4 | 12781982 | <reponame>labmlai/db<filename>labml_db/serializer/pickle.py
import pickle
from typing import Optional
from . import Serializer
from ..types import ModelDict
class PickleSerializer(Serializer):
file_extension = 'pkl'
is_bytes = True
def to_string(self, data: ModelDict) -> bytes:
return pickle.dum... | 2.65625 | 3 |
bead/tech/persistence.py | krisztianfekete/lib | 1 | 12781983 | <gh_stars>1-10
'''
Functions to persist python structures or load them.
'''
import io
import json
# json is used for serializing objects for persistence as it is
# - in the standard library from >=2.6 (including 3.*)
# - 2.7 version decodes strings as unicode, unlike e.g. the csv module
# - the interface is also beco... | 3.5625 | 4 |
sacrerouge/datasets/duc_tac/tac2009/__init__.py | danieldeutsch/decomposed-rouge | 81 | 12781984 | from sacrerouge.datasets.duc_tac.tac2009.subcommand import TAC2009Subcommand
| 1.039063 | 1 |
quotes/luckyitem.py | sumaneko/discordpy-startup | 0 | 12781985 | from mylib.mymodule import get_quotes
from mymodule.ryonage_bot import RyonageBot
def get_lucky(bot, m):
pre = ""
suf = ""
name = m.author.name if m.author.nick is None else m.author.nick
#元気状態なら
if bot.dying_hp < bot.get_hp():
pre = f"{name}さんのラッキーアイテムは・・・・・・『"
quotes = [
... | 2.1875 | 2 |
camael/regression_models.py | CastaChick/Camael | 2 | 12781986 | <gh_stars>1-10
import numpy as np
from numpy import linalg as LA
class LinearRegression:
"""
線形回帰を行うモデル
Parameters
----------
intercept: boolean(default=True)
切片要素を入れるかどうか
Examples
---------
>>> from load_data import load_boston
>>> (X_train, y_train), (X_test, y_test) = ... | 3.015625 | 3 |
downloadbot_common/messaging/consuming/handlers.py | dnguyen0304/downloadbot.common | 0 | 12781987 | # -*- coding: utf-8 -*-
import abc
class Handler(metaclass=abc.ABCMeta):
@abc.abstractmethod
def handle(self, message):
"""
Parameters
----------
message : downloadbot_common.messaging.messages.Message
Returns
-------
None
Raises
---... | 2.875 | 3 |
angr/knowledge_plugins/patches.py | Kyle-Kyle/angr | 6,132 | 12781988 | from typing import Optional, List, Dict
from cle.address_translator import AddressTranslator
from sortedcontainers import SortedDict
from .plugin import KnowledgeBasePlugin
# TODO: Serializable
class Patch:
def __init__(self, addr, new_bytes, comment: Optional[str]=None):
self.addr = addr
self.n... | 2.390625 | 2 |
gtm_manager/manager.py | trakken/gtm_manager | 7 | 12781989 | """manager.py"""
import logging
from googleapiclient import errors
import gtm_manager.account
class GTMManager(gtm_manager.base.GTMBase):
"""Authenticates a users base gtm access.
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.accounts_service = self.service.accounts... | 2.859375 | 3 |
busca-jogos/busca/classes/patio.py | IvanBrasilico/AI-NanoDegree | 0 | 12781990 | <reponame>IvanBrasilico/AI-NanoDegree<gh_stars>0
from collections import OrderedDict
from typing import Any, List, Optional, Set, Tuple, Union
from busca.classes import ALTURAS, COLUNAS
from busca.utils.logconf import logger
colunas_dict = {k: ind for ind, k in enumerate(COLUNAS)}
alturas_dict = {k: ind for ind, k in... | 2.734375 | 3 |
python/sherpa/__init__.py | MattRickS/sherpa | 1 | 12781991 | <gh_stars>1-10
from sherpa.exceptions import FormatError, ParseError, PathResolverError
from sherpa.resolver import PathResolver
| 1.195313 | 1 |
fuzzing/kernel/syzkaller-configs/generate_config.py | DBGilles/retrowrite | 478 | 12781992 | <reponame>DBGilles/retrowrite<gh_stars>100-1000
#!/usr/bin/python3
import argparse
import json
import os
def main():
parser = argparse.ArgumentParser(
description='Generate a configuration file for syzkaller')
parser.add_argument('--workdir', help='workdir for syzkaller', required=True)
parser... | 2.265625 | 2 |
mpnetcdf4/dc.py | GeoscienceAustralia/dea-netcdf-benchmark | 1 | 12781993 | """
Datacube interop functions are here
"""
import numpy as np
from itertools import chain
from types import SimpleNamespace
from datacube.storage.storage import measurement_paths
from datacube.utils import uri_to_local_path
from datacube.api import GridWorkflow
def flatmap(f, items):
return chain.from_iterable(m... | 2.28125 | 2 |
src/calculate_ranks.py | BorgwardtLab/graphkernels-review | 3 | 12781994 | <reponame>BorgwardtLab/graphkernels-review
#!/usr/bin/env python3
#
# calculate_ranks.py: calculates the ranks of individual graph kernels
# on the benchmark data sets.
import pandas as pd
import sys
from collections import Counter
if __name__ == '__main__':
df = pd.read_csv(sys.argv[1], header=0, index_col=0)... | 2.75 | 3 |
trainer/train_elmpronet.py | fortoon21/detecthangul | 0 | 12781995 | import os
import time
import torch
import torch.optim
import torch.nn.functional as F
import torch.nn.init as init
from torch.autograd import Variable
from loss.ssd_loss import SSDLoss
from metrics.voc_eval import voc_eval
from modellibs.s3fd.box_coder import S3FDBoxCoder
from utils.average_meter import AverageMeter
c... | 2.078125 | 2 |
python/testData/types/AwaitOnImportedCoroutine/mycoroutines.py | jnthn/intellij-community | 2 | 12781996 | <reponame>jnthn/intellij-community<gh_stars>1-10
from typing import Any
async def mycoroutine() -> Any:
pass | 1.132813 | 1 |
recupero/migrations/0002_auto_20191103_1159.py | cluster311/ggg | 6 | 12781997 | # Generated by Django 2.2.4 on 2019-11-03 14:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recupero', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='prestacion',
name='nomenclador',
... | 1.742188 | 2 |
opensearch/results.py | akuanti/opensearch | 0 | 12781998 | from opensearch import osfeedparser
import logging
logger = logging.getLogger(__name__)
class Results(object):
def __init__(self, query, agent=None):
self.agent = agent
self._fetch(query)
self._iter = 0
def __iter__(self):
self._iter = 0
return self
def __len__(... | 2.671875 | 3 |
app/pkgs/query.py | minhtuan221/architecture-collection | 3 | 12781999 | <reponame>minhtuan221/architecture-collection<filename>app/pkgs/query.py
from .type_check import type_check
@type_check
def get_start_stop_pos(page: int, size: int):
page = max(1, page)
size = max(1, size)
offset = (page - 1) * size
limit = size
return offset, limit
| 1.90625 | 2 |
tests/test_inventory.py | mavroskardia/oworld | 0 | 12782000 | #
# Tests for Overworld character inventory
#
import sys
sys.path.append('../components')
from items import NewInventory as Inventory
from items import NewItem as Item
from items import Material
class Test_Inventory:
def setup_class(cls):
cls.inv = Inventory()
def test_construction(self):
... | 2.78125 | 3 |
tests/test_utils.py | gramaziokohler/total_station_robot_localization | 0 | 12782001 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas_mobile_robot_reloc.utils import _ensure_rhino
from pytest import raises
def test__ensure_rhino():
with raises(ImportError):
_ensure_rhino()
| 1.4375 | 1 |
scripts/07_lemma/main.py | sdspieg/naeval | 36 | 12782002 |
from os.path import (
expanduser,
join as join_path
)
from IPython.display import HTML
from tqdm.notebook import tqdm as log_progress
from naeval.const import (
NEWS, WIKI, FICTION, SOCIAL, POETRY,
DATASET, JL, GZ
)
from naeval.io import (
format_jl,
parse_jl,
load_gz_lines,
dump_gz... | 1.59375 | 2 |
devel/grobid/process/parse_tei.py | arrismo/tripods-testing | 2 | 12782003 | <reponame>arrismo/tripods-testing<filename>devel/grobid/process/parse_tei.py<gh_stars>1-10
import sys
import re
from xml.etree import ElementTree as ET
total_matches = 0
pattern = re.compile(r"[A-Z]{2,6}\s{,1}-{,1}[0-9]{2,6}")
def traverse_node(root, pattern):
"""
Find matches at current node, then move on t... | 3.03125 | 3 |
pymain.py | Almasumgazi/download-manager | 0 | 12782004 | import requests
from bs4 import BeautifulSoup
import re
import webbrowser
import time
from qbittorrent import Client
movie = input("Enter What You Want To Download : ")
movie_name = movie
if(len(movie.split()) > 1):
movie = movie.split()
movie = '%20'.join(movie)
else:
movie = movie
url ... | 3.09375 | 3 |
skcosmo/linear_model/__init__.py | andreanelli/scikit-cosmo | 16 | 12782005 | <reponame>andreanelli/scikit-cosmo<gh_stars>10-100
from ._base import OrthogonalRegression
from ._ridge import RidgeRegression2FoldCV
__all__ = ["OrthogonalRegression", "RidgeRegression2FoldCV"]
| 1.15625 | 1 |
drl/envs/wrappers/stateful/abstract.py | lucaslingle/pytorch_drl | 0 | 12782006 | """
Abstract wrapper definitions.
"""
from typing import Mapping, Any
import abc
import torch as tc
from drl.envs.wrappers.stateless import Wrapper
class TrainableWrapper(Wrapper, metaclass=abc.ABCMeta):
"""
Wrapper with trainable parameters.
"""
@abc.abstractmethod
def learn(
self,... | 2.9375 | 3 |
src/pds_doi_service/core/outputs/web_client.py | NASA-PDS/doi-service | 0 | 12782007 | #
# Copyright 2020–21, by the California Institute of Technology. ALL RIGHTS
# RESERVED. United States Government Sponsorship acknowledged. Any commercial
# use must be negotiated with the Office of Technology Transfer at the
# California Institute of Technology.
#
"""
=============
web_client.py
=============
Co... | 2.390625 | 2 |
lectures/solutions/tile_rectify.py | ritamonteiroo/scikit | 453 | 12782008 | from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from skimage import transform
from skimage.transform import estimate_transform
source = np.array([(129, 72),
(302, 76),
(90, 185),
(326, 193)])
target = np.array([[0, 0... | 2.671875 | 3 |
test/test_combine_overlap_stats.py | MelbourneGenomics/iq | 0 | 12782009 | import StringIO
import unittest
import iq.combine_overlap_stats
class TestCombineOverlapStats(unittest.TestCase):
def test_simple(self):
exons = ['A1CF\t1\t2\t50.00\tALT1,ALT2', 'A2M\t3\t4\t75.00\t']
cds = ['A2M\t5\t6\t83.33\tALT3']
target = StringIO.StringIO()
log = StringIO.Strin... | 2.46875 | 2 |
src/webapp/dummy_data.py | janLo/meet-and-eat-registration-system | 0 | 12782010 | <reponame>janLo/meet-and-eat-registration-system<filename>src/webapp/dummy_data.py
from math import sqrt
from random import random
import database as db
from database.model import Team, Members, Location
def make_dummy_data(num_teams, confirmed=True):
for idx in range(num_teams):
team = Team(name="Team %d... | 2.921875 | 3 |
operators/self_patch.py | zhou3968322/dl-lab | 0 | 12782011 | <gh_stars>0
# -*- coding:utf-8 -*-
# email:<EMAIL>
# create: 2020/12/17
import torch
import torch.nn as nn
class Selfpatch(object):
def buildAutoencoder(self, target_img, target_img_2, target_img_3, patch_size=1, stride=1):
nDim = 3
assert target_img.dim() == nDim, 'target image must be of dimensi... | 2.1875 | 2 |
mmseg/datasets/pipelines/transforms_new.py | shinianzhihou/ChangeDetection | 95 | 12782012 | <reponame>shinianzhihou/ChangeDetection
import albumentations as A
from albumentations import DualTransform
from albumentations.pytorch import ToTensorV2
from numpy import random
from ..builder import PIPELINES
PIPELINES.register_module(module=ToTensorV2)
| 1.132813 | 1 |
every_election/apps/elections/migrations/0048_seed_status.py | DemocracyClub/EveryElection | 8 | 12782013 | <reponame>DemocracyClub/EveryElection<filename>every_election/apps/elections/migrations/0048_seed_status.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def load_init_data(apps, schema_editor):
ModerationStatus = apps.get_model("elections", "ModerationStatus")
... | 1.953125 | 2 |
src/day006.py | zhangxinyong12/my-python-demo | 0 | 12782014 | # #
# def func():
# n = 0
# while True:
# n += 1
# yield n # yield = return + 暂停
#
#
# # g = func()
# # print(g)
# # print(g.__next__())
# # print(next(g))
#
#
# def fid(length):
# a, b = 0, 1
# n = 0
# while n < length:
# yield b
# a, b = b, a + b
# n += 1
#... | 3.859375 | 4 |
nvrtc/enums.py | uchytilc/PyCu | 0 | 12782015 | <reponame>uchytilc/PyCu
from ctypes import c_int
enum = c_int
nvrtcResult = enum
NVRTC_SUCCESS = nvrtcResult(0)
NVRTC_ERROR_OUT_OF_MEMORY = nvrtcResult(1)
NVRTC_ERROR_PROGRAM_CREATION_FAILURE = nvrtcResult(2)
NVRTC_ERROR_INVALID_INPUT ... | 1.929688 | 2 |
pyga/termination_condition/stagnation.py | Eyjafjallajokull/pyga | 0 | 12782016 | <gh_stars>0
from .termination_condition import TerminationCondition
class Stagnation(TerminationCondition):
"""
Implements TerminationCondition to terminate evolution when there is no increase of best fitness value.
:param max_fitness_age: int number of generations after which to terminate
:param use... | 3.484375 | 3 |
therminator/sensors/pi.py | jparker/therminator_client | 0 | 12782017 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import re
import time
def read(file='/sys/class/thermal/thermal_zone0/temp'):
"""Return the internal temperature.
Keyword arguments:
file -- path to kernal interface file for internal temperature
The default value for file, /sy... | 3.25 | 3 |
helper/main_class.py | AVM-Martin/CTF-EncryptionAlgorithm | 0 | 12782018 | class Cryptography():
def __init__(self, key):
self.key = key
def encrypt(self, text):
return text
def decrypt(self, text):
return text
def get_key(self):
return self.key
| 3.125 | 3 |
tests/test_twoChoice.py | SebastianAllmeier/rmf_tool | 1 | 12782019 | """
Test that computes the refined mean field approximation for the two-choice model
(with order 1 and 2 and a few parameter)
Compare the computed value with a value already stored in a pickle file
"""
import pickle
import numpy as np
from approximately_equal import approximately_equal
import os
PWD=os.getcwd()
if PW... | 2.84375 | 3 |
LanguageConstructs/DataModel/Inheritance/main.py | ha-khan/PythonPractice | 0 | 12782020 |
# id()
# hash()
# __mro__
# __basis__
# __name__
# __class__
class Orchestrator:
# class attribute; global to
instance_counter = 0
def __init__(self, type: str) -> None:
# need to use Orchestrator class instance attribute selector
# to access class variables, in this scope
cls... | 3.046875 | 3 |
selenium_util.py | dertilo/selenium-scraping | 0 | 12782021 | import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
def build_chrome_driver(download_dir: str, headless=True,window_size=(1920,1080)):
os.makedirs(download_dir, exist_ok=True)
options = webdriver.ChromeOptions()
if headless:
options.add_argument("headless")
... | 2.875 | 3 |
src/training/models/MainTrainCNN.py | rogov-dvp/medical-imaging-matching | 1 | 12782022 | import time
import numpy as np
from sklearn.model_selection import train_test_split
from keras.optimizers import Adam
from keras.utils import plot_model
from CNNTripletModel import build_network, build_model
from BatchBuilder import get_batch_random_demo
input_shape = (28, 28, 1)
evaluate_every = 5
n_val = 5
batc... | 2.625 | 3 |
main.py | Dixneuf19/dank-face-bot | 0 | 12782023 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple Bot to reply to Telegram messages.
This program is dedicated to the public domain under the CC0 license.
This Bot uses the Updater class to handle the bot.
First, a few handler functions are defined. Then, those functions are passed to
the Dispatcher ... | 3.15625 | 3 |
students/K33421/Golub_Anna/LR_3/library/library_project/library_app/views.py | aytakr/ITMO_ICT_WebDevelopment_2021-2022 | 7 | 12782024 | from django.db.models import Sum
from .serializers import *
from rest_framework.generics import *
class BookListAPIView(ListAPIView):
serializer_class = BookSerializer
queryset = Book.objects.all()
class BookCreateAPIView(CreateAPIView):
serializer_class = BookSerializer
queryset = Book.objects.all... | 2.046875 | 2 |
src/utils.py | OsciiArt/Freesound-Audio-Tagging-2019 | 22 | 12782025 | import numpy as np
from torch.optim.lr_scheduler import _LRScheduler
from torch.utils.data.dataset import Dataset
from math import cos, pi
import librosa
from scipy.io import wavfile
import random
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
s... | 2.484375 | 2 |
python/fleetx/dataset/ctr_data_generator.py | hutuxian/FleetX | 170 | 12782026 | <filename>python/fleetx/dataset/ctr_data_generator.py
#!/usr/bin/python
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 2.46875 | 2 |
tests/helper_test_reload_data.py | rndr/aioimport | 0 | 12782027 | data: object = object()
| 1.1875 | 1 |
torchio/transforms/__init__.py | soumickmj/torchio | 0 | 12782028 | from .transform import Transform, TypeTransformInput
from .spatial_transform import SpatialTransform
from .intensity_transform import IntensityTransform
from .interpolation import Interpolation, get_sitk_interpolator
# Generic
from .lambda_transform import Lambda
# Augmentation
from .augmentation.composition import O... | 1.53125 | 2 |
scripts/gen_noise.py | williamalu/ofdm_mimo_usrp | 2 | 12782029 | import numpy as np
import matplotlib.pyplot as plt
def make_pulses(data, T, pulse):
widen = np.zeros(len(data) * T, dtype=np.complex64)
for idx, val in enumerate(widen):
if idx % T == 0:
widen[idx] = data[ idx//T ]
return np.array(np.convolve(widen, pulse, 'full'), dtype=np.complex64)... | 2.8125 | 3 |
src/geocat/f2py/triple_to_grid_wrapper.py | NCAR/geocat-f2py | 4 | 12782030 | <reponame>NCAR/geocat-f2py
import warnings
import numpy as np
import xarray as xr
from dask.array.core import map_blocks
from .errors import ChunkError, CoordinateError, DimensionError
from .fortran import grid2triple as grid2triple_fort
from .fortran import triple2grid1
from .missing_values import fort2py_msg, py2fo... | 2.265625 | 2 |
sge/utils.py | wookayin/subtask-graph-execution-light | 3 | 12782031 | <filename>sge/utils.py
from enum import Enum
import numpy as np
class KEY(Enum):
UP = 0,
DOWN = 1,
LEFT = 2,
RIGHT = 3,
PICKUP = 4,
TRANSFORM = 5,
USE_1 = 5,
USE_2 = 6,
USE_3 = 7,
USE_4 = 8,
USE_5 = 9,
QUIT = 'q'
WHITE = (255, 255, 255)
LIGHT = (196, 196, 196)
GREEN =... | 2.359375 | 2 |
tethysapp/parleys_creek_management/controllers/results.py | CI-WATER/tethysapp-parleys_creek_management | 0 | 12782032 | from django.shortcuts import render
from ..model import SessionMaker, ManagementScenario
from ..model import (LITTLE_DELL_VOLUME,
LITTLE_DELL_RELEASE,
LITTLE_DELL_SPILL,
MOUNTAIN_DELL_VOLUME,
MOUNTAIN_DELL_RELEASE,
... | 1.960938 | 2 |
theory/Lesson6-Dictionaries/code/dictionary_final.py | dgrafov/redi-python-intro | 8 | 12782033 | <gh_stars>1-10
# Lesson6: Dictionaries
# source: code/dictionary_modify.py
grades = {}
finish = 'no'
while finish != 'yes':
action = int(input('Please type "1" for reading the data and "2" for modifying:\n'))
if action == 1:
subject = input('Please enter the name of a subject:\n')
if subject... | 4.15625 | 4 |
solutions/problem_108.py | ksvr444/daily-coding-problem | 1,921 | 12782034 | def can_shift(target, string):
return \
target and string and \
len(target) == len(string) and \
string in target * 2
assert can_shift("abcde", "cdeab")
assert not can_shift("abc", "acb")
| 2.84375 | 3 |
foo_003_fews_new_food_insecurity/contents/src/__init__.py | bapludow/nrt-scripts | 0 | 12782035 | <filename>foo_003_fews_new_food_insecurity/contents/src/__init__.py
from __future__ import unicode_literals
import os
import logging
import sys
import urllib
import zipfile
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
import requests as req
import fiona
from collections im... | 2.0625 | 2 |
Diena_6_lists/lists_g1.py | ValdisG31/Python_RTU_08_20 | 1 | 12782036 | <reponame>ValdisG31/Python_RTU_08_20
# # What is a list after all?
# # * ordered
# # * collection of arbitrary objects (anything goes in)
# # * nested (onion principle, Matroyshka)
# # * mutable - maināmas vērtības
# # * dynamic - size can change
my_list = [5, 6, "Valdis", True, 3.65, "alus"] # most common way of creat... | 4.5625 | 5 |
2_Bim/aula.py | eucgabriel/Faculdade-2--Semestre | 1 | 12782037 | <filename>2_Bim/aula.py
class Animais:
def __init__(self, nome=None, cobertura=None, raca=None):
self.nome = nome
self.cobertura = cobertura
self.raca = raca
def dar_nome(self, nome=None):
self.nome = nome
class Cachorros(Animais):
def trocar(self, cobertura=None, raca=Non... | 2.875 | 3 |
classifier/vec/doc2vec_train.py | banboooo044/natural-language-sentiment-anaysis | 0 | 12782038 | <reponame>banboooo044/natural-language-sentiment-anaysis<filename>classifier/vec/doc2vec_train.py<gh_stars>0
# train Doc2vec and save model
import pandas as pd
import numpy as np
from gensim.models.doc2vec import Doc2Vec
from gensim.models.doc2vec import TaggedDocument
# PV-DBOW
def train_DBOW(df):
print("train ... | 2.640625 | 3 |
old_django_malliva/settingsManager/migrations/0001_initial.py | olubiyiontheweb/malliva | 0 | 12782039 | <gh_stars>0
# Generated by Django 3.2 on 2021-06-22 12:50
from django.db import migrations, models
import django.db.models.deletion
import settingsManager.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('paymentGateways', '0001_initial'),
('customCodes', '0001... | 1.65625 | 2 |
cpu_demo/parse_target_repo.py | nicktendo64/hash-fixpoints | 1 | 12782040 | #! /usr/bin/python3
# run this from the root of a git repository with the command-line arguments
# described in the usage statement below
import sys
import subprocess
import os
AUTHOR = "<NAME> <<EMAIL>>"
TIMEZONE = "-0700"
DESIRED_COMMIT_MESSAGE = "added self-referential commit hash using magic"
DESIRED_COMMIT_TIME... | 2.59375 | 3 |
gen-template.py | claytantor/troposphere-iac | 0 | 12782041 | #!/usr/bin/env python
# coding: utf-8
import logging
import argparse
import importlib
from tropiac.utils import make_cloudformation_client, load_config, get_log_level
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
def... | 2.453125 | 2 |
PolTools/main_programs/tsrFinder.py | GeoffSCollins/PolTools | 0 | 12782042 | """
This program is the interface and driver for tsrFinder
"""
import os
import sys
import argparse
import multiprocessing
from collections import defaultdict
from multiprocessing import Pool
from PolTools.utils.constants import tsr_finder_location
from PolTools.utils.tsr_finder_step_four_from_rocky import run_step_... | 2.6875 | 3 |
src/morphforge/simulation/neuron/objects/obj_cclamp.py | mikehulluk/morphforge | 1 | 12782043 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 <NAME>.
# 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.195313 | 1 |
movierama/movierama/movies/views.py | abourazanis/movierama | 0 | 12782044 | from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.views import View
from django.... | 2.1875 | 2 |
homeworks/yan_romanovich/hw05/level05.py | tgrx/Z22 | 0 | 12782045 | <gh_stars>0
def unique(collection):
return len(collection) == len(set(collection))
| 2.453125 | 2 |
tests/test_q0202.py | mirzadm/ctci-5th-py | 0 | 12782046 | """Unit tests for q0202.py."""
import unittest
from src.utils.linkedlist import LinkedList
from src.q0202 import kth_element_to_last
class TestKthElementToLast(unittest.TestCase):
"""Tests for kth element to last."""
def test_kth_element_to_last(self):
linked_list = LinkedList()
self.assertE... | 3.5625 | 4 |
rushapi/blueprints/url_shortener.py | Kyuunex/rush-api | 0 | 12782047 | """
This file provides endpoints for everything URL shortener related
"""
from flask import Blueprint, request, make_response, redirect, json
import time
import validators
from rushapi.reusables.context import db_cursor
from rushapi.reusables.context import db_connection
from rushapi.reusables.rng import get_random_s... | 3.265625 | 3 |
profetorch/blocks/squasher.py | sachinruk/ProFeTorch1 | 19 | 12782048 | <filename>profetorch/blocks/squasher.py<gh_stars>10-100
# AUTOGENERATED! DO NOT EDIT! File to edit: Squasher.ipynb (unless otherwise specified).
__all__ = ['Squasher']
# Cell
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
torch.Tensor.ndim = pro... | 2.546875 | 3 |
aux_routines/PerfStats.py | jshtok/StarNet | 3 | 12782049 | <reponame>jshtok/StarNet<gh_stars>1-10
import numpy as np
import os
import matplotlib
#matplotlib.use('agg')
import matplotlib.pyplot as plt
from aux_routines.data_structures import get_GT_IoUs,get_GT_IoPs,get_GT_IoGs
import copy
def voc_ap(rec, prec, score, sc_part, use_07_metric=False):
"""
avera... | 1.992188 | 2 |
table2ascii/alignment.py | sairamkiran9/table2ascii | 24 | 12782050 | from enum import Enum
class Alignment(Enum):
"""
Enum for text alignment types within a table cell
Example::
from table2ascii import Alignment
output = table2ascii(
...
alignments=[Alignment.LEFT, Alignment.RIGHT, Alignment.CENTER, Alignment.CENTER]
)
... | 3.53125 | 4 |