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 |
|---|---|---|---|---|---|---|
tests/ext/identity/test_identity.py | sixty-north/intentionally-blank | 0 | 40400 | from io import StringIO
from hypothesis import given, strategies
from intentionally_blank import api
def test_format_empty_with_empty_string():
with StringIO() as in_file, StringIO() as out_file:
api.format_from_file_to_file(in_file, out_file, format_names=["identity"])
assert len(out_file.getva... | 2.6875 | 3 |
oxe-api/test/resource/private/test_update_my_article.py | CybersecurityLuxembourg/openxeco | 0 | 40401 | <gh_stars>0
from test.BaseCase import BaseCase
import os
import base64
class TestUpdateMyArticle(BaseCase):
@BaseCase.login
def test_ok(self, token):
self.db.insert({"id": 2, "title": "My title"}, self.db.tables["Article"])
self.db.insert({"id": 3, "name": "My Company"}, self.db.tables["Compa... | 2.40625 | 2 |
multimedia/gui/lvgl/lvgl_multiple_screens.py | 708yamaguchi/MaixPy_scripts | 485 | 40402 | <reponame>708yamaguchi/MaixPy_scripts<filename>multimedia/gui/lvgl/lvgl_multiple_screens.py
#this demo shows how to create multiple screens, load and unload them properly without causing memory leak
import lvgl as lv
import lvgl_helper as lv_h
import lcd
import time
from machine import Timer
from machine import I2C
fr... | 2.328125 | 2 |
cm4/abstractclass/DatabaseManagerABC.py | swsachith/cm | 0 | 40403 | <reponame>swsachith/cm
import abc
class DatabaseManagerABC (metaclass=abc.ABCMeta):
@abc.abstractmethod
def update_document(self):
"""
update document in database/storage
"""
pass
@abc.abstractmethod
def find_document(self):
"""
find document in databa... | 2.75 | 3 |
Anachebe_Ikechukwu/Phase 1/Python Basic 1/Day 3/Qtn_4.py | dreamchild7/python-challenge-solutions | 0 | 40404 | <reponame>dreamchild7/python-challenge-solutions<filename>Anachebe_Ikechukwu/Phase 1/Python Basic 1/Day 3/Qtn_4.py<gh_stars>0
#4. Write a Python program to calculate number of days between two dates.
# Sample dates : (2014, 7, 2), (2014, 7, 11)
#Expected output : 9 days
#Tools: Datetime module, timed... | 4.21875 | 4 |
twitter follow_unfollow/balloon.py | giterdun345/Automating-Social-Media | 0 | 40405 | """
Mask R-CNN
Train on the toy Balloon dataset and implement color splash effect.
Copyright (c) 2018 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by <NAME>
------------------------------------------------------------"""
import os
import sys
import json
import numpy as... | 2.375 | 2 |
squid/squid3-3.3.8.spaceify/debian/tests/test-squid.py | spaceify/spaceify | 4 | 40406 | <reponame>spaceify/spaceify<filename>squid/squid3-3.3.8.spaceify/debian/tests/test-squid.py
#!/usr/bin/python
#
# test-squid.py quality assurance test script
# Copyright (C) 2008-2013 Canonical Ltd.
# Author: <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it u... | 2.109375 | 2 |
db/folderName_to_CSV.py | JontyBurden/local-movies | 0 | 40407 | import os, csv
path = 'F:\Movies-TV'
with open('C:\wsl\local-movies\db\movies.csv', 'w', newline='') as csvfile:
writer = csv.writer(csvfile)
for root,dirs, files in os.walk(path):
for folders in dirs:
if folders == "Subs" or folders == "Subtitles" or folders == "Other" or folders == "subtitles":
... | 3.03125 | 3 |
receiveSTA/rcv_kset_omit2.py | ilinastoilkovska/syncTA | 2 | 40408 | # process local states
local = range(12)
# L states
L = {"x0" : [6], "x1" : [7], "x2" : [8],
"f0" : [9], "f1" : [10], "f2" : [11],
"v0" : [0, 3, 6, 9], "v1" : [1, 4, 7, 10], "v2" : [2, 5, 8, 11],
"corr0" : [0, 6], "corr1" : [1, 7], "corr2" : [2, 8]}
# receive variables
rcv_vars = ["nr0", "nr1", "nr2"]
#... | 2.171875 | 2 |
notes/demos/nn.py | Clickity-Clack/iceberg | 0 | 40409 | import gym
import numpy as np
import random
import tensorflow as tf
import matplotlib.pyplot as plt
| 1.421875 | 1 |
Two pointers/26. Remove Duplicates from Sorted Array.py | ParisMineur/LeetCode-note | 0 | 40410 | class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
l = len(nums)
if l == 1:
return 1
index = 1
num = nums[0]
for i in range(1, l):
if nums[i] == num:
continue
num = nums[i]... | 3.25 | 3 |
labscript_utils/qtwidgets/outputbox.py | JQIamo/labscript-utils | 2 | 40411 | <reponame>JQIamo/labscript-utils<gh_stars>1-10
#####################################################################
# #
# qtwidgets/outputbox.py #
# ... | 1.898438 | 2 |
metrics.py | ShiHuiwen-creat/MedT | 0 | 40412 | <filename>metrics.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.functional import cross_entropy
from torch.nn.modules.loss import _WeightedLoss
EPSILON = 1e-32
class LogNLLLoss(_WeightedLoss):
__constants__ = ['weight', 'reduction', 'ignore_index']
def __init__(self,... | 2.40625 | 2 |
v3/scripts/testing/hackerrank/Staircase.py | TheShellLand/python | 0 | 40413 | <reponame>TheShellLand/python<gh_stars>0
#!/bin/python3
import sys
n = int(input().strip())
level = 1
def treeSpaces(level):
NumOfSpaces = abs(level - n) # 6 - 1 = 5
#print('Number of spaces:', NumOfSpaces)
return ' ' * NumOfSpaces
def treeParts(level):
NumOfParts = level # 1
#print('Number of... | 3.828125 | 4 |
lib/buildTemplate.py | pnlbwh/Harmonization-Python | 0 | 40414 | <reponame>pnlbwh/Harmonization-Python
# ===============================================================================
# dMRIharmonization (2018) pipeline is written by-
#
# <NAME>
# Brigham and Women's Hospital/Harvard Medical School
# <EMAIL>, <EMAIL>
#
# =============================================================... | 2.0625 | 2 |
quantecon/markov/utilities.py | Smit-create/QuantEcon.py | 1,462 | 40415 | <reponame>Smit-create/QuantEcon.py<gh_stars>1000+
"""
Utility routines for the markov submodule
"""
import numpy as np
from numba import jit
@jit(nopython=True, cache=True)
def sa_indices(num_states, num_actions):
"""
Generate `s_indices` and `a_indices` for `DiscreteDP`, for the case
where all the actio... | 2.515625 | 3 |
Surrogate_MBO/constraints.py | Romit-Maulik/Tutorials-Demos-Practice | 8 | 40416 | <reponame>Romit-Maulik/Tutorials-Demos-Practice
'''
Define constraints (depends on your problem)
https://stackoverflow.com/questions/42303470/scipy-optimize-inequality-constraint-which-side-of-the-inequality-is-considered
[0.1268 0.467 0.5834 0.2103 -0.1268 -0.5425 -0.5096 0.0581] . The bounds are +/-30% of this.
'''
... | 3.375 | 3 |
GmailWrapper_JE/venv/Lib/site-packages/cachetools/__init__.py | JE-Chen/je_old_repo | 0 | 40417 | """Extensible memoizing collections and decorators."""
from .cache import Cache
from .decorators import cached, cachedmethod
from .lfu import LFUCache
from .lru import LRUCache
from .rr import RRCache
from .ttl import TTLCache
__all__ = (
'Cache',
'LFUCache',
'LRUCache',
'RRCache',
'... | 2.078125 | 2 |
fan_control.py | bouldinnathan/r710-fan-controller | 0 | 40418 | <reponame>bouldinnathan/r710-fan-controller
#!/usr/bin/env python3
import os
try:_=os.system("apt-get -y install ipmitool")
except:pass
try:_=os.system("apt -y install libsensors4-dev ")
except:pass
try:_=os.system("apt -y install python-paho-mqtt ")
except:pass
#function of import and install
class Easy_installe... | 2.4375 | 2 |
script_generation_tools/generate_experiment_scripts.py | cdt-data-science/TemplateProjectCDTGPUCluster | 10 | 40419 | <filename>script_generation_tools/generate_experiment_scripts.py
import os
import sys
from copy import copy
import argparse
experiment_json_dir = '../experiment_config_files/'
maml_experiment_script = 'train_evaluate_emnist_classification_system.py'
cluster_scripts = {"gpu_cluster": "cluster_template_script", "remote_... | 2.46875 | 2 |
mime/users/api/serializers.py | mrdvince/mime | 0 | 40420 | <reponame>mrdvince/mime<gh_stars>0
from django.contrib.auth import get_user_model
from rest_framework import serializers
from mime.mime.models import Mime
User = get_user_model()
class UserSerializer(serializers.ModelSerializer):
"""
Serializer for the User model (used for the API)
"""
mime = seria... | 2.015625 | 2 |
experimentator/loggers.py | gabriel-vanzandycke/experimentator | 1 | 40421 | import io
import logging
from functools import cached_property
from .base_experiment import BaseExperiment
from .utils import insert_suffix
class TqdmToLogger(io.StringIO):
buffer = ''
def __init__(self, logger, level=logging.DEBUG):
super().__init__()
self.logger = logger
self.level = ... | 2.28125 | 2 |
mb_changedetection.py | mouhamedba/mb_changedetection.io | 0 | 40422 | #!/usr/bin/python3
# Entry-point for running from the CLI when not installed via Pip, Pip will handle the console_scripts entry_points's from setup.py
# It's recommended to use `pip3 install changedetection.io` and start with `changedetection.py` instead, it will be linkd to your global path.
# or Docker.
# Read more ... | 1.28125 | 1 |
PyOpenGL-3.0.2/OpenGL/raw/GL/INGR/color_clamp.py | frederica07/Dragon_Programming_Process | 0 | 40423 | '''Autogenerated by get_gl_extensions script, do not edit!'''
from OpenGL import platform as _p
from OpenGL.GL import glget
EXTENSION_NAME = 'GL_INGR_color_clamp'
_p.unpack_constants( """GL_RED_MIN_CLAMP_INGR 0x8560
GL_GREEN_MIN_CLAMP_INGR 0x8561
GL_BLUE_MIN_CLAMP_INGR 0x8562
GL_ALPHA_MIN_CLAMP_INGR 0x8563
GL_RED_MAX_C... | 1.90625 | 2 |
File handling/file_organizer.py | 100rabmittal/python-Automations | 0 | 40424 | <reponame>100rabmittal/python-Automations<gh_stars>0
import os
from pathlib import Path #this helps in getting path of file
# here you can add more formats and categories in same way
subdir = {
"DOCUMENTS": ['.pdf','.rtf','.txt'],
"AUDIO": ['.m4a','.m4b','.mp3'],
"VIDEOS": ['.mov','.avi','.mp4'],
"I... | 3.296875 | 3 |
datamodels.py | cubecloud/sunday_show | 0 | 40425 | <reponame>cubecloud/sunday_show
import os
import sys
import time
import copy
import pytz
import numpy as np
import datetime
import pandas as pd
# from pandas import DataFrame
from tsdataparams import TSDataParams, DatasetParams
import matplotlib.pyplot as plt
import seaborn as sns
from typing import Tuple
from tsdatap... | 1.992188 | 2 |
Dynamic Obstacle Simulation/nmpc_example.py | TSummersLab/Risk_Bounded_Nonlinear_Robot_Motion_Planning | 3 | 40426 | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 10 22:12:12 2020
@author: vxr131730
"""
import glob
import os
import sys
import random
import time
import numpy as np
import cv2
from test import *
from casadi import *
from numpy import random as npr
from casadi.tools import *
try:
sys.path.appe... | 1.960938 | 2 |
taggable/__init__.py | ville-k/taggable | 0 | 40427 | <filename>taggable/__init__.py
from .taggable_sequence import TaggableSequence
from .taggable_sequence import TaggedSegment | 1.15625 | 1 |
parsewkt/parse.py | cleder/parsewkt | 12 | 40428 | <filename>parsewkt/parse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# CAVEAT UTILITOR
# This file was automatically generated by Grako.
# https://bitbucket.org/apalala/grako/
# Any changes you make to it will be overwritten the
# next time the file is generated.
#
from __future__ import print_function, divi... | 2.109375 | 2 |
envs/sse/scenarios/pattern.py | HAXRD/1120 | 0 | 40429 | <reponame>HAXRD/1120
# Copyright (c) 2021, <NAME>, FUNLab, Xiamen University
# All rights reserved.
import numpy as np
import random
from envs.sse.core import World, GU, ABS, BM
from envs.sse.scenario import BaseScenario
class Scenario(BaseScenario):
"""
Realization of 'pattern' style site-specific environmen... | 2.171875 | 2 |
checkio/Scientific Expedition/The Angles of a Triangle/triangle_angles.py | KenMercusLai/checkio | 39 | 40430 | <reponame>KenMercusLai/checkio
from math import acos, degrees
def checkio(a, b, c):
if a + b > c and b - a < c:
first_angle = round(
degrees(acos((b ** 2 + c ** 2 - a ** 2) * 1.0 / (2 * b * c)))
)
second_angle = round(
degrees(acos((a ** 2 + c ** 2 - b ** 2) * 1.0 /... | 3.5625 | 4 |
setup.py | ssabrii/sfftk | 0 | 40431 | <filename>setup.py
# -*- coding: utf-8 -*-
# setup.py
from setuptools import setup, find_packages
from sfftk import SFFTK_VERSION
with open('README.rst') as f:
long_description = f.read()
setup(
name="sfftk",
version=SFFTK_VERSION,
packages=find_packages(),
author="<NAME>, PhD",
author_email="... | 1.367188 | 1 |
ds21grl/ebisuzaki97.py | edunnsigouin/ds21grl | 1 | 40432 | """
Collection of functions to calculate lag correlations
and significance following Ebisuzaki 97 JCLIM
"""
def phaseran(recblk, nsurr,ax):
""" Phaseran by <NAME>: http://www.mathworks.nl/matlabcentral/fileexchange/32621-phase-randomization/content/phaseran.m
Args:
recblk (2D array): Row: time sample.... | 3 | 3 |
vnpy_huobi/huobi_spot_gateway.py | noranhe/vnpy_huobi | 0 | 40433 | <filename>vnpy_huobi/huobi_spot_gateway.py
import json
from copy import copy
from datetime import datetime
from typing import Dict, List, Tuple
from vnpy.trader.utility import round_to
from vnpy_rest import RestClient, Request, Response
from vnpy.trader.constant import (
Direction,
Exchange,
Product,
S... | 1.921875 | 2 |
lib/bsde_risk_neutral_measure.py | marcsv87/Deep-PDE-Solvers | 5 | 40434 | <gh_stars>1-10
import torch
import torch.nn as nn
import signatory
from typing import Tuple, Optional, List
from abc import abstractmethod
from lib.networks import FFN, FFN_net_per_timestep
from lib.options import BaseOption
class FBSDE(nn.Module):
def __init__(self, d: int, mu: float, ffn_hidden: List[int], t... | 2.09375 | 2 |
Python/Django/Django/LoginAndRegistration/apps/main/urls.py | JosephAMumford/CodingDojo | 2 | 40435 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name="home"),
url(r'success/(?P<id>\d+)', views.success, name="success"),
url(r'register$', views.register, name="register"),
url(r'login$', views.login, name="login"),
url(r'users$', views.users, name="use... | 1.773438 | 2 |
pysdds/writers/writers.py | nikitakuklev/pySDDS | 0 | 40436 | <filename>pysdds/writers/writers.py
import csv
import io
import struct
from io import BytesIO
import logging
import sys
import shlex
from pathlib import Path
from typing import Union, Iterable, List, IO, BinaryIO, Optional, Literal
import numpy as np
import pandas as pd
from ..structures import *
from ..util.constant... | 2.375 | 2 |
examples/run_bidaf/cmrc_bidaf.py | ishine/SMRCToolkit | 1,238 | 40437 | <reponame>ishine/SMRCToolkit<gh_stars>1000+
# coding: utf-8
from sogou_mrc.data.vocabulary import Vocabulary
from sogou_mrc.dataset.squad import SquadReader, SquadEvaluator
from sogou_mrc.dataset.cmrc import CMRCReader,CMRCEvaluator
from sogou_mrc.model.bidaf import BiDAF
import tensorflow as tf
import logging
from sog... | 1.921875 | 2 |
pynes/examples/mario.py | timgates42/pyNES | 1,046 | 40438 | <filename>pynes/examples/mario.py
import pynes
from pynes.bitbag import *
if __name__ == "__main__":
pynes.press_start()
exit()
palette = [
0x22,0x29, 0x1A,0x0F, 0x22,0x36,0x17,0x0F, 0x22,0x30,0x21,0x0F, 0x22,0x27,0x17,0x0F,
0x22,0x16,0x27,0x18, 0x22,0x1A,0x30,0x27, 0x22,0x16,0x30,0x27, 0x22,... | 2.890625 | 3 |
train.py | mateuszbuda/duke-dbt-detection | 10 | 40439 | import argparse
import os
import mlflow
import numpy as np
import pandas as pd
import torch
import torch.optim as optim
from matplotlib import pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg
from mlflow import log_metric, log_param, get_artifact_uri
from skimage.io import imsave
from sklearn.m... | 1.929688 | 2 |
S4/S4 Library/simulation/zone_modifier/zone_modifier_commands.py | NeonOcean/Environment | 1 | 40440 | from server_commands.argument_helpers import TunableInstanceParam, get_tunable_instance
import services
import sims4.commands
ZONE_MODIFIER_CAP = 3
@sims4.commands.Command('zone_modifier.add_zone_modifier', command_type=sims4.commands.CommandType.DebugOnly)
def add_zone_modifier(zone_modifier:TunableInstanceParam(sims... | 1.90625 | 2 |
scripts/bag_to_csv.py | SpyGuyIan/NU-PRISMM | 0 | 40441 | <reponame>SpyGuyIan/NU-PRISMM<gh_stars>0
import csv
import rosbag
name = raw_input("Enter bag name: ")
bag = rosbag.Bag(name)
with open('data_pas.csv', 'wb') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
#spamwriter.writerow(["... | 2.28125 | 2 |
preprocessing/split_data.py | rasmouz/thesis | 0 | 40442 | <reponame>rasmouz/thesis
import json
from nltk.tokenize import sent_tokenize, word_tokenize
from tqdm import tqdm
import random
from random import sample
unked_filename = "unked_dutch.txt"
vocab = "vocab_dutch.txt"
obligatory_words = "obligatory_words.txt"
important_sentences = "important_sentences.txt"
subsampled_sen... | 2.796875 | 3 |
util.py | WRY-learning/k3http | 0 | 40443 | <reponame>WRY-learning/k3http<gh_stars>0
#!/usr/bin/env python3
# coding: utf-8
import copy
def headers_add_host(headers, address):
"""
If there is no Host field in the headers, insert the address as a Host into the headers.
:param headers: a 'dict'(header name, header value) of http request headers
... | 3.859375 | 4 |
ansible-devel/test/units/module_utils/facts/hardware/linux_data.py | satishcarya/ansible | 0 | 40444 | # This file is part of Ansible
#
# Ansible 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 later version.
#
# Ansible is distributed in the hope that ... | 1.484375 | 1 |
utils/paramutils.py | louity/generating-doodle | 0 | 40445 | import numpy as np
def point_to_seg(x1, x2) -> np.ndarray:
'''
Method:
-------
Transform 2 points into a parametrized segment. Implicitely phi is in
[-pi/2; pi/2], it is the oriented angle the segment makes with the
horizontal line passing through its middle c.
'''
c = (x1[:2] + x2[:2]... | 3.546875 | 4 |
main/utils/taskfactory.py | leonsim/clickwork | 0 | 40446 | #!/usr/bin/python
from __future__ import absolute_import
from __future__ import print_function
import sys, os
import syslog
try:
import time
import daemon
import pwd
from . import pid
djangopath = os.path.join(os.path.dirname(sys.argv[0]), "../../")
sys.path.append(djangopath)
os.environ... | 2.03125 | 2 |
_GTW/__test__/Document_Link.py | Tapyr/tapyr | 6 | 40447 | # -*- coding: utf-8 -*-
# Copyright (C) 2010-2016 <NAME> All rights reserved
# Langstrasse 4, A--2244 Spannberg, Austria. <EMAIL>
# ****************************************************************************
# This module is part of the package GTW.__test__.
#
# This module is licensed under the terms of the BSD 3-Cla... | 1.640625 | 2 |
sfftk/unittests/test_readers.py | ssabrii/sfftk | 0 | 40448 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
sfftk.unittests.test_readers
This testing module should have no side-effects because it only reads.
"""
from __future__ import division, print_function
import glob
import os
import struct
import sys
import unittest
import numpy
import random_words
import __init__ a... | 2.609375 | 3 |
Sources/sublime/file.py | shamsan/sublime | 1 | 40449 | #!/usr/bin/env python3
# _*_ coding: utf-8 _*_
###
# Project : SubLime
# FileName : util.py
# -----------------------------------------------------------------------------
# Author : sham
# E-Mail : <EMAIL>
# -------------------------------------------------------------------------... | 2.53125 | 3 |
rater/models/graph/classify.py | shibing624/rater | 25 | 40450 | # -*- coding: utf-8 -*-
"""
@author:XuMing(<EMAIL>), <NAME>(<EMAIL>)
@description: Graph classify
"""
import numpy
from sklearn.metrics import f1_score, accuracy_score
from sklearn.multiclass import OneVsRestClassifier
from sklearn.preprocessing import MultiLabelBinarizer
class TopKRanker(OneVsRestClassifier):
d... | 2.5625 | 3 |
db/hello.py | alicezehner/sql | 0 | 40451 | <gh_stars>0
from faker import Faker
fake = Faker()
# generate random names
print(fake.first_name(), fake.last_name())
print(fake.job())
# push fake data into database
| 2.28125 | 2 |
data_pipeline/sql/statement/ddl_statement.py | albertteoh/data_pipeline | 0 | 40452 | ###############################################################################
# Module: ddl_statement
# Purpose: Parent class for DDL (Data Definition Language) statements
#
# Notes:
#
###############################################################################
import data_pipeline.constants.const as const
... | 3.15625 | 3 |
modules/products.py | sammdu/Shopify-Challenge-2022 | 0 | 40453 | <reponame>sammdu/Shopify-Challenge-2022<gh_stars>0
#!/usr/bin/env python3.9
"""
Enables access to products in the inventory.
Allows for project-relevant SQLite database access by exposing the Products class.
"""
import sqlite3
class Products:
"""
A class that specifies the schema of the products table and im... | 3.53125 | 4 |
getdirpaths.py | AlexOrlek/ATCG | 0 | 40454 | <filename>getdirpaths.py
import sys,os,re
from pythonmods import runsubprocess
dirpath=sys.argv[1] #args.sequences directory path
filepathinfo=sys.argv[2]
blastdbdir=sys.argv[3] #actually where blastdbs are stored
blasttype=sys.argv[4]
runsubprocess(['mkdir -p %s'%blastdbdir],shell=True)
directory=str(dirpath).rst... | 2.515625 | 3 |
zajem_podatkov.py | ajdalemut/vina | 0 | 40455 | <filename>zajem_podatkov.py
import re
import orodja as orod
vzorec_url_vina = re.compile(
r'https://winelibrary.com/wines/'
r'(?P<novi_url>.+?)">.*?'
,
flags = re.DOTALL
)
vzorec_vina = re.compile(
r'<title>(?P<ime>.+?) \| Wine Library</title>.*?'
r'price:amount" content="(?P<cena>\d+?\.\d\d)... | 2.546875 | 3 |
trainer/lib/tgui/TClassSelector.py | Telcrome/ai-trainer | 1 | 40456 | <reponame>Telcrome/ai-trainer
from enum import Enum
from typing import Callable, List
import PySimpleGUI as sg
from PyQt5 import QtWidgets, QtCore
import trainer.lib as lib
class ClassSelectionLevel(Enum):
SubjectLevel = "Subject Level"
BinaryLevel = "Binary Level"
FrameLevel = "Frame Level"
class TC... | 2.5 | 2 |
openre/agent/server/action/utils.py | openre/openre | 0 | 40457 | <filename>openre/agent/server/action/utils.py
# -*- coding: utf-8 -*-
from openre.agent.decorators import action
import logging
@action(namespace='server')
def ping(event):
return 'pong'
@action(namespace='server')
def exception(event):
raise Exception('Test exception')
@action(namespace='server')
def check... | 2.03125 | 2 |
apis/booking/model.py | kothiyayogesh11/yk11_api | 0 | 40458 | <gh_stars>0
from flask_restplus import Namespace, fields
import socket
import time
from datetime import datetime, date, time, timedelta
from flask import jsonify, request
from database import DB
from bson import json_util, ObjectId
from apis.utils.common import *
from apis.libraries.send_mail import Send_mail
import re... | 2.21875 | 2 |
logging/google/cloud/logging/_helpers.py | rodrigodias27/google-cloud-python | 1 | 40459 | # Copyright 2016 Google 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 to in writing, ... | 1.90625 | 2 |
tests/acceptance/test_acceptance/__init__.py | WolffunGame/experiment-agent | 23 | 40460 | <reponame>WolffunGame/experiment-agent<filename>tests/acceptance/test_acceptance/__init__.py
# __init__ is empty
| 0.953125 | 1 |
tests/__init__.py | Kua-Fu/rally | 1,577 | 40461 | <filename>tests/__init__.py
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License... | 1.851563 | 2 |
preprocessors.py | abr-98/COVID-19_regression_analysis | 0 | 40462 | import os
import pandas as pd
import numpy as np
def inp_mortality_tot():
df=pd.read_csv('total_country.csv')
mortal_rate=[]
cured_rate=[]
i=0
while(i<len(df)):
res=df.iloc[i]['Deaths']/df.iloc[i]['Confirmed']
res_2=df.iloc[i]['Cured']/df.iloc[i]['Confirmed']
mortal_rate.append(res)
cured_rate.append... | 2.65625 | 3 |
alipay/aop/api/domain/ItapDeviceInfo.py | antopen/alipay-sdk-python-all | 213 | 40463 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ItapDeviceInfo(object):
def __init__(self):
self._fw_version = None
self._hw_version = None
self._manufacturer = None
self._model = None
self._product_name... | 2.28125 | 2 |
synapse/servers/aha.py | ackroute/synapse | 216 | 40464 | <gh_stars>100-1000
# pragma: no cover
import sys
import asyncio
import synapse.lib.aha as s_aha
if __name__ == '__main__': # pragma: no cover
asyncio.run(s_aha.AhaCell.execmain(sys.argv[1:]))
| 1.367188 | 1 |
pydatacube/pcaxis/__init__.py | jampekka/pydatacube | 1 | 40465 | # encoding: utf-8
from collections import OrderedDict
import string
from pydatacube.pydatacube import _DataCube
import px_reader
# A bit scandinavian specific
default_translate = dict(zip(
u"äöä -",
u"aoa__"
))
class Sluger(object):
def __init__(self, translate=default_translate):
self.given_out = {}
self.tra... | 2.34375 | 2 |
tests/python/contrib/test_ethosu/cascader/test_integration.py | shengxinhu/tvm | 4,640 | 40466 | # 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.5 | 2 |
pymterm/term_pylibui/key_translate.py | stonewell/pymterm | 102 | 40467 | <gh_stars>100-1000
__key_mapping = {
'return' : 'enter',
'up_arrow' : 'up',
'down_arrow' : 'down',
'left_arrow' : 'left',
'right_arrow' : 'right',
'page_up' : 'pageup',
'page_down' : 'pagedown',
}
def translate_key(e):
if len(e.key) > 0:
return __key_mapping[e.key] if e.key... | 2.71875 | 3 |
socketio/web.py | falleco/sample-websockets | 0 | 40468 | # import sys
# sys.path.insert(0, "lib/gevent-0.13.8")
# sys.path.insert(0, "lib/bottle")
# sys.path.insert(0, "lib/gevent-socketio")
from gevent import monkey
monkey.patch_all()
#
from socketio import socketio_manage, mixins
from socketio.namespace import BaseNamespace
from bottle import route, run, view, request, s... | 2.09375 | 2 |
imagesave.py | aasthabhat/Alzheimer-s-Disease-Prediction | 0 | 40469 | <filename>imagesave.py
import os
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
import scipy.misc
import glob
from sklearn.cluster import KMeans
import cv2 as cv
#Save the 92 index slices out of 256 2D slices of the 3D MRI image
basepath = 'C:/Users/aasth/Desktop/adni dataset'
outp... | 2.625 | 3 |
src/sentry/pool/base.py | NickPresta/sentry | 2 | 40470 | <reponame>NickPresta/sentry<gh_stars>1-10
"""
sentry.pool.base
~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
class Pool(object):
def __init__(self, keyspace):
self.keyspace = keyspace
self.queue = []
... | 2.375 | 2 |
MindLink-Eumpy/real_time_detection/GUI/EmotivDeviceReader.py | Breeze1in1drizzle/MindLink-Exploring | 7 | 40471 | # encoding: utf-8
'''
Created on Dec 18, 2018
@author: <NAME>
'''
import time
from array import *
from ctypes import *
from sys import exit
from multiprocessing import Process
from multiprocessing import Queue
import numpy as np
class EmotivDeviceReader(object):
'''
classdocs
This class is used to read ... | 2.65625 | 3 |
blog/recognition/model/fmobilenet.py | ForrestPi/FaceProjects | 4 | 40472 | <reponame>ForrestPi/FaceProjects<gh_stars>1-10
import torch
import torch.nn as nn
import torch.nn.functional as F
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.shape[0], -1)
class ConvBn(nn.Module):
def __init__(self, in_c, out_c, kernel=(1, 1), stride=1, padding=0, groups=1):
... | 2.546875 | 3 |
Quizzes/Quiz3.py | MatthewDShen/ComputingInCivil | 0 | 40473 | import scipy
import matplotlib.pyplot as plt
import numpy as np
x = [
0.001, 0.019, 0.039, 0.058, 0.080, 0.098, 0.119, 0.139,
0.159, 0.180, 0.198, 0.249, 0.298, 0.349, 0.398, 0.419,
0.439, 0.460, 0.479, 0.499, 0.519, 0.540, 0.558, 0.578,
0.598, 0.649, 0.698, 0.749, 0.798, 0.819, 0.839, 0.859,
0.879... | 2.578125 | 3 |
setup.py | gunnchadwick/backtrace-python | 3 | 40474 | #!/usr/bin/env python
from setuptools import setup
import backtracepython
setup(
name='backtracepython',
version=backtracepython.version_string,
description='Backtrace error reporting tool for Python',
author='<NAME>',
author_email='<EMAIL>',
packages=['backtracepython'],
test_suite="test... | 1.03125 | 1 |
tests/test_core.py | srdjanrosic/supervisor | 597 | 40475 | """Testing handling with CoreState."""
from supervisor.const import CoreState
from supervisor.coresys import CoreSys
def test_write_state(run_dir, coresys: CoreSys):
"""Test write corestate to /run/supervisor."""
coresys.core.state = CoreState.RUNNING
assert run_dir.read_text() == CoreState.RUNNING.val... | 2.328125 | 2 |
airbyte-integrations/connectors/source-s3/integration_tests/integration_test.py | luizgribeiro/airbyte | 2 | 40476 | #
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# 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, pu... | 1.648438 | 2 |
serverless_crud/aws/iam.py | epsylabs/python-serverless-crud | 0 | 40477 | from serverless_crud.model import BaseModel
try:
from troposphere import Sub
except ImportError:
class Sub:
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
class PolicyBuilder:
def __init__(self, statements=None):
statements... | 2.125 | 2 |
LeetCode/easy - Hash Table/290. Word Pattern/.ipynb_checkpoints/solution-checkpoint.py | vincent507cpu/Comprehensive-Algorithm-Solution | 4 | 40478 | class Solution:
def wordPattern(self, pattern: str, str: str) -> bool:
lst = str.split()
combo = zip(pattern, lst)
return len(set(pattern)) == len(set(lst)) == len(set(combo)) and len(pattern) == len(lst) | 3.265625 | 3 |
sample/tidy.py | patrickmmartin/Newtrino | 1 | 40479 | <reponame>patrickmmartin/Newtrino<gh_stars>1-10
import sys
if __name__== "__main__":
with open(sys.argv[1]) as f:
for lines in f:
for line in lines.split(";"):
if (line != ""): print(line + ";") | 2.703125 | 3 |
demodocusfw/tests/dom_manipulations.py | dchud/demodocus | 7 | 40480 | <reponame>dchud/demodocus
"""
Software License Agreement (Apache 2.0)
Copyright (c) 2020, The MITRE Corporation.
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.ap... | 2.046875 | 2 |
unit_04/08-Databases/1-Meet_Peewee/3_tables.py | duliodenis/python_master_degree | 19 | 40481 | <reponame>duliodenis/python_master_degree
#
# Using Databases in Python: Meet Peewee
# Python Techdegree
#
# Created by <NAME> on 1/1/19.
# Copyright (c) 2019 ddApps. All rights reserved.
# ------------------------------------------------
# Challenge 1: Create Table
# ----------------------------------------------... | 3.859375 | 4 |
model/i3DMM/utils.py | tarun738/i3DMM | 33 | 40482 | <filename>model/i3DMM/utils.py<gh_stars>10-100
import logging
import torch
def add_common_args(arg_parser):
arg_parser.add_argument(
"--debug",
dest="debug",
default=False,
action="store_true",
help="If set, debugging messages will be printed",
)
arg_par... | 2.015625 | 2 |
test/remote/__init__.py | ScorpionResponse/kbwc_api_client | 1 | 40483 | import OpenURL
import Rest
__all__ = [OpenURL.__name__, Rest.__name__]
| 1.335938 | 1 |
neat-python-read-only/setup.py | anuragpapineni/Hearthbreaker-evolved-agent | 0 | 40484 | # Installation script
from distutils.core import setup, Extension
setup(
name='neat-python',
version='0.1',
description='A NEAT (NeuroEvolution of Augmenting Topologies) implementation',
packages=['neat', 'neat/iznn', 'neat/nn', 'neat/ctrnn', 'neat/ifnn'],
#ext_modules=[
# Ex... | 1.46875 | 1 |
affinity2kicad/converter.py | wntrblm/affinity2kicad | 3 | 40485 | <reponame>wntrblm/affinity2kicad<filename>affinity2kicad/converter.py
# Copyright (c) 2021 <NAME>.
# Published under the standard MIT License.
# Full text available at: https://opensource.org/licenses/MIT
import concurrent.futures
import os.path
import svgpathtools
import rich
import rich.live
import rich.text
from ... | 2.515625 | 3 |
app.py | ialjumah/python-helloworld | 0 | 40486 | <filename>app.py
Volume in drive C has no label.
Volume Serial Number is 30AD-FC05
Directory of C:\Users\HP\Documents\nd064_course_1-main\solutions\python-helloworld
13/07/2021 14:33 <DIR> .
13/07/2021 14:33 <DIR> ..
13/07/2021 14:34 0 app.log
13/07/2021 14:34 ... | 1.945313 | 2 |
study/curso-em-video/exercises/056.py | jhonatanmaia/python | 0 | 40487 | <reponame>jhonatanmaia/python
soma_idade=0
media_Idade=0
maior_idade_homem=0
nome_velho=''
tot_mulher_20=0
for i in range(0,4):
nome=str(input('Nome: ')).strip()
idade=int(input('Idade: '))
sexo=str(input('Sexo: ')).strip()
soma_idade+=idade
if i==1 and sexo in 'Mm':
maior_idade_homem=idade
... | 3.140625 | 3 |
Argen/argen.py | jebreimo/Argen | 0 | 40488 | <filename>Argen/argen.py
#!/usr/bin/env python
"""
argen - Command Line Argument Parser GENerator
"""
import argparse
import os
import sys
import textwrap
from error import Error
import helptextparser
import argparser_hpp
import argparser_cpp
def find_first(s, func):
for i, c in enumerate(s):
if func(... | 3.109375 | 3 |
test/test_stack_with_max_value.py | kisliakovsky/structures | 0 | 40489 | from unittest import TestCase
from src.stack import StackWithMaxValue
class TestStackWithMaxValue(TestCase):
def test_push(self):
stack = StackWithMaxValue()
stack.push(1)
stack.push(2)
stack.push(3)
self.assertEqual([1, 2, 3], stack.as_list())
def test_pop(self):
... | 3.421875 | 3 |
faceQuality/get_quality.py | awesome-archive/MaskInsightface | 269 | 40490 | # -*- coding: utf-8 -*-
from keras.models import load_model
import numpy as np
import os
import cv2
from FaceQNet import load_Qnet_model, face_quality
# Loading the pretrained model
model = load_Qnet_model()
IMG_PATH = '/home/sai/YANG/image/video/nanning/haha'
dir = os.listdir(IMG_PATH)
count = len(dir)
print('count:... | 2.265625 | 2 |
shotify/imgrepo/migrations/0003_alter_image_image_src.py | moeamadou753/shopify-fall-2021 | 0 | 40491 | # Generated by Django 3.2.2 on 2021-05-10 04:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('imgrepo', '0002_auto_20210509_2317'),
]
operations = [
migrations.AlterField(
model_name='image',
name='image_src',
... | 1.335938 | 1 |
flask/harmonisation/street_pattern.py | Artelys/Safer-Roads | 0 | 40492 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 31 11:53:09 2020
@author: aboutet
"""
def street_pattern_before(es, infos, insert):
return {}
def street_pattern(es, infos, data, documents):
to_send = []
for json in data:
if "LINK_ID" in json.keys():
link_id = "LINK... | 2.28125 | 2 |
shrike-examples/tests/test_pipelines.py | lynochka/azure-ml-problem-sets | 3 | 40493 | <reponame>lynochka/azure-ml-problem-sets
"""
PyTest suite for testing all runnable pipelines.
"""
import sys
from unittest.mock import patch
# To-Do: import your pipeline class
### Pipeline validation tests (integration tests)
def test_demo_subgraph_build_local(pipeline_config_path="pipelines/config"):
""" Test... | 2.21875 | 2 |
backend/optimizer.py | MaxLinCode/tardy-HackIllinois-2017 | 0 | 40494 | <filename>backend/optimizer.py
def ind_cost(guess, actual):
return max(abs(guess - actual), (86400 - abs(guess - actual)))
| 2.203125 | 2 |
apps/home/migrations/0004_results.py | gwhong917/A_C_C | 0 | 40495 | # Generated by Django 3.1.3 on 2022-02-28 16:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0003_auto_20220228_1112'),
]
operations = [
migrations.CreateModel(
name='Results',
fields=[
... | 1.773438 | 2 |
notebooks/presentation/styling.py | flatironinstitute/binary_classification_metrics | 1 | 40496 | <filename>notebooks/presentation/styling.py
style_string = """
<style>
.container { width:100% !important; }
.hit {
border-style: dotted;
border-width: 20px;
border-color: #ddd;
color: black;
background-color: white;
}
.miss {
border-style: solid;
borde... | 2.90625 | 3 |
app/ui.py | jessicalee127/DineCision | 0 | 40497 | from flask import Flask, request, render_template, flash, redirect, url_for
from wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField
from wtforms.validators import DataRequired
from app.DineCision import yelprequest
from flask_wtf import FlaskForm
import random
import json
import os
API... | 3 | 3 |
src/cleanMarkdown.py | xRuiAlves/minute-to-pdf | 0 | 40498 | <filename>src/cleanMarkdown.py<gh_stars>0
import re as regex
def removeTags(sourceCode):
return regex.sub(r"###### tags: .*", "", sourceCode)
def getTitle(sourceCode):
titleRegex = r"^# ([^\n]*)"
return regex.search(titleRegex, sourceCode).group(1), regex.sub(titleRegex, "", sourceCode)
def downsizeTi... | 2.796875 | 3 |
src/test/test_pytorch.py | cvoelcker/spn-pytorch-experiments | 7 | 40499 | import unittest
import numpy as np
import torch
from torch import optim
from spn.structure.Base import Product, Sum
from spn.structure.Base import assign_ids, rebuild_scopes_bottom_up
from spn.structure.leaves.parametric.Parametric import Gaussian, Categorical
from spn.gpu.TensorFlow import spn_to_tf_graph, optimize_... | 2.484375 | 2 |