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 | Pooya448/leap | 55 | 12780951 | <gh_stars>10-100
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from torch.utils.cpp_extension import BuildExtension
import numpy
# Get the numpy include directory.
numpy_include_dir = numpy.get... | 1.445313 | 1 |
srcT/DataStruct/PrepDeepFix.py | elishatofunmi/macer | 7 | 12780952 | <filename>srcT/DataStruct/PrepDeepFix.py
import pandas as pd
from srcT.Common import ConfigFile as CF
def addDummyCols(cols):
df = pd.read_csv(CF.fnameDeepFix_Test, encoding="ISO-8859-1")
if 'id' not in df.columns:
df['id'] = df['code_id']
del df['code_id']
if 'sourceText' not in df.colum... | 2.96875 | 3 |
PycharmProjects/pythonexercicios/aula015/ex068.py | zmixtv1/cev-Python | 0 | 12780953 | from random import randint
cont = 0
while True:
valor = int(input("Digite um valor: "))
conputador = randint(0, 10)
total = conputador + valor
tipo = " "
while tipo not in "PI":
tipo = str(input("Par ou Impar [P/I]")).strip().upper()[0]
print(f"você jogou {valor} e o computador {conputad... | 3.71875 | 4 |
2018/spacy/def.py | sematext/activate | 11 | 12780954 | <reponame>sematext/activate<gh_stars>10-100
from __future__ import unicode_literals
import spacy
nlp = spacy.load('en_core_web_sm')
print("")
print("Doc 10, title: '#bbuzz: Radu Gheorghe JSON Logging with Elasticsearch'")
print("-----")
doc = nlp(u"#bbuzz: Radu Gheorghe JSON Logging with Elasticsearch")
for entity in... | 2.265625 | 2 |
ship.py | camargo-advanced/blasteroidspi | 0 | 12780955 | from pygame.locals import *
from blast import Blast
from sound import Sound
from wentity import WEntity
from pygame.math import Vector2
from utils import *
WIDTH = 3 # line thickness
SCALE_FACTOR = 5.0
ACCELERATION = 250.0 # pixels per second
DAMPING = 0.57 # some damping
ANGULAR_SPEED = 180.0 # degrees per secon... | 2.984375 | 3 |
messenger/admin.py | lucida-no/hdo-quiz-service | 0 | 12780956 | from django.contrib import admin
from messenger.models import ChatSession
class ChatSessionAdmin(admin.ModelAdmin):
readonly_fields = ['uuid', 'user_id']
list_display = ['uuid', 'state', 'user_id']
list_filter = ['state']
admin.site.register(ChatSession, ChatSessionAdmin)
| 1.703125 | 2 |
src/trw/datasets/cityscapes.py | civodlu/trw | 3 | 12780957 | from typing import Optional, List
import torch
import torchvision
import numpy as np
from ..basic_typing import Datasets
from ..train import SequenceArray
from ..train import SamplerRandom, SamplerSequential
import functools
import collections
import os
from ..transforms import Transform
from typing_extensions import... | 2.65625 | 3 |
examples/rtsp_pyqt/client.py | Adancurusul/MaixPy3 | 93 | 12780958 | import socket
from threading import Thread
from typing import Union, Optional, List, Tuple
from time import sleep
from PIL import Image
from io import BytesIO
import re
from typing import Optional
class InvalidRTSPRequest(Exception):
pass
class RTSPPacket:
RTSP_VERSION = 'RTSP/1.0'
INVALID = -1
SE... | 2.6875 | 3 |
igtagger/atomic_sentences.py | institutional-grammar-pl/ig-tagger | 0 | 12780959 | import re
import spacy
spacy_model_name = 'en_core_web_lg'
if not spacy.util.is_package(spacy_model_name):
spacy.cli.download(spacy_model_name)
nlp = spacy.load(spacy_model_name)
def filter_sentence(sentence):
def sentence_length(s, min_len=8):
if len(s) < min_len:
return False
e... | 2.71875 | 3 |
lib/python/treadmill/tests/syscall/__init__.py | vrautela/treadmill | 133 | 12780960 | <reponame>vrautela/treadmill
"""Tests for treadmill's linux direct system call interface."""
| 0.886719 | 1 |
halotools/utils/__init__.py | aphearin/halotools | 0 | 12780961 | <reponame>aphearin/halotools
r""" This module contains helper functions used throughout the Halotools package.
"""
from __future__ import division, print_function, absolute_import, unicode_literals
from .spherical_geometry import *
from .array_utils import *
from .io_utils import *
from .table_utils import *
from .val... | 1.109375 | 1 |
section2/src/run_ml_pipeline.py | felixglush/HippocampalVolumeSegmentation | 0 | 12780962 | """
This file contains code that will kick off training and testing processes
"""
import os, sys
import argparse
import json
import numpy as np
from experiments.UNetExperiment import UNetExperiment
from data_prep.HippocampusDatasetLoader import LoadHippocampusData
from torch.utils.data import random_split
class Config... | 2.640625 | 3 |
chrome/test/install_test/theme_updater.py | nagineni/chromium-crosswalk | 2 | 12780963 | <filename>chrome/test/install_test/theme_updater.py
# Copyright (c) 2012 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.
"""Update tests for themes."""
import os
import sys
_DIRECTORY = os.path.dirname(os.path.abspath(__f... | 2.171875 | 2 |
manager.py | ostapkharysh/Stock-return-predictability | 2 | 12780964 | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, Session
from sqlalchemy.exc import IntegrityError, InvalidRequestError
from db_management.DB import Base, Company, News, db_link
def add_company(company):
engine = create_engine(db_link) # pool_size=20, max_overflow=0
# Bind the e... | 2.921875 | 3 |
tests/test_deck.py | House-Rulez/black_jack | 0 | 12780965 | <filename>tests/test_deck.py<gh_stars>0
# https://stackoverflow.com/questions/10253826/path-issue-with-pytest-importerror-no-module-named-yadayadayada
import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../scripts/deck/')
sys.path.insert(1, myPath + '/../scripts/dealer/')
sy... | 2.84375 | 3 |
userbot/modules/degi_nehi.py | PratikGoswamiPM/OUB-Remix | 1 | 12780966 | #"""Fun pligon...for HardcoreUserbot
#\nCode by @Hack12R
#type `.degi` and `.nehi` to see the fun.
#"""
import random, re
#from uniborg.util import admin_cmd
import asyncio
from telethon import events
from userbot.events import register
from asyncio import sleep
import time
from userbot import CMD_HELP
@register(outgo... | 2.234375 | 2 |
app/telegram/commands/debug.py | unimarijo/vkmessages | 0 | 12780967 | # -*- coding: utf-8 -*-
from app import logging
from app import config as config
import logging
def debug(client, message):
try:
client.send_message(
message.from_user.id,
"Ниже находится информация, которая может оказаться полезной."
"\n\n**Информация о приложении:** ... | 2.171875 | 2 |
src/model_params.py | madhu121/Image-Driven-Machine-Learning-Approach-for-Microstructure-Classification-and-Segmentation-Ti-6Al-4V | 0 | 12780968 | <reponame>madhu121/Image-Driven-Machine-Learning-Approach-for-Microstructure-Classification-and-Segmentation-Ti-6Al-4V
width=200
height=200
total_size = 1000
train_size = 800
validation_size = 100
test_size = total_size - train_size - validation_size
| 1.648438 | 2 |
tests/test_k8sobject.py | projectsyn/commodore | 39 | 12780969 | import pytest
from commodore import k8sobject
_test_objs = [
{
"apiVersion": "v1",
"kind": "ServiceAccount",
"metadata": {
"name": "test",
"namespace": "test",
},
},
{
"apiVersion": "v1",
"kind": "ServiceAccount",
"metadata": ... | 1.953125 | 2 |
python/helpers/profiler/prof_util.py | teddywest32/intellij-community | 0 | 12780970 | __author__ = 'traff'
import threading
import os
import sys
import tempfile
from _prof_imports import Stats, FuncStat, Function
try:
execfile=execfile #Not in Py3k
except NameError:
#We must redefine it in Py3k if it's not already there
def execfile(file, glob=None, loc=None):
if glob is None:
... | 2.015625 | 2 |
migrations/20211128_01_Mn7Ng-create-holdem-game-record-table.py | zw-g/Funny-Nation | 126 | 12780971 | """
Create holdem game record table
"""
from yoyo import step
__depends__ = {'20211109_01_xKblp-change-comments-on-black-jack-record'}
steps = [
step("CREATE TABLE `holdemGameRecord` ( `userID` BIGINT NOT NULL , `moneyInvested` BIGINT NOT NULL , `status` INT NOT NULL COMMENT '0 represent in progress; 1 represent... | 1.828125 | 2 |
django/contrib/gis/geos/io.py | huicheese/Django-test3 | 2 | 12780972 | """
Module that holds classes for performing I/O operations on GEOS geometry
objects. Specifically, this has Python implementations of WKB/WKT
reader and writer classes.
"""
from ctypes import byref, c_size_t
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.error import GEOSException
from... | 2.234375 | 2 |
admin/urls.py | asifhaider/BookKeep | 1 | 12780973 | from django.urls import path
from admin import views
urlpatterns = [
path('manage/', views.AdminPanel.as_view(), name = 'admin-panel'),
path('manage/customer-list/', views.AdminCustomerListView.as_view(), name = 'admin-customer-list-view'),
path('manage/book-list/', views.AdminBookListView.as_view(),... | 1.84375 | 2 |
cart_pole/cart_pole.py | jeongyoonlee/gym_example | 0 | 12780974 | <reponame>jeongyoonlee/gym_example<gh_stars>0
import gym
from time import sleep
from const import ENV_NAME
with gym.make(ENV_NAME) as env:
action_space = env.action_space
def run(pi, n_episode=1):
with gym.make(ENV_NAME) as env:
for i_episode in range(n_episode):
state = env.reset()
... | 3.171875 | 3 |
src/test.py | tclements/CS249FINAL | 0 | 12780975 | <reponame>tclements/CS249FINAL<gh_stars>0
import glob, os
import tensorflow as tf
import tensorflow.keras as keras
import numpy as np
import matplotlib.pyplot as plt
import sklearn.metrics
def test2input(A,input_dir):
'Convert test data to cc/header file'
# files to write
cc_file = os.path.join(input... | 2.34375 | 2 |
Python/236.py | JWang169/LintCodeJava | 1 | 12780976 | <reponame>JWang169/LintCodeJava
# April 14
class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
self.lca = None
self.dfs(root, p, q)
return self.lca
def dfs(self, root, p, q):
if not root:
return False... | 3.375 | 3 |
src/data/yt_data_scrapping.py | love-bits/site | 2 | 12780977 | <gh_stars>1-10
import re
import json
import pytz
import pandas as pd
from bs4 import BeautifulSoup as soup
from urllib.request import urlopen as uReq
from datetime import datetime, timezone, timedelta
def getBSHtml(url):
uClient = uReq(url)
page_html = uClient.read()
uClient.close()
page_so... | 2.78125 | 3 |
courses/migrations/0032_add_course_edx_key.py | Wassaf-Shahzad/micromasters | 32 | 12780978 | <reponame>Wassaf-Shahzad/micromasters
# Generated by Django 2.1.10 on 2019-08-15 18:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0031_electives_set_releated_name'),
]
operations = [
migrations.AddField(
mode... | 1.609375 | 2 |
tekis/board/migrations/0002_auto_20160221_1643.py | TKOaly/tkoaly-new-service | 0 | 12780979 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-21 14:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('board', '0001_initial'),
]
operations = [
migrations.AlterModelO... | 1.632813 | 2 |
pymerge.py | l0o0/bio-analysis-kit | 3 | 12780980 | <gh_stars>1-10
#!/usr/bin/python
# create by linxzh at 2014-8-19
import argparse
import re
import sys
parser = argparse.ArgumentParser('pymerge')
parser.add_argument('-A', type=argparse.FileType('r'))
parser.add_argument('-B', type=argparse.FileType('r'))
parser.add_argument('-Aby', type=int, default=1,
help... | 2.828125 | 3 |
hcap_geo/models/__init__.py | fabiommendes/capacidade_hospitalar | 0 | 12780981 | from .region import Region
| 1.101563 | 1 |
basic/module/custom/createModule/importModuleDemo.py | gwaysoft/python | 0 | 12780982 | <gh_stars>0
import sys
import createModuleDemo as mo, os
from createModuleDemo01 import add as a
from createModuleDemo02 import *
# import default path
print(sys.path)
print(mo.add(3, 4.555))
print(a(30, 4))
print(add(34, 4))
# show method
print(dir()) | 2.015625 | 2 |
server/kvls/lang.py | Antyos/kvlang-vscode | 10 | 12780983 | <reponame>Antyos/kvlang-vscode
"""Module import kivy Parser is available. Otherwise fake class is created."""
from __future__ import absolute_import
import os
# Disable stdout printout from kivy
os.environ["KIVY_NO_FILELOG"] = "1"
os.environ["KIVY_NO_CONSOLELOG"] = "1"
# Import Kivy parser
# Disable pylint warning, bec... | 2.40625 | 2 |
calliope_app/api/migrations/0010_auto_20190730_1726.py | jmorrisnrel/engage | 3 | 12780984 | # Generated by Django 2.1.4 on 2019-07-30 17:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0009_auto_20190710_2235'),
]
operations = [
migrations.RemoveField(
model_name='carrier',
name='model',
),
... | 1.398438 | 1 |
code/python/src/utility/logger.py | manurare/360monodepth | 0 | 12780985 | import logging
import traceback
import colorama
from colorama import Fore, Back, Style
colorama.init()
class CustomFormatter(logging.Formatter):
"""Logging Formatter to add colors and count warning / errors
reference: https://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output/
"""
... | 3.171875 | 3 |
tests/apimodels/UserResource_test.py | j-000/ezresbackend | 0 | 12780986 | import requests
from . import UserModel, db, DEVELOPMENT
base_url = 'http://localhost:5000/api/user'
if not DEVELOPMENT:
raise SystemError('Not in development mode!')
exit()
def prepare_db():
db.drop_all()
db.create_all()
test_email = UserModel.fetch(email='<EMAIL>')
if test_email:
UserModel.delete... | 2.59375 | 3 |
The improved SMDS.py | 0AnonymousSite0/Social-media-data-to-Interrelated-informtion-to-Parameters-of-virtual-road-model | 1 | 12780987 |
import tweepy
import re
import os, logging, datetime, argparse
from logging.handlers import RotatingFileHandler
import json
from prepare_data_for_labeling_infer import prepare_data_for_subject_object_labeling_infer
from produce_submit_json_file import Sorted_relation_and_entity_list_Management
from DataInteroperabil... | 2.265625 | 2 |
packages/weevely/modules/sql/dump.py | ZooAtmosphereGroup/HelloPackages | 0 | 12780988 | <reponame>ZooAtmosphereGroup/HelloPackages
from core.vectors import PhpFile, ShellCmd
from core.module import Module
from core.loggers import log
from core import messages
import tempfile
import os
class Dump(Module):
"""Multi dbms mysqldump replacement."""
def init(self):
self.register_info(
... | 2.265625 | 2 |
MindLink-Eumpy/test/xmlAnalyzer.py | Breeze1in1drizzle/MindLink-Exploring | 7 | 12780989 | <reponame>Breeze1in1drizzle/MindLink-Exploring
'''
XML文件接卸
最初用于提取valence和arousal的值
'''
import xml.dom.minidom
def read_xml(filepath):
dom = xml.dom.minidom.parse(filepath)
session = dom.documentElement
arousal = float(session.getAttribute("feltArsl"))
print("arousal: ", arousal, " (type: ", type(ar... | 3.078125 | 3 |
datasets/coco_merger.py | scheckmedia/centernet-uda | 19 | 12780990 | <reponame>scheckmedia/centernet-uda<filename>datasets/coco_merger.py
import logging
import numpy as np
import hydra
from torch.utils import data
log = logging.getLogger(__name__)
class Dataset(data.Dataset):
def __init__(self, datasets, max_samples=None, **defaults):
self.max_sampels = max_samples
... | 2.15625 | 2 |
specify/result.py | Einenlum/spyec | 0 | 12780991 | <gh_stars>0
from typing import List
class ResultLine:
'''
A result is made of several result lines
'''
def __init__(self, spec_class, test_name, exception=None):
'''
Take the spec_class (object_behavior), the test name (it_…),
and the exception if any
'''
self.sp... | 3.328125 | 3 |
progSnips/boundingBox/openCam.py | PhilTKamp/SDMinesLabDisplay | 0 | 12780992 | from cb import drawBox
import cb
import cv2
import numpy as np
def dynamicColorMask():
# Begins reading from the default webcam
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
cv2.namedWindow('Feed')
cv2.setMouseCallback('Feed', drawBox)
while(1):
# Reads the next frame from the camera
ret, frame = c... | 2.8125 | 3 |
show_parametrization_map.py | luca-morreale/neural_surface_maps | 36 | 12780993 |
import torch
from models import SurfaceMapModel
from models import InterMapModel
from utils import show_mesh
from utils import show_mesh_2D
SURFACE_PATH = '/SET/HERE/YOUR/PATH'
CHECKPOINT_PATH = '/SET/HERE/YOUR/PATH'
def main() -> None:
torch.set_grad_enabled(False)
device = torch.device('cuda:0' if... | 2.296875 | 2 |
Scraper/templatetags/tags.py | FadedCoder/AnimeScraperGUI | 3 | 12780994 | <filename>Scraper/templatetags/tags.py
from django import template
APP_NAME = "Anime Scraper"
register = template.Library()
@register.simple_tag
def app_name(request):
return APP_NAME
@register.assignment_tag(takes_context=False)
def user_logged_in(request):
if request.user.is_authenticated:
retur... | 2.484375 | 2 |
model.py | rahulrajeev21/PointNet | 0 | 12780995 | from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
class TNet(nn.Module):
def __init__(self, k=64):
super(TNet, self).__init__()
self.k = k
... | 2.734375 | 3 |
cgat/tools/bam2depth.py | cgat-developers/cgat-apps | 19 | 12780996 | '''output depth statistics for a BAM file.
'''
import collections
import subprocess
import re
import os
import shlex
import cgatcore.experiment as E
import cgatcore.iotools as iotools
def main(argv=None):
"""script main.
parses command line options in sys.argv, unless *argv* is given.
"""
if not a... | 2.375 | 2 |
presqt/api_v1/utilities/validation/get_process_info_data.py | craig-willis/presqt | 0 | 12780997 | <gh_stars>0
from rest_framework import status
from presqt.utilities import read_file
from presqt.utilities import PresQTValidationError
def get_process_info_data(action, ticket_number):
"""
Get the JSON from process_info.json in the requested ticket number directory.
Parameters
----------
action... | 2.5 | 2 |
simple_monitor_alert/tests/base.py | Nekmo/simple-monitor-alert | 33 | 12780998 | import os
import sys
from configparser import NoSectionError
from simple_monitor_alert.alerts import Alerts
from simple_monitor_alert.lines import Observable, ItemLine
from simple_monitor_alert.monitor import Monitors
from simple_monitor_alert.sma import Results, Config, MonitorsInfo
from simple_monitor_alert.utils.fi... | 2.34375 | 2 |
command_safe/safe.py | omar-ozgur/Command-Safe | 0 | 12780999 | import click
import pickle
from subprocess import call
class Safe:
update = False
def __init__(self, safe_file):
self.safe_file = safe_file
def load(self):
try:
with open(self.safe_file, 'rb') as input:
try:
self.safe = pickle.load(input)
except EOFError:
self.safe = {}
except IOError:
... | 3.015625 | 3 |
scripts/setup_demo.py | ki-tools/kitools-py | 4 | 12781000 | #!/usr/bin/env python3
import argparse
import sys
import os
import uuid
import tempfile
import random
import synapseclient as syn
script_dir = os.path.dirname(__file__)
sys.path.append(os.path.join(script_dir, '..', 'src'))
try:
from kitools import KiProject, DataUri, SysPath, DataTypeTemplate
except Exception a... | 1.976563 | 2 |
rtamt/spec/io_stl_ct/offline.py | BentleyJOakes/rtamt | 0 | 12781001 | <gh_stars>0
import operator
from rtamt.spec.stl_ct.offline import STLCTOffline
from rtamt.spec.io_stl.io_interpretation import IOInterpretation
class STLIOCTOffline(STLCTOffline):
def __init__(self, spec):
super(STLIOCTOffline, self).__init__(spec)
def visitPredicate(self, element, args):
out... | 2.078125 | 2 |
TASSELpy/net/maizegenetics/dna/snp/CoreGenotypeTable.py | er432/TASSELpy | 1 | 12781002 | from TASSELpy.net.maizegenetics.dna.snp.GenotypeTable import GenotypeTable
from TASSELpy.utils.helper import make_sig
from TASSELpy.utils.Overloading import javaConstructorOverload
import javabridge
## Dictionary to hold java imports
java_imports = {'AlleleDepth':'net/maizegenetics/dna/snp/depth/AlleleDepth',
... | 2.265625 | 2 |
drfxios/context_processors.py | milano-slesarik/django-drfxios | 2 | 12781003 | import json
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import import_string
def drfxios(request):
DRFXIOS_ROUTER_PATH = getattr(settings, 'DRFXIOS_ROUTER_PATH', None)
if not DRFXIOS_ROUTER_PATH:
raise ImproperlyConfigured(... | 2.15625 | 2 |
build-support/editor_setup.py | msilvey/grapl | 0 | 12781004 | #!/usr/bin/env python3
"""Encapsulates logic for generating and updating editor
configuration files to make it easy to work with Grapl code.
Provided as a self-documenting Click app for discoverability and ease
of maintenance.
"""
import json
from typing import Dict, List, Union
import click
import toml
from typin... | 1.953125 | 2 |
monasca_analytics/spark/driver.py | daisuke-fujita/monsaca-analytics_20181107 | 1 | 12781005 | #!/usr/bin/env python
# Copyright (c) 2016 Hewlett Packard Enterprise Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | 2.09375 | 2 |
fw-rde/mnist/rde_new.py | morgankohler/FrankWolfe.jl | 0 | 12781006 | import os
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import tensorflow.keras.backend as K
from models import load_model, load_adfmodel
import instances
# GENERAL PARAMETERS
MODE = 'joint_untargeted'
IMG_SHAPE = [28, 28]
# LOAD MODEL
model = load_model()
generator = instances.load_gen... | 2.15625 | 2 |
12_find the output/03_In Python/01_GeeksForGeeks/02_Set two/problem_3.py | Magdyedwar1996/python-level-one-codes | 1 | 12781007 | values = [1, 2, 3, 4,5,6]
numbers = set(values)
def checknums(num):
if num in numbers:
return True
else:
return False
for i in filter(checknums, values):
print(i)
| 3.84375 | 4 |
src/minerl/herobraine/hero/handlers/actionable.py | imatge-upc/pixelcoordEDL | 1 | 12781008 | from abc import ABC, abstractmethod
import gym
import numpy as np
from minerl.herobraine.hero import AgentHandler
from minerl.herobraine.hero import KEYMAP
from minerl.herobraine.hero import spaces
from minerl.herobraine.hero.spaces import DiscreteRange
class CommandAction(AgentHandler):
"""
An action handl... | 2.71875 | 3 |
PulseView_C2_decoder/c2/__init__.py | debug-silicon/C8051F34x_Glitch | 34 | 12781009 | '''
This is a decoder for SiLabs C2 debug protocol.
'''
from .pd import Decoder
| 0.945313 | 1 |
backend/core/urls.py | open-contracting/pelican-frontend | 0 | 12781010 | <filename>backend/core/urls.py
from django.urls import include, path
urlpatterns = [
path("", include("dqt.urls"), name="api"),
path("datasets/", include("controller.urls"), name="controller"),
path("", include("exporter.urls"), name="exporter"),
]
| 1.765625 | 2 |
test/crop_image_partial.py | mskim99/Pix2Vox_modify | 0 | 12781011 | <gh_stars>0
import cv2
import numpy as np
f_index = 6
m_index = 57
c_index = 276
s_index = 298
a_index = 1010
c_x = 136
c_y = 720
s_x = 116
s_y = 692
a_x = 132
a_y = 134
resolution = 256
'''
c_img = cv2.imread('I:/DK_Data_Process/i_1-2_Slices/f_' + str(f_index).zfill(3) + '/coronal/f_' + str(f_index).zfill(3) + '... | 2.171875 | 2 |
tests/settings.py | hadizakialqattan/simple-api | 0 | 12781012 | from app import crud, database, schemas
from .IO import URLs
def create_users():
"""
create test users:
- username: admin, password: <PASSWORD>, isadmin: "true"
- username: user2, password: <PASSWORD>, isadmin: "false"
"""
if not crud.get_user(
db=database.SessionLocal(), use... | 2.703125 | 3 |
minydra/__init__.py | pg2455/minydra | 0 | 12781013 | from .parser import Parser
__version__ = "0.1.2"
def parse_args(
verbose=0,
allow_overwrites=True,
warn_overwrites=True,
parse_env=True,
warn_env=True,
):
def decorator(function):
def wrapper(*args, **kwargs):
parser = Parser(
verbose=verbose,
... | 3.078125 | 3 |
but/trades/views/goods_modify.py | yevgnenll/but | 4 | 12781014 | <reponame>yevgnenll/but
from django.views.generic.edit import UpdateView
from django.contrib.auth.mixins import LoginRequiredMixin
from trades.models import Sell
from .base import GoodsSellBase
class SellUpdateView(LoginRequiredMixin, GoodsSellBase, UpdateView):
fields = [
'title',
'sub_title',
... | 1.882813 | 2 |
Algorithms/exponent.py | Sinchiguano/codingProblems_Python | 2 | 12781015 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 <NAME> <<EMAIL>>
#
# Distributed under terms of the BSD license.
"""
"""
#We've started a recursive function below called
#exponent_calc(). It takes in two integer parameters, base
#and expo. It should return the mathematical answer ... | 4.625 | 5 |
scytale/crypto/rsa.py | MarcoYLyu/scytale | 0 | 12781016 | <reponame>MarcoYLyu/scytale<gh_stars>0
from .. import algorithm as algo
from .pkc_template import PKC
import numpy as np
__all__ = ['RSA']
class RSA(PKC):
def __init__(self, e, p, q):
assert(algo.gcd(e, (p - 1) * (q - 1)) == 1)
self.e = e
self.p = p
self.q = q
self.d = alg... | 2.75 | 3 |
CodingBat/Python/List-2/sum13.py | Togohogo1/pg | 0 | 12781017 | <filename>CodingBat/Python/List-2/sum13.py<gh_stars>0
'''
Return the sum of the numbers in the array, returning 0 for an empty array.
Except the number 13 is very unlucky, so it does not count and numbers that
come immediately after a 13 also do not count.
'''
def sum13(nums):
nums.append(0)
count = 0
for... | 3.953125 | 4 |
main_animal.py | ObamaBinHiding/den | 0 | 12781018 | #!/usr/bin/python3
#Classes for side project with Gabe
#Authors:
# <NAME> <<EMAIL>>
# ...
#imports needed
from random import randint
#classes
class Animal:
"""
This is the main animal class of the mini-game, all other animal classes come from this one
"""
def __init__(self):
#agility a... | 4.0625 | 4 |
contraste/examples/example.py | gmilare/ser-347 | 0 | 12781019 | #
# This file is part of Contraste.
# Copyright (C) 2021 INPE.
#
# Contraste is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
##Instalação do pacote gdal como pré-requisito do pacote
from osgeo import gdal
##instalação do... | 2.25 | 2 |
invenio_app_ils/records/resolver/jsonresolver/document_series.py | lauren-d/invenio-app-ils | 0 | 12781020 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2018-2019 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Resolve the referred Series for a Document."""
import jsonresolver
from invenio_pidstore.errors import PI... | 2.03125 | 2 |
nsd1804/python/day08/tcpclient.py | MrWangwf/nsd1806 | 0 | 12781021 | import socket
host = '192.168.4.254'
port = 12345
addr = (host, port) # 指定要连接的服务器
c = socket.socket()
c.connect(addr)
while True:
data = input('> ') + '\r\n'
data = data.encode()
c.send(data)
if data.strip() == b'quit':
break
rdata = c.recv(1024).decode() # 将bytes转成str类型
print(rdata, ... | 3.0625 | 3 |
python/lfmmexample.py | ejyoo921/FMM3D | 71 | 12781022 | #!/usr/bin/env python
import fmm3dpy as fmm
import numpy as np
#
# This is a sample code to demonstrate how to use
# the fmm libraries
#
# sample with one density, sources to sources,
# charge interactions, and potential only
#
n = 200000
nd = 1
sources = np.random.uniform(0,1,(3,n))
eps = 10**(-5)
charges = np.... | 1.992188 | 2 |
Project/data/game.py | Nikurkel/4InARow | 0 | 12781023 | <filename>Project/data/game.py<gh_stars>0
import random
import time
import threading
class Game:
def __init__(self, id):
self.id = id
self.wins = [0,0]
self.ready = False
self.nextPlayer = random.randint(1,2)
self.state = [([0]*7) for i in range(5)]
self.chat = ['2,T... | 3.21875 | 3 |
migrations/versions/50701261db54_.py | PaulloClara/Toilter | 0 | 12781024 | <reponame>PaulloClara/Toilter
"""empty message
Revision ID: 50701261db54
Revises:
Create Date: 2019-03-01 14:34:02.960151
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '50701261db54'
down_revision = None
branch_labels = None
depends_on = None
def upgrade()... | 1.882813 | 2 |
xeasy_ml/xes_ml_arch/src/tests/feature_enginnering_test/test_discretize.py | jiayanduo456/xeasy-ml | 10 | 12781025 | <reponame>jiayanduo456/xeasy-ml
# -*-coding:utf-8-*-
# @version: 0.0.1
# License: MIT
import unittest
import sys
import pandas as pd
import configparser
import copy
sys.path.append("../../../..")
from xes_ml_arch.src.feature_enginnering import feature_discretizer
class TestDiscretize(unittest.TestCase):
def se... | 2.265625 | 2 |
srcs/sg/objects/rational_number_object.py | pomponchik/computor_v2 | 0 | 12781026 | from srcs.sg.objects.abstract_object import AbstractObject
from srcs.errors import RuntimeASTError
class RationalNumberObject(AbstractObject):
type_mark = 'r'
def __init__(self, number, node):
self.number = int(number) if int(number) == number else number
self.node = node
self.is_rea... | 3.015625 | 3 |
pytest_cases/tests/cases/legacy/intermediate/test_shared_cases.py | chinghwayu/python-pytest-cases | 0 | 12781027 | from ..example_code import super_function_i_want_to_test, super_function_i_want_to_test2
from pytest_cases import test_target, case_tags
try: # python 3.5+
from pytest_cases import CaseData
except ImportError:
pass
@test_target(super_function_i_want_to_test)
def case_for_function1():
# type: () -> CaseD... | 2.3125 | 2 |
examples/DecryptLoginExamples/crawlers/weibolottery/__init__.py | hedou/DecryptLogin | 0 | 12781028 | '''initialize'''
from .weibolottery import WeiboLottery | 0.980469 | 1 |
jupyter_docker/kernelspec.py | mariusvniekerk/jupyter_docker_kernel | 0 | 12781029 | """Tools for managing kernel specs"""
# Copyright (c) <NAME>
# Distributed under the terms of the Modified BSD License.
from jupyter_client.kernelspec import KernelSpec, KernelSpecManager
from traitlets import Unicode, List, Type
from traitlets.config import LoggingConfigurable
import os
class DockerKernelSpec(Kerne... | 2.265625 | 2 |
Utils/strings.py | furkankykc/AutomatedDocumentMailer | 0 | 12781030 | errors = {
'tr': {
'error': 'Hata!',
'authError': 'Email veya sifrenizi yanlış girdiniz',
'connectError': 'Smtp ayarlarını düzgün yaptığınızdan emin olunuz',
'senderRefused': 'Bu mail adresinin email gönderim limiti dolmustur',
'serverDisconnect': 'Server ile bağlantı kesildi... | 2.21875 | 2 |
uproot/interp/jagged.py | guiguem/uproot | 0 | 12781031 | #!/usr/bin/env python
# Copyright (c) 2017, DIANA-HEP
# 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 copyright notice, this
# list ... | 1.59375 | 2 |
tests/test_medieval_futhork.py | stscoundrel/riimut-py | 0 | 12781032 | <filename>tests/test_medieval_futhork.py
from src.riimut import medieval_futhork
def test_transforms_letters_to_runes():
content = "aábcdðeéfghiíjklmnoóǫpqrstuúvwxyýzåäæœöøþ "
expected = "ᛆᛆᛒᚴᚦᚦᚽᚽᚠᚵᚼᛁᛁᛁᚴᛚᛘᚿᚮᚮᚰᛕᚴᚱᛋᛏᚢᚢᚠᚠᛋᛦᛦᛋᚮᛅᛅᚯᚯᚯᚦ:"
result = medieval_futhork.letters_to_runes(content)
assert result == ... | 2.8125 | 3 |
mlds/my_dataset/my_dataset.py | Conchylicultor/mlds | 0 | 12781033 | <filename>mlds/my_dataset/my_dataset.py
"""MyDataset implementation."""
class MyDataset:
pass
| 1.195313 | 1 |
apps/admin/views/achievement.py | panla/kesousou | 1 | 12781034 | <reponame>panla/kesousou
from django.db.models import Q
from rest_framework import generics
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
from drf_yasg.utils import swagger_... | 2.015625 | 2 |
signatureanalyzer/plotting/_muts.py | getzlab/getzlab-SignatureAnalyzer | 5 | 12781035 | <gh_stars>1-10
import itertools
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import seaborn as sns
import pandas as pd
from typing import Union
import numpy as np
import re
import sys
from ..utils import compl, sbs_annotation_converter
from ..context import context96, context78, context83, co... | 2.28125 | 2 |
google/cloud/securitycenter/settings/v1beta1/securitycenter-settings-v1beta1-py/google/cloud/securitycenter/settings_v1beta1/services/security_center_settings_service/transports/__init__.py | googleapis/googleapis-gen | 7 | 12781036 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | 1.695313 | 2 |
deep_daze/deep_daze.py | asigalov61/deep-daze | 1 | 12781037 | import os
import signal
import subprocess
import sys
import random
from datetime import datetime
from pathlib import Path
from shutil import copy
import torch
import torch.nn.functional as F
from siren_pytorch import SirenNet, SirenWrapper
from torch import nn
from torch.cuda.amp import GradScaler, autocast
from torch... | 1.796875 | 2 |
tests/credentials/credentials.py | Acidburn0zzz/dfvfs | 1 | 12781038 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the credentials interface."""
from __future__ import unicode_literals
import unittest
from dfvfs.credentials import credentials
from tests import test_lib as shared_test_lib
class Credentials(shared_test_lib.BaseTestCase):
"""Tests the credentials inter... | 2.359375 | 2 |
xfeeds/parser/tasks.py | rubeon/django-xfeeds | 0 | 12781039 | import logging
import os
import ssl
import urllib.request
import feedparser
from datetime import datetime
from time import mktime, localtime
from pprint import pprint, pformat
from bs4 import BeautifulSoup as soup
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from ..models import Feed
from ..... | 2.46875 | 2 |
0657.GCBA-supermarket_sales.py | alphacastio/connectors-gcba | 1 | 12781040 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import requests
import pandas as pd
from lxml import etree
from bs4 import BeautifulSoup
import datetime
import io
import numpy as np
from alphacast import Alphacast
from dotenv import dotenv_values
API_KEY = dotenv_values(".env").get("API_KEY")
alphacast = Alphacast(A... | 3.015625 | 3 |
openmdao.gui/src/openmdao/gui/test/functional/files/model_vartree.py | swryan/OpenMDAO-Framework | 0 | 12781041 | """ This model is used by test_valueeditors to test expand/collapse on
the object and parameter panes.
"""
from openmdao.main.api import Component, Assembly, VariableTree
from openmdao.lib.datatypes.api import Float, Slot
class DumbVT3(VariableTree):
def __init__(self):
super(DumbVT3, self).__init__()
... | 1.992188 | 2 |
neural_network.py | amrkh97/Arabic-OCR-Using-Python | 1 | 12781042 | import numpy as np
import torch
import torch.nn.functional as F
import dataset_creator as DC
from torch import nn
from torch import optim
# import keras
def createNN(_inputSize):
input_size = _inputSize
hidden_sizes = [15,10] # 12 nodes in first hidden layer
output_size = 29 # Number of possible outputs
... | 2.78125 | 3 |
lib/models/__init__.py | simonwey/DecoupleNet | 0 | 12781043 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import divis... | 1.789063 | 2 |
1_stroop.py | kalenkovich/nengo_stroop | 0 | 12781044 |
# coding: utf-8
# In[1]:
import nengo
import nengo_spa as spa
import numpy as np
# In[2]:
from matplotlib import pyplot as plt
# In[3]:
#create semantic pointers
words = [ 'CAT', 'BLUE', 'RED']
colors = ['RED', 'BLUE']
fingers = ['INDEX', 'MIDDLE']
D = 16 #we reduced it from 32 cause of capacity of our com... | 2.5625 | 3 |
modules/fucking_dinner.py | CHCMATT/Code | 15 | 12781045 | import re
from util.hook import *
from util import web
uri = 'http://www.whatthefuckshouldimakefordinner.com'
re_mark = re.compile(r'<dt><a href="(.*?)" target="_blank">(.*?)</a></dt>')
@hook(cmds=['fucking_dinner', 'fd', 'dinner'], priority='low')
def dinner(code, input):
"""fd -- WHAT DO YOU WANT FOR FUCKING D... | 2.59375 | 3 |
chariot/transformer/text/lower_normalizer.py | Y-Kuro-u/chariot | 134 | 12781046 | <reponame>Y-Kuro-u/chariot<gh_stars>100-1000
from chariot.transformer.text.base import TextNormalizer
class LowerNormalizer(TextNormalizer):
def __init__(self, copy=True):
super().__init__(copy)
def apply(self, text):
return text.lower()
| 2.265625 | 2 |
edf/scripts/test.py | ktfm2/Kai_updates | 1 | 12781047 | <reponame>ktfm2/Kai_updates
import aa_py
import sys
sys.path.append('../py/')
import edf_py
import json
import numpy as np
import matplotlib.pyplot as plt
try:
import seaborn
except:
pass
with open('../config.json') as data_file:
data = json.load(data_file)
pot = aa_py.GalPot(str(data['potential']))
acts = aa_p... | 1.984375 | 2 |
project/apps/blog/tests/test_models.py | slaily/pypublisher | 0 | 12781048 | from django.test import SimpleTestCase
from project.apps.blog import models
class AuthorTest(SimpleTestCase):
def test_str_dunder(self):
author = models.Author(id=1)
author_dunder_str_format = '<Author: ID - {id}>'.format(id=author.id)
self.assertMultiLineEqual(
author.__str_... | 2.8125 | 3 |
openmdao.gui/src/openmdao/gui/test/functional/pageobjects/dataflow.py | swryan/OpenMDAO-Framework | 0 | 12781049 | <reponame>swryan/OpenMDAO-Framework
import logging
import time
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.common.exceptions import StaleElementReferenceException
from basepageobject import BasePageObject, TMO
from elements import GenericElement, ButtonElemen... | 2.0625 | 2 |
CCPD/lista-1/questao1.py | Dowsley/CESAR2 | 2 | 12781050 | from multiprocessing import Pool, cpu_count
import time
flatten = lambda t: [item for sublist in t for item in sublist]
def load_list(f):
pre_list = f.read().splitlines()
return [int(e) for e in pre_list]
def dump_list(f, num_list):
for i in num_list:
f.write("%d\n" % i)
def split_list(seq, num... | 3.203125 | 3 |