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 |
|---|---|---|---|---|---|---|
plugins/WikiFileTarget.py | seanth/nicecast-trackupdate | 2 | 12793251 | # Copyright (c) 2020 <NAME> <www.sean-graham.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | 2.1875 | 2 |
main.py | thedoctor095/TrustPilotReviews | 0 | 12793252 | <reponame>thedoctor095/TrustPilotReviews
import time
import requests
from bs4 import BeautifulSoup
query = str(input('Please enter the website for which you wish to know TrustPilot reviews: '))
tp_address = 'https://www.trustpilot.com/review/'
tp_query = tp_address + query.lower()
response = requests.get(tp_query)
s... | 3.203125 | 3 |
formulaic/materializers/arrow.py | CamDavidsonPilon/formulaic | 0 | 12793253 | from interface_meta import override
from .pandas import PandasMaterializer
class ArrowMaterializer(PandasMaterializer):
REGISTRY_NAME = 'arrow'
DEFAULT_FOR = ['pyarrow.lib.Table']
@override
def _init(self, sparse=False):
super()._init(sparse=sparse)
self.__data_context = LazyArrowTa... | 2.125 | 2 |
my_tsp/evaluation_metrics/loss.py | vmeta42/metaai | 0 | 12793254 | <filename>my_tsp/evaluation_metrics/loss.py
import numpy as np
import torch
from torch import nn
from ..utils.util import cal_cls_eva_thre
DIV_CONSTANT = 1e-5
# 回归损失-均方方差的平方根
class RMSELoss(nn.Module):
def __init__(self):
super().__init__()
self.mse = nn.MSELoss()
def forward(sel... | 2.4375 | 2 |
tests/test_server/test_grpc/test_init.py | Tomaz-Vieira/tiktorch | 8 | 12793255 | import json
import os
import threading
import grpc
from tiktorch.proto.inference_pb2 import Empty
from tiktorch.proto.inference_pb2_grpc import FlightControlStub
from tiktorch.server.grpc import serve
from tiktorch.utils import wait
def test_serving_on_random_port(tmpdir):
conn_file_path = str(tmpdir / "conn.js... | 2.40625 | 2 |
CS303_Artifical-Intelligence/NCS/data/data_F12/Rename-Files.py | Eveneko/SUSTech-Courses | 4 | 12793256 | <reponame>Eveneko/SUSTech-Courses
import os
# get the folder name
folder_name = os.path.dirname(__file__)
# folder_name = input("Input the folder name:")
# get all files name
file_names = os.listdir(folder_name)
print(file_names)
for i, name in enumerate(file_names):
old_file_name = folder_name + "/" + name
#... | 3.71875 | 4 |
app/db.py | vladkhard/learning_fastapi | 0 | 12793257 | import os
import pymongo
DB_NAME = os.getenv("DB_NAME")
client = pymongo.MongoClient("mongodb://db:27017")
db = client[DB_NAME]
| 1.953125 | 2 |
taiga/projects/migrations/0046_triggers_to_update_tags_colors.py | threefoldtech/Threefold-Circles | 1 | 12793258 | <filename>taiga/projects/migrations/0046_triggers_to_update_tags_colors.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-06-07 06:19
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0045_merge'),
... | 2.03125 | 2 |
src/algorithms/number_theory/P003_trial_division/solution_01.py | lakshmikanth-tesla/ProgrammingProblems | 1 | 12793259 | import logging
import math
"""
1. Note
- Loop from 2 till Square Root of N and keep dividing N at every step.
2. Optimisation(s)
- Apart from 2, only ODD numbers are tested for divisiblity.
- Only numbers upto SquareRoot(n) are tested for divisibility.
3. Limitation(s)
- Do not try with numbers which h... | 4.3125 | 4 |
preprocesss_lastfm_top50.py | mimbres/train_lastfm | 1 | 12793260 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 14 14:11:07 2019
@author: mimbres
"""
import pandas as pd
import numpy as np
from tqdm import trange
LASTFM_FILEPATH = './data/final_mapping.json'
OUTPUT_FILEPATH1 = './data/lastfm_top50_tagmtx.npy'
OUTPUT_FILEPATH2 = './data/lastfm_top50_featmtx.... | 2.125 | 2 |
menu_system.py | frazermills/Conways-Game-of-life | 2 | 12793261 | import pygame
class StartMenu:
def __init__(self, screen, font, text_colour, button_colour):
self.__screen = screen
self.__font = font
self.__text_colour = text_colour
self.__button_colour = button_colour
self.__click = False
self.__button_width = 150
self.__... | 3.453125 | 3 |
misc/question2.py | edwintcloud/algorithmPractice | 1 | 12793262 | def iterative_quicksort(arr, begin=0, end=None, counter=0):
'''iterative_quicksort is a recursive quicksorting algorithm'''
# initialize values on first iteration
if end is None:
end = len(arr)-1
# sort until begin is greater than or equal to end
if begin < end:
# starting index, ... | 4.28125 | 4 |
test/__init__.py | theophane-droid/stix2arango | 1 | 12793263 | # ensure that we use the current version of the package
import sys
import os
sys.path.insert(0, '/app')
from stix2 import IPv4Address, AutonomousSystem, Identity
from stix2 import Relationship, Incident, IPv6Address
from pyArango.connection import *
from pyArango.theExceptions import CreationError
from stix2arango.fee... | 1.953125 | 2 |
pysweep/equations/checker.py | anthony-walker/pysweep | 1 | 12793264 | #Programmer: <NAME>
#This file contains a test step function for debugging the swept rule
import numpy, h5py, mpi4py.MPI as MPI
try:
import pycuda.driver as cuda
from pycuda.compiler import SourceModule
except Exception as e:
pass
def step(state,iidx,arrayTimeIndex,globalTimeStep):
"""This is the meth... | 2.421875 | 2 |
tests/test_reference.py | uwcirg/true_nth_usa_portal | 3 | 12793265 | <gh_stars>1-10
"""Unit test module for Reference class"""
from portal.models.intervention import Intervention
from portal.models.questionnaire_bank import QuestionnaireBank
from portal.models.reference import Reference
from portal.system_uri import US_NPI
from tests import TEST_USER_ID, TestCase
class TestReference(... | 2.359375 | 2 |
src/ytdl2rss.py | kevinoid/ytdl2rss | 1 | 12793266 | <reponame>kevinoid/ytdl2rss<gh_stars>1-10
#!/usr/bin/env python3
"""Create podcast RSS from youtube-dl info JSON."""
import argparse
import codecs
import io
import json
import os
import sys
import time
import traceback
from datetime import datetime
from email.utils import formatdate
from xml.sax.saxutils import escap... | 2.515625 | 3 |
u24_lymphocyte/third_party/treeano/nodes/tests/costs_test.py | ALSM-PhD/quip_classification | 45 | 12793267 | import nose.tools as nt
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
fX = theano.config.floatX
def test_aggregator_node_serialization():
tn.check_serialization(tn.AggregatorNode("a"))
def test_elementwise_cost_node_serialization():
tn.check_serializa... | 2.125 | 2 |
stubs.min/System/Windows/Forms/__init___parts/ListBindingHelper.py | ricardyn/ironpython-stubs | 1 | 12793268 | class ListBindingHelper(object):
""" Provides functionality to discover a bindable list and the properties of the items contained in the list when they differ from the public properties of the object to which they bind. """
@staticmethod
def GetList(*__args):
"""
GetList(dataSource: object,dataMember: str) ... | 2.921875 | 3 |
test/test_pro.py | coinplus-sa/coinplus-solo | 1 | 12793269 | <reponame>coinplus-sa/coinplus-solo<filename>test/test_pro.py
import unittest
from coinplus_solo_redeem.pro import secret2_reconstruct_base58, secret1_reconstruct_base58
class TestPro(unittest.TestCase):
"""test of the bitcoin conversion from private key to wif"""
def setUp(self):
self.test_vector = [(... | 2.40625 | 2 |
pyblazing/pyblazing/apiv2/context.py | Christian8491/blazingsql | 0 | 12793270 | # NOTE WARNING NEVER CHANGE THIS FIRST LINE!!!! NEVER EVER
import cudf
from collections import OrderedDict
from enum import Enum
from urllib.parse import urlparse
from threading import Lock
from weakref import ref
from pyblazing.apiv2.filesystem import FileSystem
from pyblazing.apiv2 import DataType
from .hive imp... | 1.820313 | 2 |
pytato/cmath.py | alexfikl/pytato | 0 | 12793271 | from __future__ import annotations
__copyright__ = """
Copyright (C) 2020 <NAME>
Copyright (C) 2020 <NAME>
Copyright (C) 2020 <NAME>
Copyright (C) 2021 <NAME>
"""
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "So... | 1.609375 | 2 |
plagiarism/core.py | u2rafi/python-plagiarism | 2 | 12793272 | import numpy as np
from io import TextIOWrapper
from typing import Iterable, Any, Union, TextIO, List, Optional
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from plagiarism.sources import Source
class Output(object):
"""
Class that format n... | 2.765625 | 3 |
data_scripts/sony250/read_all_imgs.py | laomao0/AEnet | 1 | 12793273 | import cv2
import numpy as np
import random
import os
def imread(path):
# print(path)
img = cv2.imread(path, cv2.IMREAD_UNCHANGED)
# covert BRG to RGB
# img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# convert BGR to RGB
img = img[:,:,[2, 1, 0]]
return img
def imsave(path, img):
# convert ... | 2.65625 | 3 |
src/sentry_top/plugin.py | robopsi/sentry-top | 10 | 12793274 | import sentry_top
from collections import defaultdict
from nydus.db import create_cluster
from time import time
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from sentry.models import Project
from sentry.plugins.base import Plugin
if not getattr(settings, 'SENTRY_TOP', No... | 1.960938 | 2 |
aoc/twenty/day1/day.py | jaehoonhwang/advent-of-code | 0 | 12793275 | import os
from aoc.utils.file_reader import read_file_line
from aoc.utils.file_reader import path_join
directory_path = os.path.dirname(os.path.realpath(__file__))
input_filename = "input.txt"
target_number = 2020
"""
"""
def problem_part1(lines):
seen = set()
answer = None
for number in lines:
i... | 3.265625 | 3 |
2019/12 December/dp12012019.py | vishrutkmr7/DailyPracticeProblemsDIP | 5 | 12793276 | <reponame>vishrutkmr7/DailyPracticeProblemsDIP
# This problem was recently asked by Google:
# Given a nested dictionary, flatten the dictionary, where nested dictionary keys can be represented through dot notation.
import collections.abc as collections
def flatten_dictionary(d, parent_key="", sep="."):
# Fill ... | 4.03125 | 4 |
hbos_server/validationbase.py | robscetury/hbos | 0 | 12793277 | from abc import abstractmethod
class Validation(object):
def __init__(self, is_valid:bool, message:str):
self._is_valid = is_valid
self._message = message
@property
def is_valid(self) -> bool:
return self._is_valid
@is_valid.setter
def is_valid(self,value:bool):
s... | 3.515625 | 4 |
tests/commands/conftest.py | danpoland/slacktools-interactivity | 0 | 12793278 | <reponame>danpoland/slacktools-interactivity
from typing import Dict
import pytest
from interactivity.generics import Payload
def make_command_request_data():
return {
"token": "token",
"command": "/command",
"text": "do_work op1 op2",
"response_url": "https://testing.commands",
... | 2.328125 | 2 |
machine-learning/ml-algos/logistic_regression.py | teetangh/Kaustav-AI-workspace | 0 | 12793279 | #!/usr/bin/env python3
import numpy as np
import math
import random
def compute_z(theta, x):
z = 0
for j in range(len(x)):
z += theta[j] * x[j]
z += theta[len(x)]
return z
def compute_g(z):
return (1)/(1 + math.exp(-z))
def compute_h(z):
return compute_g(z)
def binary_cross_entro... | 2.953125 | 3 |
1_nas/predictor.py | nuaa-QK/1_NAS | 0 | 12793280 | <filename>1_nas/predictor.py
import os
from info_str import _cur_ver_dir
import numpy as np
from enumerater import Enumerater
from predict_op.label_encoding import decoder, encoder, getClassNum
from keras.utils.np_utils import to_categorical
from keras.models import model_from_json
import time
MAX_NETWORK_L... | 2.359375 | 2 |
hisa/capsule/capsule.py | rittikaadhikari/stock-recommendation | 0 | 12793281 | <filename>hisa/capsule/capsule.py
from six import with_metaclass
from abc import ABCMeta
class Capsule(with_metaclass(ABCMeta)):
pass
| 1.523438 | 2 |
AA.py | BeahIF/ev3 | 0 | 12793282 | <reponame>BeahIF/ev3
#!/usr/bin/env python3
#coding: utf-8
from ev3dev.ev3 import *
from threading import *
import time, socket
import math
m1 = LargeMotor('outD')
m2 = LargeMotor('outC')
m3 = MediumMotor('outB')
m4 = MediumMotor('outA')
#Sensor_Cor = [ColorSensor('in1'), ColorSensor('in2')]
#Sensor_Cor[0] = ColorSen... | 1.820313 | 2 |
tests/diffcalc/scenarios.py | DiamondLightSource/diffcalc-core | 1 | 12793283 | ###
# Copyright 2008-2011 Diamond Light Source Ltd.
# This file is part of Diffcalc.
#
# Diffcalc 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, either version 3 of the License, or
# (at your option) any late... | 2.203125 | 2 |
datasets/__init__.py | yubin1219/Semantic-Seg | 0 | 12793284 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .cityscapes import Cityscapes as cityscapes
| 1.179688 | 1 |
testscripts/RDKB/component/WIFIAgent/TS_WIFIAGENT_ForceDisable_CheckRadioEnable_InBridgeMode.py | rdkcmf/rdkb-tools-tdkb | 0 | 12793285 | ##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2020 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use th... | 1.617188 | 2 |
src/darcyai/file_stream.py | edgeworx/darcyai | 0 | 12793286 | <reponame>edgeworx/darcyai<filename>src/darcyai/file_stream.py
import threading
from darcyai.utils import validate_not_none, validate_type, validate
class FileStream:
"""
A class that represents a stream of data from a file.
# Arguments
path: The path to the file to write to.
append: Whether to a... | 2.984375 | 3 |
graphene_django_cud/mutations.py | martasd/graphene-django-cud | 0 | 12793287 | <gh_stars>0
from collections import OrderedDict
import graphene
from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist
from django.db import models, transaction
from graphene import Mutation, InputObjectType
from graphene.types.mutation import MutationOptions
from graphene.types.utils import yank_fie... | 1.789063 | 2 |
src/poliastro/frames/enums.py | sundeshgupta/poliastro | 634 | 12793288 | """Coordinate frames definitions.
"""
from enum import Enum
class Planes(Enum):
EARTH_EQUATOR = "Earth mean Equator and Equinox of epoch (J2000.0)"
EARTH_ECLIPTIC = "Earth mean Ecliptic and Equinox of epoch (J2000.0)"
BODY_FIXED = "Rotating body mean Equator and node of date"
| 2.4375 | 2 |
run.py | DongDong-123/zgg_test | 0 | 12793289 | <filename>run.py<gh_stars>0
import os
import time
from readConfig import ReadConfig
from db import DbOperate
import random
class Operate:
# def __init__(self):
# self.dboperate = DbOperate()
def create(self):
# from New_place_order import Execute
# from test_one import Execute
... | 2.40625 | 2 |
dcor/_fast_dcov_mergesort.py | lemiceterieux/dcor | 98 | 12793290 | '''
Functions to compute fast distance covariance using mergesort.
'''
import warnings
from numba import float64, int64, boolean
import numba
import numpy as np
from ._utils import CompileMode, _transform_to_2d
def _compute_weight_sums(y, weights):
n_samples = len(y)
weight_sums = np.zeros((n_samples,) ... | 2.5 | 2 |
rotation_averaging/so3.py | nishant34/RotationAveraging | 0 | 12793291 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2014-10-28 04:41:23
# @Last Modified by: marinheiro
# @Last Modified time: 2014-12-08 23:30:01
"""
Auxiliary functions to convert between different rotation representations.
"""
import numpy
import numpy.linalg
import scipy
import math
# Ax... | 3.578125 | 4 |
biblebot/api/intranet.py | yongki150/biblebot-scraper | 0 | 12793292 | from abc import ABCMeta, abstractmethod
from typing import Optional, Dict, List, Tuple
import re
from .base import (
HTTPClient,
IParser,
APIResponseType,
ILoginFetcher,
ISemesterFetcher,
ResourceData,
ErrorData,
ParserPrecondition,
SemesterData,
)
from ..reqeust import Response
fro... | 2.578125 | 3 |
calorie/signals.py | clarametto/calorieTracker | 3 | 12793293 | from django.db.models.signals import post_save
from django.contrib.auth.models import User
from .models import Profile
from django.dispatch import receiver
# Create your models here.
@receiver(post_save, sender=User)
def create_profile(sender,instance,created,**kwargs):
if created:
Profile.objects.create(p... | 2.3125 | 2 |
terrascript/tls/d.py | amlodzianowski/python-terrascript | 0 | 12793294 | <reponame>amlodzianowski/python-terrascript
# terrascript/tls/d.py
import terrascript
class tls_public_key(terrascript.Data):
pass
| 1.289063 | 1 |
paper/fig_max_speed_ac/fig_max_histo.py | npmurphy/CRNSynthesisFigures | 0 | 12793295 | <filename>paper/fig_max_speed_ac/fig_max_histo.py
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import os
import numpy as np
plt.style.use('paper/figstyle.mpl')
dpi = 300
import sys
sys.path += ["python"]
from figure_util import cm2inch
def get_dataset(w... | 2.25 | 2 |
dataset/change_image.py | zza584231732/face-master | 0 | 12793296 | from scipy.misc import imread,imresize,imsave
import os
path = '/home/zhang/tm/insightface_for_face_recognition-master/dataset/8631_align_train/'
out_path = '/home/zhang/tm/insightface_for_face_recognition-master/dataset/8631_112_align_train/'
img_lists = os.listdir(path)
for img_list in img_lists:
imgpaths = os... | 2.546875 | 3 |
train.py | youngstudent2/flappy-bird-for-learn | 0 | 12793297 | import flappybird as fb
import random
import time
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import SGD
import numpy as np
import copy
SCALE_FACTOR = 200
class GeneticBrain(fb.Brain):
def __init__(self,n_input,n_hidden):
'''
self.model = Sequential()
... | 2.5 | 2 |
angular_flask/utils.py | rsom777/Blog | 7 | 12793298 | <filename>angular_flask/utils.py
"""
Helper functions for controllers.py
"""
import os, boto3, uuid, io
from PIL import Image
from flask.ext.httpauth import HTTPBasicAuth
from flask import request, abort
from angular_flask.models import *
auth = HTTPBasicAuth()
@auth.verify_password
def verify_password(username_or... | 3.046875 | 3 |
python/count_primes.py | anishLearnsToCode/leetcode-algorithms | 17 | 12793299 | from typing import List
class Solution:
def _get_prime_sieve(self, size: int) -> List[int]:
sieve = [1] * (max(size, 2))
sieve[0], sieve[1] = 0, 0
for number in range(2, len(sieve)):
if sieve[number]:
for dividend in range(number ** 2, len(sieve), number):
... | 3.53125 | 4 |
tests/test_eotile.py | CS-SI/eotile | 7 | 12793300 | <reponame>CS-SI/eotile
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 CS GROUP - France.
#
# This file is part of EOTile.
# See https://github.com/CS-SI/eotile for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You m... | 1.953125 | 2 |
core/models.py | aashish01/FYP-Project | 0 | 12793301 | <filename>core/models.py
from django.db import models
from django.contrib.auth.models import User
from django_countries.fields import CountryField
from django.core.validators import MinValueValidator, MaxValueValidator
# Create your models here.
from django.shortcuts import reverse
from django.db.models.signals import... | 2.109375 | 2 |
solutions/python3/116.py | sm2774us/amazon_interview_prep_2021 | 42 | 12793302 | <reponame>sm2774us/amazon_interview_prep_2021
class Solution:
def connect(self, root: "Node") -> "Node":
if root == None:
return root
q, prev = [(root, 1)], None
while q:
curr, pos = q.pop(0)
if prev != None and prev[1] == pos:
prev[0].next... | 3.5625 | 4 |
dataAnalysis.py | RyanRasi/Stock-Market-Predictor | 0 | 12793303 | import matplotlib.pyplot as plt
import pandas as pd
#Data from source
stockData = './stock_market_data-AAPL'
df = pd.read_csv (stockData+".csv")
# Sort DataFrame by date
df = df.sort_values('Date')
# Gets all of the rows
df.head()
#Plots figure
plt.figure(figsize = (18,9))
plt.plot(range(df.shape[0]),(df['Low']+df... | 3.34375 | 3 |
App.py | RRFreitas/Projeto_APS | 0 | 12793304 | <reponame>RRFreitas/Projeto_APS
from Sistema import Sistema
def main():
sistema = Sistema()
sistema.menuPrincipal()
if __name__ == '__main__':
main() | 1.460938 | 1 |
src/visualization/__init__.py | vvrahul11/sentiment_analysis | 0 | 12793305 | from .visualize import plot_confusion_matrix | 1.023438 | 1 |
azplugins/test-py/test_mpcd_sinusoidal_channel.py | astatt/azplugins | 10 | 12793306 | <filename>azplugins/test-py/test_mpcd_sinusoidal_channel.py
# Copyright (c) 2018-2020, <NAME>
# Copyright (c) 2021-2022, Auburn University
# This file is part of the azplugins project, released under the Modified BSD License.
# Maintainer: astatt
import unittest
import numpy as np
import hoomd
from hoomd import md
fr... | 2.09375 | 2 |
ftp.py | wuzhanghui/postrate | 0 | 12793307 | from ftplib import FTP
import time
import tarfile
import shutil
import os
def ftpconnect(host, username, password):
ftp = FTP()
ftp.set_pasv(0)
ftp.set_debuglevel(2)
ftp.connect(host, 21)
ftp.login(username, password)
ftp.encoding = "utf-8"
return ftp
def downloadfile(ftp, remotepath, lo... | 2.921875 | 3 |
hermes_fix/message_lib/FIX_4_2/fix_messages.py | yabov/hermes_fix | 2 | 12793308 |
from ... import fix_message
from . import fields
from . import field_types
BEGINSTRING = 'FIX.4.2'
MESSAGE_TYPES = {}
class Header(fix_message.MessageBase):
def __init__(self):
super().__init__()
register_StandardHeader_component(self)
class Trailer(fix_message.MessageBase):
def __... | 2.125 | 2 |
src/envs/__init__.py | ewanlee/mackrl | 26 | 12793309 | <reponame>ewanlee/mackrl<gh_stars>10-100
from functools import partial
def env_fn(env, **kwargs):
return env(**kwargs)
REGISTRY = {}
from .starcraft2 import StarCraft2Env
REGISTRY["sc2"] = partial(env_fn,
env=StarCraft2Env)
| 2.078125 | 2 |
experiments/experiments_utils.py | anirbanl/Reason-SCAN | 14 | 12793310 | <reponame>anirbanl/Reason-SCAN<filename>experiments/experiments_utils.py
import argparse
import logging
import os
import torch
import sys
sys.path.append(os.path.join(os.path.dirname("__file__"), '../multimodal_seq2seq_gSCAN/'))
import random
import copy
import torch
import torch.nn as nn
import torch.nn.functional a... | 2.015625 | 2 |
djangoproj/djangoapp/crawler/b_crawler.py | pbarton666/buzz_bot | 0 | 12793311 | <reponame>pbarton666/buzz_bot
#!/usr/bin/env python
from __future__ import with_statement
import logging
# Library path
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
# Standard libraries
import atexit
import random
import re
import socket
import threading
import time
import tra... | 2.03125 | 2 |
trybox_django/tutorial.py | sophilabs/trybox-django | 0 | 12793312 | <reponame>sophilabs/trybox-django
# -*- coding: utf-8 -*-
from trybox.model import Tutorial
from step_01 import step as step01
tutorial = Tutorial(
title='Django',
description='Build a web application step by step using an awesome interactive tutorial for Django',
steps=[
step01,
]
)
| 1.679688 | 2 |
Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/core/cmd/cprpc/data/dsz/__init__.py | bidhata/EquationGroupLeaks | 9 | 12793313 | <reponame>bidhata/EquationGroupLeaks
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: __init__.py
import dsz
import dsz.cmd
import dsz.data
import dsz.lp
class CpRpc(dsz.data.Task):
def __init... | 2.203125 | 2 |
connection_speed.py | r-xela/lm_connection_speed | 2 | 12793314 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import requests
import speedtest
requests.packages.urllib3.disable_warnings()
speedtester = speedtest.Speedtest()
best_server = speedtester.get_best_server()
DL = speedtester.download()
UL = speedtester.upload()
dl_rate = "DL {:.2f}".format(DL / 1000 / 10... | 2.3125 | 2 |
src/blockchain/data/mempool.py | ParisNeo/blockchain | 0 | 12793315 | <reponame>ParisNeo/blockchain
"""
File : mempool.py
Author : ParisNeo
Description :
Here are stored the pending transactions
"""
import pickle
import time
from blockchain.data import transaction
class MemPool():
def __init__(self):
self.transactions=[]
| 2.21875 | 2 |
src/broAnalyzer/plots/subjectalternatenames.py | maveeee/passive-tls | 0 | 12793316 | from os.path import join
import pandas as pd
import matplotlib.pyplot as plt
from util.plot import Plot, plotDataFrame, formatXAxisDate
class SubjectAlternateNamesPlot(Plot):
def __init__(self):
super(SubjectAlternateNamesPlot, self).__init__('Subject Alternate Names', 'SubjectAlternateNames.csv', 'subjec... | 2.828125 | 3 |
FewShotPreprocessing.py | ahirsharan/MTL_Segmentation | 9 | 12793317 |
import os
import os.path as osp
from PIL import Image
PATH='../Fewshot/Fewshot/'
classes= os.listdir(PATH)
trainp='../Fewshot/train/'
valp='../Fewshot/val/'
testp='../Fewshot/test/'
for classv in classes:
if classv[0]=='.':
continue
pathn=osp.join(PATH,classv)
pathn=pathn+'/'
folders=os.l... | 2.53125 | 3 |
distributed_dp/dme_run.py | garyxcheng/federated | 330 | 12793318 | <filename>distributed_dp/dme_run.py
# Copyright 2021, Google LLC. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# ... | 2.078125 | 2 |
zasim/cagen/compatibility.py | timo/zasim | 2 | 12793319 | """The compatibility module offers a way for `StepFuncVisitor` objects
to express, what combinations are acceptable and what combinations are going to
break, allowing the constructor of the `StepFunc` to bail out soon
instead of causing an unexpected result during execution.
Each `StepFuncVisitor` has three attributes... | 2.625 | 3 |
Bin/init.py | mfneirae/GrupLAC-Complete | 0 | 12793320 | #
#
# #############################################################################
# Copyright (c) 2018 Universidad Nacional de Colombia All Rights Reserved.
#
# This work was made as a development to improve data collection
# for self-assessment and accreditation processes in the Vicedeanship
... | 1.742188 | 2 |
src/models/scraping_session.py | magnublo/msc-darkweb-scraping | 0 | 12793321 | <gh_stars>0
import datetime
from sqlalchemy import Column, Integer, DateTime, CHAR, Boolean, String
from definitions import MARKET_NAME_COLUMN_LENGTH, Base
TABLE_NAME = 'scraping_session'
PRIMARY_KEY = 'id'
TABLE_NAME_AND_PRIMARY_KEY = TABLE_NAME+"."+PRIMARY_KEY
class ScrapingSession(Base):
__tablename__ = TAB... | 2.40625 | 2 |
autoio-interfaces/autorun/pac99.py | lpratalimaffei/autoio | 0 | 12793322 | <gh_stars>0
""" Runners for PAC99 program
"""
import os
import automol
import pac99_io.reader
from autorun._run import from_input_string
# Read the new groups file stored with src
def _new_groups_str():
""" Read the new groups string
"""
src_path = os.path.dirname(os.path.realpath(__file__))
new_grou... | 2.515625 | 3 |
main.py | Kerono4ka/modified-genetic-algorithm-for-calculating-the-chromatic-number-of-a-graph | 0 | 12793323 | <filename>main.py
from random import choice, randint
from time import perf_counter
from time import sleep
import operator
import json
from genetic.gene import Gene
from genetic.population import Population
from graph.graph import Graph
from util.Stats import Stats
from util.params import Params
from util.util import g... | 2.78125 | 3 |
mikidown/sandbox.py | ckolumbus/mikidown | 0 | 12793324 | <gh_stars>0
import os
import shutil
from PyQt4.QtCore import QSettings
from PyQt4.QtGui import QApplication
from .mikiwindow import MikiWindow
from .mikibook import Mikibook
from .config import Setting
class Sandbox():
def __init__(self):
path = os.path.join(os.getcwd(), "test_notebook")
Mikiboo... | 2.328125 | 2 |
projecteuler/p0012_test.py | mccxj/online-judge-code-example | 2 | 12793325 | import unittest
import code_helper
class Test0012(unittest.TestCase):
def test_problem(self):
primes = list(code_helper.range_prime(10000))
triangle_number = -1
for n in range(7000, 20000):
triangle_number = n * (n + 1) / 2
divisors = 1
s = triangle_numb... | 3.25 | 3 |
ds-sdk-mini/DeepSecurity/antimalware.py | zachwhaley/thus | 24 | 12793326 | <filename>ds-sdk-mini/DeepSecurity/antimalware.py
# Copyright (c) 2020. <NAME>. All Rights Reserved.
#import connect
#import config
class Antimalware:
def __init__(self, config, connection):
self._config=config
self._connection = connection
##Antimalware config
def list(self):
retu... | 2.390625 | 2 |
setup.py | espdev/scikit-curve | 3 | 12793327 | <filename>setup.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import pathlib
from setuptools import setup, find_packages
ROOT_DIR = pathlib.Path(__file__).parent
ROOT_PKG = 'skcurve'
def get_version():
version_info = {}
version_file = ROOT_DIR / ROOT_PKG / '_version.py'
with version_file.open() as f:
... | 1.554688 | 2 |
config.py | Utekhin/cats_bot | 0 | 12793328 | <gh_stars>0
# Api key for developers giphy api
GIPHY_API_KEY = '<KEY>'
#
BOT_API_TOKEN = '<KEY>'
# Text blocks
WELCOME_TEXT = "Hi there!\nI'm catlover bot\nUse buttons or type anything to get your cats"
RENDER_TEXT = "Input your text to place it over random cat pic for your gif"
RENDER_TEXT_WAIT = 'Wait while the ca... | 2.234375 | 2 |
impute/decomposition/tests/conftest.py | nimily/low-rank-impute | 0 | 12793329 | <filename>impute/decomposition/tests/conftest.py
import numpy as np
import numpy.linalg as npl
import numpy.random as npr
import pytest
@pytest.fixture(params=[
(1, 50, 40, 2),
(2, 90, 100, 5),
(3, 1500, 1000, 10),
], name='low_rank_matrix')
def low_rank_matrix_fixture(request):
seed, n, m, r = reque... | 2.046875 | 2 |
paginator/paginators.py | pydanny/dj-paginator | 30 | 12793330 | from django.conf import settings
DEFAULT_WINDOW = getattr(settings, 'PAGINATOR_DEFAULT_WINDOW', 4)
def paginate(context, window=DEFAULT_WINDOW, hashtag=''):
"""
Renders the ``pagination/pagination.html`` template, resulting in a
Digg-like display of the available pages, given the current page. If there
... | 3.15625 | 3 |
aux/backend.py | bischjer/auxiliary | 0 | 12793331 | from twisted.internet import reactor, threads
import threading
import functools
import aux.protocol as protocol_module
class Backend(object):
def __init__(self):
self.thread = None
self.reactor = reactor
self.event = threading.Event()
self.protocols = protocols_module
def star... | 2.59375 | 3 |
PyNeuralNetwork/PyNet/old/LoadNetwork.py | mattkjames7/PyNeuralNetwork | 0 | 12793332 | <filename>PyNeuralNetwork/PyNet/old/LoadNetwork.py
import numpy as np
import os
from .NeuralNetwork import NeuralNetwork
def LoadNetwork(FileName):
if os.path.isfile(FileName) == False:
print('file not found')
return None
f = open(FileName,'rb')
Trained = np.fromfile(f,dtype='bool8',count=1)[0]
L = np.fromfile... | 2.4375 | 2 |
python/models/apps.py | thejoeejoee/UPA-MIT-VUT-2020-2021 | 0 | 12793333 | from django.apps import AppConfig
class ModelsAppConfig(AppConfig):
name = 'models'
__all__ = ['ModelsAppConfig']
| 1.367188 | 1 |
scripts/numerics/test_fixedpoint_1D.py | jhwnkim/nanopores | 8 | 12793334 | <reponame>jhwnkim/nanopores<gh_stars>1-10
"""test (linearized) Scharfetter-Gummel-inspired fixed point PNP.
surprising conclusion: linearized is more robust numerically,
probably due to the exponential terms in nonlinear version.
for small applied voltage (bV=-0.1), both versions almost coincide.
the linear version c... | 2.109375 | 2 |
examples/select.py | dduong42/gzuro | 0 | 12793335 | <reponame>dduong42/gzuro
from gzuro import Grid, SelectList, Text
root = Grid(cols=2)
select_list = SelectList(choices=['blue', 'black', 'grey'], default='blue')
text = Text('Selected: blue')
root.append(select_list)
root.append(text)
@select_list.on_selection
def change_text():
text.content = f'Selected: {select... | 2.765625 | 3 |
lunr/storage/helper/utils/jobs.py | PythonGirlSam/lunr | 6 | 12793336 | # Copyright (c) 2011-2016 Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 1.976563 | 2 |
Codewars/7kyu/form-the-largest/Python/solution1.py | RevansChen/online-judge | 7 | 12793337 | # Python - 3.6.0
max_number = lambda n: int(''.join(sorted(str(n), reverse = True)))
| 2.796875 | 3 |
project/data/make_features.py | Sanger2000/Predicting-Lung-Cancer-Disease-Progression-from-CT-reports | 0 | 12793338 | <reponame>Sanger2000/Predicting-Lung-Cancer-Disease-Progression-from-CT-reports
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
import project.data.preprocess_data as preprocess
import torch
from sklearn.preprocessing import LabelEncoder
from pytorch_pretrained_bert im... | 2.765625 | 3 |
datetoken/objects.py | sonirico/datetoken | 5 | 12793339 | <filename>datetoken/objects.py
from functools import reduce
from .ast import get_utc_now
from .ast import NowExpression, ModifierExpression, SnapExpression
class Token(object):
def __init__(self, nodes=None, at=None):
self._at = at
if not nodes:
self._nodes = [NowExpression()]
... | 2.875 | 3 |
stack/eb.py | engineervix/aws-web-stacks | 83 | 12793340 | <filename>stack/eb.py
from awacs import ecr
from awacs.aws import Allow, Policy, Principal, Statement
from awacs.sts import AssumeRole
from troposphere import FindInMap, GetAtt, Join, Output, Ref, iam
from troposphere.elasticbeanstalk import (
Application,
Environment,
OptionSettings
)
from troposphere.iam ... | 2.09375 | 2 |
hypertrack/tests/tests.py | hypertrack/hypertrack-python | 9 | 12793341 | <filename>hypertrack/tests/tests.py
import os
import unittest
from hypertrack.rest import Client
from hypertrack.exceptions import HyperTrackException
DEVICE_ID = os.getenv("HT_EXISTING_DEVICE_ID")
ACCOUNT_ID = os.getenv("HT_ACCOUNT_ID")
SECRET_KEY = os.getenv("HT_SECRET_KEY")
hypertrack = Client(ACCOUNT_ID, SECRET_K... | 2.484375 | 2 |
removepii.py | p-zach/Remove-PII | 1 | 12793342 | # Author: <NAME>
# Python 3.9
import argparse
import nltk
import re
import os
import pathlib
def extract(filePath):
"""Extracts the textual information from a file.
Args:
filePath (str): The path to the file to extract text from.
Raises:
ValueError: If the information could not be extrac... | 3.3125 | 3 |
tests/test_flask_cdn.py | local-projects/flask-cdn | 0 | 12793343 | <reponame>local-projects/flask-cdn
import unittest
import os
from flask import Flask, render_template_string
from flask.ext.cdn import CDN
class DefaultsTest(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
self.app.testing = True
CDN(self.app)
def test_domain_defaul... | 2.6875 | 3 |
experiments/generator.py | usc-sail/mica-violence-ratings-predictions-from-movie-scripts | 3 | 12793344 | <filename>experiments/generator.py
import os
import threading
from random import Random
from glob import iglob as glob
from keras.utils import Sequence
class Generator(Sequence):
def __init__(self, batch_dir, feat_func, shuffle = True, shuffler = Random(42)):
self.batch_dir = batch_dir
self.shuffle... | 2.578125 | 3 |
FirebaseManager.py | ksolanoj/GenderAge-Recognition | 0 | 12793345 | import pyrebase
import time
from FaceRecognitionManager import *
firebaseConfig = {
"apiKey": "<KEY>",
"authDomain": "iaproject-29018.firebaseapp.com",
"projectId": "iaproject-29018",
"storageBucket": "iaproject-29018.appspot.com",
"messagingSenderId": "817053540910",
"appId": "1:817053540910:w... | 2.4375 | 2 |
tests/core/test_base_types.py | balancap/arrowbic | 4 | 12793346 | <reponame>balancap/arrowbic
import numpy as np
import pyarrow as pa
import pytest
import arrowbic.extensions
from arrowbic.core.base_types import (
from_arrow_to_numpy_dtype,
from_arrow_to_python_class,
from_numpy_to_arrow_type,
is_supported_base_type,
)
def test__is_supported_base_type__proper_resul... | 2.28125 | 2 |
gallery/migrations/0008_shopitem.py | jeffykle/kf-public | 0 | 12793347 | <filename>gallery/migrations/0008_shopitem.py
# Generated by Django 3.1 on 2020-09-06 15:37
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gallery', '0007_auto_20200905_1239'),
]
operations = [
migrations.CreateModel(
name='ShopIte... | 1.40625 | 1 |
metadata-ingestion/src/datahub/metadata/com/linkedin/pegasus2avro/timeseries/__init__.py | zhoxie-cisco/datahub | 1 | 12793348 | # flake8: noqa
# This file is autogenerated by /metadata-ingestion/scripts/avro_codegen.py
# Do not modify manually!
# fmt: off
from .....schema_classes import CalendarIntervalClass
from .....schema_classes import PartitionSpecClass
from .....schema_classes import TimeWindowClass
from .....schema_classes import TimeW... | 1.414063 | 1 |
hnn_core/parallel_backends.py | chenghuzi/hnn-core | 0 | 12793349 | """Parallel backends"""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
import os
import sys
import re
import multiprocessing
import shlex
import pickle
import base64
from warnings import warn
from subprocess import Popen, PIPE, TimeoutExpired
import binascii
from queue import Queue, Empty
from threading impo... | 2.15625 | 2 |
Platforms/Web/Processing/Api/Discord/Commands/main.py | HeapUnderfl0w/Phaazebot | 0 | 12793350 | from typing import TYPE_CHECKING
if TYPE_CHECKING:
from Platforms.Discord.main_discord import PhaazebotDiscord
from Platforms.Web.index import WebIndex
from aiohttp.web import Response, Request
from .get import apiDiscordCommandsGet
from .create import apiDiscordCommandsCreate
from .list import apiDiscordCommandsLis... | 2.59375 | 3 |