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 |
|---|---|---|---|---|---|---|
vedastr/datasets/lmdb_dataset.py | wu0004in/vedastr | 0 | 12766151 | # modify from clovaai
import random
import re
import lmdb
import six
from PIL import Image
from .base import BaseDataset
from .registry import DATASETS
@DATASETS.register_module
class LmdbDataset(BaseDataset):
def __init__(self, *args, **kwargs):
super(LmdbDataset, self).__init__(*args, **kwargs)
... | 1.984375 | 2 |
GalleryMan/assets/QtHelpers.py | 0xsapphir3/GalleryMan | 9 | 12766152 | from functools import partial
from PyQt5 import QtCore
from PyQt5.QtCore import QParallelAnimationGroup, QPoint, QPropertyAnimation, QRect, QTimer
from PyQt5.QtGui import QCursor
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QGraphicsOpacityEffect, QHBoxLayout, QLabel, QMainWindow, QPushButton, QScrollArea, Q... | 2.625 | 3 |
users/forms.py | arthtyagi/gettit | 6 | 12766153 | from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from .models import Profile
class UserRegisterForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ['username', 'email', 'first_name']
... | 2.265625 | 2 |
tests/test_gm.py | ghost-devs/GhostMarketContractN3 | 1 | 12766154 | <reponame>ghost-devs/GhostMarketContractN3
from boa3 import constants
from pathlib import Path
from boa3.boa3 import Boa3
from boa3.neo import to_script_hash
from boa3.neo.cryptography import hash160
from boa3.neo.vm.type.String import String
from boa3.neo.smart_contract.VoidType import VoidType
from boa3_test.tests.bo... | 1.625 | 2 |
mayan/apps/sources/management/commands/bulk_upload.py | Dave360-crypto/mayan-edms | 3 | 12766155 | <gh_stars>1-10
from __future__ import absolute_import
from json import loads
from optparse import make_option
import os
import sys
from django.core.management.base import CommandError, LabelCommand
from documents.models import DocumentType
from metadata.api import convert_dict_to_dict_list
from ...models import Out... | 2.046875 | 2 |
fa_expects/models.py | shimayu22/fa_expects_app | 0 | 12766156 | from django.db import models
from django.core import validators
# Create your models here.
class Players(models.Model):
POSITION_CHOICES = (
('', '選択'),
(1, '投'),
(2, '捕'),
(3, '一'),
(4, '二'),
(5, '三'),
(6, '遊'),
(7, '外'),
)
... | 2.21875 | 2 |
tests/core/usecase/stream/test_get_streams.py | thepabloaguilar/kamui | 5 | 12766157 | from unittest.mock import Mock
from uuid import uuid4
import pytest
from returns.result import Failure, Result, Success
from kamui.core.entity.source import SourceType
from kamui.core.entity.stream import Stream
from kamui.core.use_case.failure import FailureDetails, BusinessFailureDetails
from kamui.core.use_case.st... | 2.125 | 2 |
algo-c2d.py | AlgoveraAI/DeFi | 0 | 12766158 | <reponame>AlgoveraAI/DeFi
import sys
def get_input(local=False):
pass
def run_algo(local=False):
filename = get_input(local)
if __name__ == "__main__":
local = (len(sys.argv) == 2 and sys.argv[1] == "local")
run_algo(local) | 2.015625 | 2 |
sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/_operations.py | vincenttran-msft/azure-sdk-for-python | 1 | 12766159 | <reponame>vincenttran-msft/azure-sdk-for-python
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license infor... | 1.734375 | 2 |
text_summarize/text_summarize.py | anshul2807/Automation-scripts | 496 | 12766160 | <filename>text_summarize/text_summarize.py
import argparse
from summarizer import Summarizer
def text_summarize(text, **kwargs):
"""
Summarize the given text. Returns the summarize
"""
model = Summarizer()
return model(text, **kwargs)
if __name__ == '__main__':
parser = argparse.ArgumentPars... | 3.984375 | 4 |
src/mave/train.py | goodarzilab/ciberatac | 3 | 12766161 | from apex import amp
from argparse import ArgumentParser
from collections import OrderedDict
from datetime import datetime
import scipy.sparse as sp_sparse
import tables
from itertools import chain
from model import loss_function
from model import VAE
import numpy as np
import os
import pandas as pd
from sklearn.metric... | 1.875 | 2 |
fsociety/__version__.py | kernel1337/fsociety | 1 | 12766162 | <gh_stars>1-10
VERSION = (3, 2, 4)
__version__ = ".".join(map(str, VERSION))
| 1.4375 | 1 |
Random.random_walk_GRAPH.py | eltechno/python_course | 4 | 12766163 | # Numpy is imported, seed is set
import numpy as np
np.random.seed(123)
# Initialization
random_walk = [0]
for x in range(100) :
step = random_walk[-1]
dice = np.random.randint(1,7)
if dice <= 2:
step = max(0, step - 1)
elif dice <= 5:
step = step + 1
else:
step = step + np... | 3.734375 | 4 |
staghunt/util.py | airibarne/msthesis | 0 | 12766164 | <filename>staghunt/util.py<gh_stars>0
"""Miscellaneous utility functions and classes"""
import gc
import numpy as np
import torch as t
def kronecker_delta(i, j):
return 1 if i == j else 0
def _round_by_tol(x, tol):
return x if x > tol else 0
round_by_tol = np.vectorize(_round_by_tol, otypes=[np.float64])... | 2.390625 | 2 |
scripts/zlevel.py | max-simon/master-thesis | 4 | 12766165 | #!/usr/bin/env python
from netCDF4 import Dataset # pylint: disable=no-name-in-module
import numpy as np
#########################################################
# Class for ROMS grd and clm files
# (For use in various post-processing scripts)
#########################################################
class getGrid(... | 2.359375 | 2 |
bridgetest/common/npm.py | Half-Shot/hs-bridge-test | 3 | 12766166 | import subprocess
import shutil
import tempfile
import logging
from time import sleep
logger = logging.getLogger(__name__)
class Npm:
def __init__(self):
self.process = None
pass
def install(self, path):
logger.info("Installing npm packages...")
process = subprocess.Popen(
... | 2.59375 | 3 |
Lileb-Training/src/modules/new_head_llmodel.py | ForInLoveAting/LifeLongLearningBenchmark | 1 | 12766167 | <reponame>ForInLoveAting/LifeLongLearningBenchmark
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from src.modules.ll_model import LifelongLearningModel
from src.modules.utils import make_... | 2.21875 | 2 |
fairseq/models/abs_sum_roberta_transformer.py | XingxingZhang/abs_pretraining | 0 | 12766168 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
import os
import json
... | 2.15625 | 2 |
Data/print_data_from_mdx_view.py | wimgielis/tm1py-samples | 36 | 12766169 | """
Create MDX View on }ClientGroups cube and query data through it.
IMPORTANT: MDX Views can not be seen through Architect/Perspectives.
"""
import configparser
import uuid
from TM1py.Objects import MDXView
from TM1py.Services import TM1Service
config = configparser.ConfigParser()
# storing the credentials in a fil... | 2.5 | 2 |
train_refinement.py | wuli-heyjude/Instance-Segmentation | 1 | 12766170 | import numpy as np
import torch
import torch.nn as nn
from torch import optim
from torch.utils.data import DataLoader, ConcatDataset
from argparse import ArgumentParser
from models.psp.pspnet import PSPNet
from models.sobel_op import SobelComputer
from dataset import OnlineTransformDataset
from util.logger import Boar... | 1.976563 | 2 |
tests/user_test.py | jjinno/pygerduty | 144 | 12766171 | from __future__ import absolute_import
import httpretty
import pygerduty
import pygerduty.v2
###################
# Version 1 Tests #
###################
@httpretty.activate
def test_get_user_v1():
body = open('tests/fixtures/user_v1.json').read()
httpretty.register_uri(
httpretty.GET, "https://contos... | 2.28125 | 2 |
uninove/auditoria-web-01.py | dirleif/aprendendo-python | 0 | 12766172 | <reponame>dirleif/aprendendo-python<gh_stars>0
# script para criar o banco de dados e a tabela
import sqlite3
conn = sqlite3.connect('empresa.db')
cursor = conn.cursor()
cursor.execute(
'CREATE TABLE usuario(nome TEXT NOT NULL,senha TEXT NOT NULL);'
) | 3.6875 | 4 |
tests/test_with_simple_ontology.py | irbraun/oats | 1 | 12766173 | <reponame>irbraun/oats
import pytest
import sys
import pandas as pd
sys.path.append("../oats")
import oats
# From the test ontology file:
#! This ontology is set up to contain two branches below the root.
#!
#!
#! --> 2 --> 5
#! The first branch of the ontology... | 2.71875 | 3 |
train_sppe/src/opt.py | marcnunez/CabinMonitoringV1 | 0 | 12766174 | <reponame>marcnunez/CabinMonitoringV1
# -----------------------------------------------------
# Copyright (c) Shanghai Jiao Tong University. All rights reserved.
# Written by <NAME> (<EMAIL>)
# -----------------------------------------------------
import argparse
parser = argparse.ArgumentParser(description='PyTorch ... | 2.453125 | 2 |
src/optimizer.py | KUTuaNithid/connect4Nithid | 41 | 12766175 | <filename>src/optimizer.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 25 19:36:30 2018
@author: Arpit
"""
import threading
class Optimizer(threading.Thread):
cnt = 0
stop_signal = False
def __init__(self, brain):
self.brain = brain
threading.Thread.__init__(self... | 3.359375 | 3 |
leetcode/maxProfit.py | BoLin/2018-Projects | 2 | 12766176 | class Solution:
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
n = len(prices) #从图像上来看更好解决,最大盈利是吃到每一个波谷到波峰
if n <= 1:
return 0
count = 0
i = 1
while i != n:
diff = max((prices[i] - pr... | 3.015625 | 3 |
api.py | luccanunes/urban-dict | 1 | 12766177 | <filename>api.py
def get_term(term: list):
import requests
from bs4 import BeautifulSoup
URL = "https://www.urbandictionary.com/define.php?term="
for word in term:
URL += word
if word != term[-1]:
URL += '+'
page = requests.get(URL)
soup = BeautifulSoup(page.cont... | 3.59375 | 4 |
milpool/models.py | knutdrand/milpool | 0 | 12766178 | <filename>milpool/models.py
import torch
from .pool import XYMILPool
class Quadratic(torch.nn.Module):
def __init__(self, n_input=1):
super().__init__()
self.linear = torch.nn.Linear(n_input, 1)
self.quadratic = torch.nn.Linear(n_input, 1, bias=False)
def forward(self, X):
... | 3.15625 | 3 |
scripts/swap_column_values.py | vkozareva/single_cell_portal | 42 | 12766179 | <filename>scripts/swap_column_values.py
"""
Swap column values, but not column headers, of a TSV file
Example:
# Swap values in first and last columns of a TSV that has two header lines
python3 swap_column_values.py --num_header_rows 2 --swap_columns 0,-1 --input_file scp_coordinates.tsv
"""
import argparse
args =... | 3.765625 | 4 |
blueprints/era_postgres/base_vm.py | halsayed/calm | 0 | 12766180 | from calm.dsl.builtins import AhvVmResources, AhvVm
from calm.dsl.builtins import AhvVmDisk, AhvVmNic, AhvVmGC
from vars import NETWORK_NAME
| 1.023438 | 1 |
tests/test_multithreading.py | himaghna/molSim | 1 | 12766181 | """ Test multithreading to ensure consistent behavior with
serial implementation."""
import unittest
import warnings
from os import remove
from os.path import exists, join
import numpy as np
from molSim.chemical_datastructures import MoleculeSet
from time import time
from tabulate import tabulate
class TestMultithrea... | 2.71875 | 3 |
util/date_util.py | hroncok/Google-Calendar-Simple-API | 0 | 12766182 | <gh_stars>0
from datetime import datetime, timedelta
def get_utc_datetime(date, *args, **kwargs):
if isinstance(date, datetime):
return date.isoformat()
else:
return datetime(date, *args, **kwargs).isoformat()
def date_range(start_date, day_count):
for n in range(day_count):
yiel... | 3.015625 | 3 |
code/UI/OpenAPI/python-flask-server/swagger_server/models/response_envelope.py | ramseylab/RTX | 0 | 12766183 | <filename>code/UI/OpenAPI/python-flask-server/swagger_server/models/response_envelope.py
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from swagger_server.models.base_model_ import Model
from swagger_server.models.... | 2.21875 | 2 |
dgcrm/migrations/0004_auto_20170616_1326.py | DenysGurin/solnce | 0 | 12766184 | <filename>dgcrm/migrations/0004_auto_20170616_1326.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-16 13:26
from __future__ import unicode_literals
import dgcrm.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies... | 1.71875 | 2 |
pages/views.py | SueyGuey/RealPolitik | 0 | 12766185 | from django.shortcuts import render, redirect
from bs4 import BeautifulSoup
from django.views.generic import DetailView, FormView, CreateView
from news.models import Article, Comment
from django.db import IntegrityError
from django.db.models import Q
from .forms import AddComment
import requests
from urllib.request imp... | 2.34375 | 2 |
xmagical/base_env.py | kevinzakka/x-magical | 19 | 12766186 | import abc
from typing import Any, Dict, List, Optional, Sequence, Tuple, Type, Union
import gym
import numpy as np
import pymunk as pm
from gym import spaces
import xmagical.entities as en
import xmagical.render as r
from xmagical.phys_vars import PhysicsVariablesBase, PhysVar
from xmagical.style import ARENA_ZOOM_O... | 2.265625 | 2 |
py_neuromodulation/nm_decode.py | neuromodulation/py_neuromodulation | 7 | 12766187 | <filename>py_neuromodulation/nm_decode.py
from numpy.core.overrides import verify_matching_signatures
from sklearn import model_selection, metrics, linear_model, discriminant_analysis, base
from skopt.space import Real, Integer, Categorical
from skopt.utils import use_named_args
from skopt import gp_minimize, Optimizer... | 2 | 2 |
Day03_AoC.py | ricardofitas/Advent-of-code-2021 | 0 | 12766188 | <filename>Day03_AoC.py<gh_stars>0
c = open("__21_d03.txt")
lin = c.readlines()
## Part 1
klin = [list([lin[i].split("\n")[0] for i in range(len(lin))][j]) for j in range(len(lin))]
k2 = [1 if [klin[jj][len(klin[0])-ii-1] for jj in range(len(lin))].count('1') > [klin[jj][len(klin[0])-ii-1] for jj in range(len(lin))].... | 2.90625 | 3 |
src/config.py | cityiot/electric-bus-data-collector | 1 | 12766189 | # -*- coding: utf-8 -*-
# Copyright 2019 Tampere University
# This software was developed as a part of the CityIoT project: https://www.cityiot.fi/english
# This source code is licensed under the 3-clause BSD license. See license.txt in the repository root directory.
# Author(s): <NAME> <<EMAIL>>
'''
Helper module for ... | 1.90625 | 2 |
quiz_bot/cli/utils.py | livestreamx/quiz-bot | 1 | 12766190 | <reponame>livestreamx/quiz-bot
import io
from typing import Optional, Type
from pydantic import BaseSettings
def get_settings(file: Optional[io.StringIO], settings_type: Type[BaseSettings]) -> BaseSettings:
if file is not None:
return settings_type.parse_raw(file.read())
return settings_type()
| 2.390625 | 2 |
depth_calling/utilities.py | cariaso/Cyrius | 30 | 12766191 | <gh_stars>10-100
#!/usr/bin/env python3
#
# Cyrius: CYP2D6 genotyper
# Copyright (c) 2019-2020 Illumina, Inc.
#
# Author: <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eithe... | 2.515625 | 3 |
custom_components/senseme/version.py | bdraco/senseme-hacs | 0 | 12766192 | """Version for senseme-hacs."""
__version__ = "2.2.3"
| 0.847656 | 1 |
server_python/config.py | dkvirus/py-novel | 145 | 12766193 | # config.py
# encoding:utf-8
DEBUG = True
JSON_AS_ASCII = False
| 1.117188 | 1 |
SIRQIs/resources/modules/classes.py | chance-alvarado/SIRQIs-IBM | 0 | 12766194 | <gh_stars>0
"""Specify classes defining within and between individual dynamics.
The following classes and function define the dynamics of infection within and
between individuals in a simulated population. Time steps are progressed and
infection dynamics are simulated through the simulate_time_step function
acting on ... | 2.96875 | 3 |
rul_prediction/poly_reg.py | inovex/RCIS2021-degradation-bearing-vessels | 2 | 12766195 | from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import Pipeline
def fit_poly_reg(X, y, degree=1, memory_path=None) -> Pipeline:
polyreg = make_pipeline(PolynomialFeatures(degree), LinearRegressi... | 2.703125 | 3 |
examples/eg1.py | petercorke/bdsim | 64 | 12766196 | #!/usr/bin/env python3
import bdsim
sim = bdsim.BDSim(animation=True) # create simulator
print(sim)
bd = sim.blockdiagram() # create an empty block diagram
# define the blocks
demand = bd.STEP(T=1, pos=(0,0), name='demand')
sum = bd.SUM('+-', pos=(1,0))
gain = bd.GAIN(10, pos=(1.5,0))
plant = bd.LTI_SISO(0.5, [2, ... | 2.59375 | 3 |
resource/pypi/cryptography-1.7.1/src/_cffi_src/commoncrypto/sectrust.py | hipnusleo/Laserjet | 0 | 12766197 | <gh_stars>0
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
INCLUDES = """
#include <Security/SecTrust.h>
"""
... | 1.304688 | 1 |
tensorflow_io/core/python/experimental/mongodb_writer_ops.py | michaelbanfield/io | 1 | 12766198 | <reponame>michaelbanfield/io<filename>tensorflow_io/core/python/experimental/mongodb_writer_ops.py
# Copyright 2020 The TensorFlow 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 ... | 2.375 | 2 |
youkube/compoents/youkube_compoent.py | lyrl/youkube | 1 | 12766199 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Created on 2016年8月9日13:16:54
import datetime
import json
import os
import youkube.compoents.model as model
import youkube.compoents.youtube_compoent as youtube
import youkube.util as util
import time
import youkube.constants as constants
import youkube.compoents.youku_... | 1.96875 | 2 |
mfr/extensions/pdf/exceptions.py | yacchin1205/RDM-modular-file-renderer | 36 | 12766200 | from mfr.core.exceptions import ExporterError
class PillowImageError(ExporterError):
"""The Image related errors raised from a :class:`mfr.extentions.pdf`
and relating to the Pillow Library should inherit from PillowImageError
"""
__TYPE = 'pdf_pillow'
def __init__(self, message, *args, export_f... | 2.484375 | 2 |
object_tracker/applications/data_update/roi_update_regions.py | aidoop/CoboMarkerTracking | 2 | 12766201 | import json
class ROIUpdateRegions:
roi_region_list = list()
def __init__(self):
self.roi_region_list.clear()
def add_roi_region(self, id, ltx, lty, rbx, rby):
testNestedDict = {
"id": id,
"region": {
"lt": {
"x": ltx,
... | 2.671875 | 3 |
MLCustomDownload.py | VaseSimion/Finance | 1 | 12766202 | <reponame>VaseSimion/Finance
import ExtractData as Ed
from datetime import datetime
from datetime import timedelta
import csv
import DatabaseStocks as Ds
import yfinance as yf
import math
from tqdm import tqdm
# This is to write the dataset and the verification, which means dates and stocks that are downloaded for tra... | 3.234375 | 3 |
spacy-annotator/displacy/server.py | aniruddha-adhikary/spacy-dev-resources | 132 | 12766203 | #!/usr/bin/env python
from __future__ import unicode_literals
from __future__ import print_function
import falcon
import spacy
import json
import sys
from spacy.pipeline import EntityRecognizer
import spacy.util
from spacy.tagger import Tagger
from .parse import Entities, TrainEntities
from falcon_cors import CORS
... | 2.3125 | 2 |
mmpose/core/optimizer/registry.py | chaowentao/mmpose | 367 | 12766204 | from mmcv.utils import Registry
OPTIMIZERS = Registry('optimizers')
| 1.25 | 1 |
lemon/default/main.py | InsaneMiner/Salt | 6 | 12766205 | <gh_stars>1-10
import lemon.StartDevServer as DevServer
if __name__ == "__main__":
DevServer.Start() | 0.90625 | 1 |
object_detection/vantara/lumada/client/gateway_client.py | cardosov/Hackathon2018ObjectDetector | 0 | 12766206 | from lumada.client.api.gateway_client_base import GatewayClientBase
from lumada.utils.validator import Validator
from lumada.client.lumada_client import LumadaClient
from lumada.client.asset_registration_client import AssetRegistrationClient
from lumada.client.asset_client import AssetClient
class GatewayClient(Gatew... | 2.234375 | 2 |
jinahub/segmenters/Sentencizer/__init__.py | vivek2301/executors | 0 | 12766207 | from .sentencizer import Sentencizer
| 1.085938 | 1 |
the_josephus_problem02.py | manofern/the-josephus-problem | 0 | 12766208 | num = 42
list_of_numbers = []
for i in range(1, num+1):
list_of_numbers.append(i)
print(list_of_numbers)
death = 3
for i in list_of_numbers:
if i == num:
if i == death:
print("XX")
else:
print(i)
elif i < 10:
if i == death:
print(f"XX", end=" -... | 3.703125 | 4 |
cddm/test/test_core.py | inwwin/cddm | 0 | 12766209 | import unittest
import numpy as np
import cddm.core as core
from cddm.conf import FDTYPE, CDTYPE
from cddm.video import fromarrays
#test arrays
a = [1.,2,3,4]
b = [5,6,7,8]
t1 = [1,3,7,8]
t2 = [2,4,6,8]
#results fo calculations
cross_a_b = np.array([ 70., 100., 62., 28.],FDTYPE)
cross_a_b_t1_t2 = np.array([32., 72.,... | 2.21875 | 2 |
Tms-GCN-PyTorch/utils/data/spatiotemporal_csv_data.py | Joker-L0912/Tms-GCN-Py | 0 | 12766210 | import argparse
import numpy as np
import pytorch_lightning as pl
from torch.utils.data.dataloader import DataLoader
import utils.data.functions
class SpatioTemporalCSVDataModule(pl.LightningDataModule):
def __init__(
self,
feat_path: str,
adj_path: str,
batch_size: int = 32,
... | 2.328125 | 2 |
manilaclient/v2/share_group_type_access.py | Murray-LIANG/python-manilaclient | 0 | 12766211 | # Copyright 2016 <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 i... | 2.03125 | 2 |
bin/dustmasker_interval_to_bed.py | mpieva/quicksand-build | 0 | 12766212 | from csv import reader, writer
import sys
def get_id(s):
#adapted from Biopython SeqIO fasta parser
return s[1:].split(None, 1)[0]
r = reader(sys.stdin, delimiter="\t")
w = writer(sys.stdout, delimiter="\t")
for row in r:
row[0] = get_id(row[0]) #only keep the Accession number (trim everything after first... | 2.671875 | 3 |
Pratica/exe10.py | Joao-Inacio/Curso-de-Python3 | 1 | 12766213 | def FizzBuzz(n):
if (n % 5) == 0 and (n % 3) == 0:
return f'{n} FizzBuzz'
if (n % 3) == 0:
return f'{n} é fizz'
if (n % 5) == 0:
return f'{n} buzz'
return n
print(FizzBuzz(25))
| 3.515625 | 4 |
python/showpreprocess.py | imistyrain/ssd-models | 17 | 12766214 | import os
import cv2
import numpy as np
import sys
caffe_root = os.path.expanduser('~') + "/CNN/ssd"
sys.path.insert(0, caffe_root+'/python')
import caffe
from tqdm import tqdm
CLASSES = ('background', 'aeroplane', 'bicycle', 'bird', 'boat','bottle', 'bus', 'car', 'cat',
'chair','cow', 'diningtable', 'dog', 'horse','... | 2.265625 | 2 |
BrainQuake/gui_forms/ictal_form.py | HongLabTHU/Brainquake | 16 | 12766215 | <filename>BrainQuake/gui_forms/ictal_form.py<gh_stars>10-100
#! /usr/bin/python3.7
# -- coding: utf-8 -- **
from PyQt5.QtWidgets import QApplication, QSizePolicy, QMessageBox, QWidget, \
QPushButton, QLineEdit, QDesktopWidget, QGridLayout, QFileDialog, QListWidget, QLabel,QFrame,QGroupBox
from PyQt5.QtCore impor... | 2.15625 | 2 |
aliyun-python-sdk-csb/aliyunsdkcsb/request/v20171118/FindApproveServiceListRequest.py | xiaozhao1/aliyun-openapi-python-sdk | 0 | 12766216 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1.75 | 2 |
ips/worker/management/commands/get_ips_from_coordinator.py | marklit/mass-ipv4-whois | 20 | 12766217 | from random import randint
from time import sleep
from urlparse import urlparse
from django.conf import settings
from django.core.management.base import BaseCommand
import netaddr
import redis
import requests
from ips.config import get_config
from worker.models import IPv4Whois
from worker.tasks import (whois_afrinic... | 1.984375 | 2 |
civet/extraction/starting_models.py | FNNDSC/pycivet | 0 | 12766218 | """
Data from the `$MNI_DATAPATH/surface-extraction` directory.
"""
from civet.extraction.surfaces import RegularSurface
from civet.globals import MNI_DATAPATH
class SurfaceModel(RegularSurface['SurfaceModel']):
"""
Represents a surface data file from the `$MNI_DATAPATH/surface-extraction` directory.
"""
... | 2.421875 | 2 |
Python3/1040-Moving-Stones-Until-Consecutive-II/soln.py | wyaadarsh/LeetCode-Solutions | 5 | 12766219 | class Solution:
def numMovesStonesII(self, stones: List[int]) -> List[int]:
def helper():
n = len(stones)
if (stones[-2] - stones[0] == n - 2 and stones[-1] - stones[-2] > 2) or (stones[-1] - stones[1] == n - 2 and stones[1] - stones[0] > 2):
return 2
dq =... | 2.796875 | 3 |
953_Verifying_an_Alien_Dictionary.py | joshlyman/Josh-LeetCode | 0 | 12766220 | <reponame>joshlyman/Josh-LeetCode<filename>953_Verifying_an_Alien_Dictionary.py
class Solution:
def isAlienSorted(self, words: List[str], order: str) -> bool:
order_indx = {}
for idx,letter in enumerate(order):
order_indx[letter] = idx
# compare adjacent words
... | 3.34375 | 3 |
pynetlinux/util.py | youviewtv/pynetlinux | 69 | 12766221 | import sys
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
if PY3:
binary_type = bytes
else:
binary_type = str
| 2.34375 | 2 |
controller/employment_controller.py | waynshang/stock_institution | 1 | 12766222 | import urllib3
import os
import sys
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_dir)
from request import get_employment_data
from datetime import date
from utils import get_label_data, getLogger
DEBUG = getLogger()
def main(label, commencement_date, end_date):
result = ... | 3.0625 | 3 |
climateeconomics/sos_wrapping/sos_wrapping_emissions/ghgemissions/ghgemissions_discipline.py | os-climate/witness-core | 1 | 12766223 | <gh_stars>1-10
'''
Copyright 2022 Airbus SAS
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 writin... | 1.625 | 2 |
core/lineFollower.py | magikerwin1993/Line-Thinning-Python | 4 | 12766224 | <reponame>magikerwin1993/Line-Thinning-Python
import os
import cv2
import numpy as np
import matplotlib as mpl
import logging
from core.process import searchObject, getWindow, getPerimeterInfos, getEdgePoints, getPointers, getSkeletonPoint, updateData, connectPoints
from core.utils import plotPoint, plotWindow
class ... | 2.5625 | 3 |
test_update_status_groups.py | MoveOnOrg/reach-groups | 0 | 12766225 | import pytest
from _pytest.monkeypatch import MonkeyPatch
from update_status_groups import update_status_groups
class Struct:
def __init__(self, **entries):
self.__dict__.update(entries)
class Test():
monkeypatch = MonkeyPatch()
existing_groups = []
# Mock API request for token.
def moc... | 2.390625 | 2 |
luxon/utils/pkg.py | HieronymusCrouse/luxon | 7 | 12766226 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2020 <NAME> <<EMAIL>>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyri... | 1.320313 | 1 |
bert/modeling.py | alclone94/KorRoBERTa | 0 | 12766227 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, <NAME>PORATION. 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... | 2.015625 | 2 |
src/cms/menus/migrations/0007_alter_navigationbar_name.py | UniversitaDellaCalabria/uniCMS | 6 | 12766228 | # Generated by Django 3.2.3 on 2021-05-21 12:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cmsmenus', '0006_auto_20210507_1618'),
]
operations = [
migrations.AlterField(
model_name='navigationbar',
name='nam... | 1.523438 | 2 |
source/framework/python/test/to_numpy_test.py | pcraster/lue | 1 | 12766229 | <gh_stars>1-10
import lue.framework as lfr
import lue_test
import numpy as np
def setUpModule():
lue_test.start_hpx_runtime()
def tearDownModule():
return
lue_test.stop_hpx_runtime()
class ToNumPyTest(lue_test.TestCase):
@lue_test.framework_test_case
def test_array(self):
array_shape... | 2.078125 | 2 |
tasks/docker.py | andrewl/datadog-agent | 0 | 12766230 | <filename>tasks/docker.py
"""
Docker related tasks
"""
import os
import shutil
import sys
import tempfile
import time
from invoke import task
from invoke.exceptions import Exit
from .dogstatsd import DOGSTATSD_TAG
def retry_run(ctx, *args, **kwargs):
remaining_retries = 5
while True:
warn = True
... | 2.359375 | 2 |
Update_database.py | jmeliodas96/Updated-Data-Bases-Over-The-Air | 0 | 12766231 | <gh_stars>0
# Script for get information from www.mcc-mnc.com
# This Script compare two list, the first list for store the external content and second list store the local content from database(table lista)
# After this is load in DataFrames for process and compare every row.
#By <NAME>
# dependences to install
impor... | 3 | 3 |
kryptobot/markets/market_simulator.py | eristoddle/Kryptobot | 24 | 12766232 | from .market import Market
from . import position
from ..db.models import TradingOrder
import logging
logger = logging.getLogger(__name__)
class MarketSimulator(Market):
"""Wrapper for market that allows simulating simple buys and sells"""
def __init__(self, exchange, base_currency, quote_currency, quote_cur... | 3.0625 | 3 |
tests/test_1_eng.py | KepAlex-404/Raspoznovalka | 0 | 12766233 | <reponame>KepAlex-404/Raspoznovalka
from src.sentiment import sentiment
"""positive rew"""
text = """
nice hotel expensive parking got good deal stay hotel anniversary, arrived late evening took advice previous reviews
did valet parking, check quick easy, little disappointed non-existent view room room clean nice si... | 2.34375 | 2 |
tests/test_merge_genesets.py | pathwayforte/PathwayForte | 10 | 12766234 | <reponame>pathwayforte/PathwayForte<gh_stars>1-10
# -*- coding: utf-8 -*-
"""Test merge gene set."""
import logging
import os
import unittest
from collections import Counter
import pandas as pd
from pathway_forte.constants import DATA, check_gmt_files
from pathway_forte.mappings import get_mapping_dict, load_compat... | 2.21875 | 2 |
components/geniuswrapper.py | JLiekenbrock/lyrics-visualiser | 0 | 12766235 | import lyricsgenius
# wrapper for lyrics which remembers last search
# if there are several providers implemented this class should be inherited
class geniuslyrics:
"""
Class for searching for lyrics
"""
def __init__(self,_token = "<KEY>",_timeout=15,_retries=3,_verbose=False):
self.__session =... | 2.90625 | 3 |
gluon/tests/test_utils.py | lightcoder127/Web2py | 2 | 12766236 | <filename>gluon/tests/test_utils.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Unit tests for utils.py """
import unittest
from fix_path import fix_sys_path
fix_sys_path(__file__)
from utils import md5_hash
class TestUtils(unittest.TestCase):
""" Tests the utils.py module """
def test_md5_hash(sel... | 2.515625 | 3 |
input_mapping.py | qbrc-cnap/generic_microsatellite_identification | 0 | 12766237 | <gh_stars>0
#! /usr/bin/python3
from base.models import Resource
import os
def map_inputs(user, unmapped_data, id_list):
'''
`user` is a User instance (or subclass). This gives us
the option of applying user-specific logic to the mapping.
Since the code that calls this function does NOT know
the ... | 2.84375 | 3 |
checkov/cloudformation/checks/resource/aws/IAMRoleAllowsPublicAssume.py | Devocean8-Official/checkov | 1 | 12766238 | <gh_stars>1-10
import json
from typing import List
from checkov.cloudformation.checks.resource.base_resource_check import BaseResourceCheck
from checkov.common.models.enums import CheckResult, CheckCategories
class IAMRoleAllowsPublicAssume(BaseResourceCheck):
def __init__(self):
name = "Ensure IAM role ... | 2.203125 | 2 |
wsgi.py | wnormandin/pokeyapi | 0 | 12766239 | <filename>wsgi.py
from api import api
if __name__=="__main__":
api.run()
| 1.328125 | 1 |
aries_cloudcontroller/model/revoke_request.py | didx-xyz/aries-cloudcontroller-pyton | 5 | 12766240 | <filename>aries_cloudcontroller/model/revoke_request.py
# coding: utf-8
from __future__ import annotations
from datetime import date, datetime # noqa: F401
import re # noqa: F401
from typing import Any, Dict, List, Optional, Union, Literal # noqa: F401
from pydantic import AnyUrl, BaseModel, EmailStr, validator,... | 2.265625 | 2 |
pelicanconf.py | feltnerm/blog | 0 | 12766241 | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = '<NAME>'
SITENAME = "<NAME>'s Weblog"
SITENAME_SHORT = "<NAME>'s Weblog"
EMAIL = '<EMAIL>'
SITEURL = ''
DESCRIPTION = "The thoughts and writings of <NAME>."
THEME = 'theme/feltnerm-pelican-theme'
DEVELOP = True
PATH = 'c... | 1.53125 | 2 |
data/aligned_dataset.py | OnizukaLab/pytorch-CycleGAN-and-pix2pix | 0 | 12766242 | import os.path
import pickle
import random
from data.base_dataset import BaseDataset, get_params, get_transform
from data.image_folder import make_numbering_dataset
import numpy as np
from PIL import Image
class AlignedDataset(BaseDataset):
"""A dataset class for paired image dataset.
It assumes that the dir... | 2.59375 | 3 |
test/test_converters.py | kjulian3/NNet | 29 | 12766243 | <gh_stars>10-100
import unittest
import sys
sys.path.append('..')
import numpy as np
import onnx
from NNet.converters.nnet2onnx import nnet2onnx
from NNet.converters.onnx2nnet import onnx2nnet
from NNet.converters.pb2nnet import pb2nnet
from NNet.converters.nnet2pb import nnet2pb
import onnxruntime
from NNet.python.nne... | 2.25 | 2 |
proxy.py | RusherRG/Scalable-Proxy-Server | 2 | 12766244 | <filename>proxy.py
import random
import requests
import threading
import string
letters = string.ascii_letters + string.digits
def send_request():
url = "https://webhook.site/9d71f794-c6f4-4ee6-a97a-dd66d56007d9"
method = ['GET', 'POST'][random.randint(0, 1)]
if method == 'GET':
params = {
... | 2.796875 | 3 |
examples/examples.py | tsbischof/fda510k | 0 | 12766245 | import networkx
import fda
# Da Vinci robotic system
regulatory_graph = networkx.DiGraph()
regulatory_graph.add_node(fda.empty)
seeds = [fda.FDAApproval("K173585"),
fda.FDAApproval("K081113")]
for seed in seeds:
fda.populate_predicates(regulatory_graph, seed)
for seed in seeds:
subgraph = fda.netwo... | 2.359375 | 2 |
app/routes.py | ceciCoding/Queerevent | 0 | 12766246 | <filename>app/routes.py<gh_stars>0
import os
from app import app, db
from flask import Flask, render_template, request, session, url_for, redirect, flash, get_flashed_messages, jsonify, make_response
from flask_mail import Mail, Message
from app.models import User, Event, user_favorites
from tempfile import mkdtemp
fro... | 2.375 | 2 |
finite_field_test.py | a-l-r1/cryptography | 0 | 12766247 | <reponame>a-l-r1/cryptography
from finite_field import *
def main() -> None:
a = GF2Power31(42)
print(a)
fp = get_prime_finite_field_element_class(5, 'fp')
fpn = get_prime_finite_field_power_element_class(3, [fp(1), fp(3), fp(4), fp(2)], 'fpn')
a = fpn([fp(1), fp(2), fp(3)])
b = fpn([fp(2),... | 3.375 | 3 |
devil/devil/android/tools/system_app_test.py | Martijnve23/catapult | 1,894 | 12766248 | <reponame>Martijnve23/catapult<gh_stars>1000+
#!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import unittest
if __name__ == '__main__':
sys.path.append(
... | 2.15625 | 2 |
projects/flow.qe-minimal/init.py | phmalek/signac-examples | 1 | 12766249 | <gh_stars>1-10
import signac
project = signac.init_project('flow.quantum_espresso-example-project')
# For this example, we only initialize a single job.
project.open_job({
'potential': 'Si.pw-mt_fhi.upf',
'lattice_parameter': 10.2625545471,
'number_of_bands': 20,
}).init()
| 1.804688 | 2 |
sleap/nn/data/training.py | hectorcarrion/sleap | 156 | 12766250 | <reponame>hectorcarrion/sleap
"""Transformers and utilities for training-related operations."""
import numpy as np
import tensorflow as tf
import sleap
from sleap.nn.data.providers import LabelsReader
from sleap.nn.data.utils import expand_to_rank, ensure_list
import attr
from typing import List, Text, Optional, Any, ... | 2.90625 | 3 |