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 |
|---|---|---|---|---|---|---|
app/core/exceptions.py | sololuz/cibb-web | 0 | 50700 |
from rest_framework import exceptions
from rest_framework import status
from rest_framework.response import Response
from django.core.exceptions import PermissionDenied as DjangoPermissionDenied
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from django.http impor... | 2.109375 | 2 |
hackerrank/Algorithms/Fair Rations/test.py | ATrain951/01.python-com_Qproject | 4 | 50701 | <filename>hackerrank/Algorithms/Fair Rations/test.py
import unittest
import solution
class TestQ(unittest.TestCase):
def test_case_0(self):
self.assertEqual(solution.fairRations([2, 3, 4, 5, 6]), 4)
def test_case_1(self):
self.assertEqual(solution.fairRations([1, 2]), 'NO')
if __name__ == ... | 3.015625 | 3 |
python/tests/test_qnaplxdunpriv.py | kobarity/qnaplxdunpriv | 1 | 50702 | """Tests for qnaplxdunpriv.py
"""
# pylint: disable=missing-function-docstring
import grp
import os
import pathlib
import pwd
import re
import subprocess
import pytest
from qnaplxdunpriv import FileAclError, set_uids, unset_uids
import qnaplxdunpriv
_TEST_UID = 10000
_TEST_FILE = 'file'
_OWNER_GROUP_RE = re.compil... | 1.992188 | 2 |
hlpr_manipulation_utils/src/hlpr_manipulation_utils/pick_place.py | AABL-Lab/hlpr_manipulation | 0 | 50703 | <filename>hlpr_manipulation_utils/src/hlpr_manipulation_utils/pick_place.py<gh_stars>0
#!/usr/bin/env python
#
# Copyright (c) 2018, <NAME>
# Copyright (c) 2018, The University of Texas at Austin
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted ... | 1.429688 | 1 |
labelbox/data/annotation_types/data/tiled_image.py | Cyniikal/labelbox-python | 0 | 50704 | from functools import lru_cache
import math
import logging
from enum import Enum
from typing import Optional, List, Tuple, Any, Union, Dict, Callable
from concurrent.futures import ThreadPoolExecutor
from io import BytesIO
import requests
import numpy as np
from google.api_core import retry
from PIL import Image
from ... | 2.3125 | 2 |
tests.py | joemeister/httpagentparser | 0 | 50705 | import unittest
import time
import httpagentparser
detect = httpagentparser.detect
simple_detect = httpagentparser.simple_detect
data = (
# tuple of tuples
# tuple (agent-string, expected result of simple_detect, expected result of detect)
("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Ge... | 2.796875 | 3 |
geckordp/rdp_client.py | reapler/geckordp | 1 | 50706 | <gh_stars>1-10
import asyncio
import socket
import base64
from enum import Enum
from threading import Thread, Lock, get_ident
from collections import defaultdict
import json
import concurrent.futures
from typing import List, Dict, Tuple
from concurrent.futures import Future, ThreadPoolExecutor
from jmespath import sear... | 2.234375 | 2 |
product/migrations/0018_auto_20170324_1820.py | rodrigocnascimento/django-teste | 0 | 50707 | <reponame>rodrigocnascimento/django-teste<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-24 21:20
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
... | 1.671875 | 2 |
src/oci_cli/file_filters/file_filter_collection.py | honzajavorek/oci-cli | 0 | 50708 | # coding: utf-8
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
from .file_path_filter import FilePathFilter
# Represents a collection of filters which are intended to be evaluated in a given order. At this stage the class has context on what each of the filters
# in its collection mea... | 3.46875 | 3 |
core/brute.py | Leocodefocus/Scanver | 4 | 50709 | #!/usr/bin/env python
# coding=utf-8
#https://github.com/ydhcui/Scanver
'''
this aim to crack the port such as ssh, mssql, mysql, vnc and so on
'''
import os
import random
import re
import string
import subprocess
from log import logging
class Hydra(object):
HYDRA = './lib/hydra/hydra.exe'
def randstr(self, l... | 2.640625 | 3 |
genDescriptor.py | TheHopeSharedFoundation/EnsembleSurrogateAutoShim-Kinases | 0 | 50710 | <filename>genDescriptor.py<gh_stars>0
_version = "0.1"
_usage="""
genDescriptor.py [options] <sdLigandFilename>
"""
from rdkit import Chem
from rdkit import Geometry
from rdkit.Chem import ChemicalFeatures
from rdkit import RDConfig
import sys,os,math
from rdkit.RDLogger import logger
# for now we are using the pred... | 2.25 | 2 |
scilifelab/pm/ext/ext_distributed.py | ssjunnebo/scilifelab | 1 | 50711 | """Distributed Extension"""
import re
import os
import sys
try:
import drmaa
except:
pass
import itertools
import argparse
from cement.core import backend, handler, hook
from scilifelab.pm.core import command
LOG = backend.minimal_logger(__name__)
class DistributedCommandHandler(command.CommandHandler):
... | 2.015625 | 2 |
game_analyzer.py | bobbzorzen/HeroesLoungeTeamAnalyzer | 1 | 50712 | from game_data_gatherer import GameDataGatherer
class GameAnalyzer:
def __add__(self, other):
if not isinstance(other, GameAnalyzer):
raise Exception("Invalid operation '__add__' on type " + str(type(self)) + " and " + str(type(other)))
for team in other.analysis:
... | 3.046875 | 3 |
tests.py | osagha/turktools | 18 | 50713 | # coding: utf-8
"""
turktools tests
mitcho (<NAME>), <EMAIL>, May 2013
The MIT License (MIT)
Copyright (c) 2013 <NAME>
See readme for license block
"""
from __future__ import print_function
import unittest, sys
# todo: import doctest
runner = unittest.TextTestRunner(verbosity=1 + sys.argv.count('-v... | 1.523438 | 2 |
examples.py | CITGuru/cssjson | 4 | 50714 | <filename>examples.py
from cssjson import toJSON, toCSS
css = toJSON("example.css", path=True)
# print(css)
# json = toCSS({'rules': {u'.morris-hover.morris-default-style .morris-hover-row-label': {'attr': {u'font-weight': u'bold', u'margin': u'0.25em 0'}}, u'.morris-hover.morris-default-style': {'attr': {u'border-rad... | 2.890625 | 3 |
tests/test_views.py | huseyinyilmaz/django-dynamic-decorators | 0 | 50715 | <gh_stars>0
"""Test views."""
# import json
# from operator import itemgetter
# from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import Client
# from tests.base import BaseTestCase
# from django.test import Client
from django.test import TestCase
class In... | 2.546875 | 3 |
etc/pending_ugens/PulseDivider.py | butayama/supriya | 191 | 50716 | import collections
from supriya.enums import CalculationRate
from supriya.synthdefs import UGen
class PulseDivider(UGen):
"""
::
>>> pulse_divider = supriya.ugens.PulseDivider.ar(
... div=2,
... start=0,
... trigger=0,
... )
>>> pulse_divider
... | 2.609375 | 3 |
flaskd3/domains/repositoryif/data_source_repository.py | hohihohi/flask_ddd_sample | 0 | 50717 | <filename>flaskd3/domains/repositoryif/data_source_repository.py
from abc import ABCMeta, abstractmethod
# NOTE: domain service concern with domain and business logic, so call them and has responsibility.
class DataSourceRepositoryIF(metaclass=ABCMeta):
# find data source by id from database. This method should r... | 3 | 3 |
json2sql.py | gwentmaster/json2sql | 0 | 50718 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2020-06-30 10:19:04
# @Author : gwentmaster(<EMAIL>)
# I regret in my life
"""summary
"""
import json
import os
import re
from collections import defaultdict
from typing import Any, Dict, List, Generator, Union
import click
TEMPLATE = "INSERT INTO {tabl... | 2.921875 | 3 |
src/rock_rhino_process_controller/rock_rhino_process_controller copy.py | househear/_ws_moveit2 | 0 | 50719 | <gh_stars>0
# Copyright 2011 Brown University Robotics.
# Copyright 2017 Open Source Robotics Foundation, Inc.
# All rights reserved.
#
# Software License Agreement (BSD License 2.0)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | 1.546875 | 2 |
zzh/encoder/__init__.py | zhangzhenhu/zzh | 0 | 50720 | <filename>zzh/encoder/__init__.py
from .label_encoder import * | 1.039063 | 1 |
src/tuh_sz_download.py | xsthunder/TUH_EEG_Seizure_Detection | 0 | 50721 | # -*- coding: utf-8 -*-
"""TUH_SZ-Download.ipynb.
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1kc3U4ZxCUJ6PEeQFa9VTqNdeJPNmHXn0
http://python.omics.wiki/multiprocessing_map/multiprocessing_partial_function_multiple_arguments
"""
import multiprocessing a... | 2.8125 | 3 |
src/zephyr/visualization.py | roger-/pyzephyr | 1 | 50722 |
import numpy
import time
import threading
import matplotlib.pyplot
from matplotlib.animation import FuncAnimation
class VisualizationWindow:
def __init__(self, signal_collector):
self.figure, self.axes = matplotlib.pyplot.subplots(7, 1, sharex=True)
self.figure.subplots_adjust(hspace=0)
... | 2.625 | 3 |
standardfile/__version__.py | stephen-bunn/standardfile | 1 | 50723 | # Copyright (c) 2018 <NAME> <<EMAIL>>
# MIT License <https://opensource.org/licenses/MIT>
__name__ = "standardfile"
__repo__ = "https://github.com/stephen-bunn/standardfile"
__description__ = "A library for accessing and interacting with a Standard File server."
__version__ = "0.0.0"
__author__ = "<NAME>"
__contact__ ... | 0.726563 | 1 |
tests/test_main.py | Ronald-TR/nina | 9 | 50724 | def test_questions():
# assert 'Project name' in main.q()
assert True
def test_import():
try:
from automail.cli import main
assert True
except (ImportError, ModuleNotFoundError):
raise AssertionError
| 2.25 | 2 |
ex016.py | honeyhugh/PythonCurso | 0 | 50725 | from math import trunc
num=float(input('Digite um número: '))
truncado=trunc(num)
print('O resultado truncado de {} é {}.'.format(num,truncado))
| 4.09375 | 4 |
app/api/books/mutation.py | lunyamwis/laylinks-bend | 0 | 50726 | import graphene
from graphql_extensions.auth.decorators import login_required
from ..helpers.permission_required import role_required, token_required
from ..helpers.validate_object_id import validate_object_id
from ..helpers.validation_errors import error_dict
from ..helpers.constants import SUCCESS_ACTION
from .model... | 2.53125 | 3 |
py/calc_ubi.py | cmcaine/uk | 3 | 50727 | <filename>py/calc_ubi.py
"""
Example usage:
baseline_df, base_reform_df, budget = get_data()
ubi_df = set_ubi(base_reform_df, budget, 0, 0, 0, np.zeros((12)),
verbose=True)
"""
from openfisca_uk import Microsimulation
import frs
import pandas as pd
import numpy as np
from rdbl import gbp
from openfis... | 2.625 | 3 |
ditherpy/__main__.py | gabrielvictorcf/ditherpy | 1 | 50728 | <reponame>gabrielvictorcf/ditherpy
import argparse
import os
import sys
from math import log2
from . import ditherer
def getArgs():
desc = 'ditherpy - dithering with a diverse set of styles'
arg = argparse.ArgumentParser(description=desc)
arg.add_argument('image',metavar='image',
help='input image')
arg.ad... | 2.640625 | 3 |
2_estrutura_de_decisao/10_turno.py | cecilmalone/lista_de_exercicios_pybr | 0 | 50729 | <filename>2_estrutura_de_decisao/10_turno.py<gh_stars>0
"""
10. Faça um Programa que pergunte em que turno você estuda. Peça para digitar
M-Matutino ou V-Vespertino ou N-Noturno. Imprima a mensagem "Bom Dia!", "Boa
Tarde!" ou "Boa Noite!" ou "Valor Inválido!", conforme o caso.
"""
turno = input("Qual o turno que voc... | 3.546875 | 4 |
python/comma/util/help_formatter.py | mission-systems-pty-ltd/comma | 21 | 50730 | # This file is part of comma, a generic and flexible library
# Copyright (c) 2011 The University of Sydney
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must ... | 1.554688 | 2 |
Scripts/PerceptronFive.py | targamadze28/Analysis-of-the-latent-space-of-pretrained-deep-convolutional-neural-networks | 0 | 50731 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import h5py as h5
import os.path as fs
import keras
from keras.models import Sequential
from keras.utils import np_utils
from keras.layers.core import Dense, Activation, Dropout
from sklearn.model_selection import trai... | 2.265625 | 2 |
A Million News Headlines/headlines_year_wise.py | CAVIND46016/Kaggle | 3 | 50732 | <filename>A Million News Headlines/headlines_year_wise.py
"""
Visualization 1: Year vs Headline count
"""
import sys
import matplotlib.pyplot as plt
import numpy as np
from util import connect_to_database_server
DATABASE = "ABCNews"
def main():
"""
Entry-point of the program
"""
... | 3.609375 | 4 |
src/interception_py/stroke.py | GanterPenguin/interception_py | 32 | 50733 | <filename>src/interception_py/stroke.py
import struct
class stroke():
@property
def data(self):
raise NotImplementedError
@property
def data_raw(self):
raise NotImplementedError
class mouse_stroke(stroke):
fmt = 'HHhiiI'
fmt_raw = 'HHHHIiiI'
state = 0
... | 2.921875 | 3 |
musictools.py | kenmurrell/AraAraBot | 0 | 50734 | import os
from datetime import timedelta
from typing import Any
class Track(object):
def __init__(self, id: str, title: str, url: str, duration: Any, filename: str):
self.id = id
self.title = title
self.url = url
self.duration = int(duration)
self.filename = filename
... | 2.859375 | 3 |
pre-commit/package_app_dependencies.py | phantomcyber/dev-cicd-tools | 3 | 50735 | """
Builds wheel files for the dependencies of an app, specified in requirements.txt, into the wheels/
folder of the app repo, and updates the app's JSON config specifying any generated wheels as pip
dependencies.
NOTE: If running this script with the --repair_wheels flag, make sure the script is executed from
a manyl... | 2.640625 | 3 |
concepts/listChunking.py | sixtysecondrevit/dynamoPython | 114 | 50736 | """
LIST: CHUNKING
"""
__author__ = '<NAME> - <EMAIL>'
__twitter__ = '@solamour'
__version__ = '1.0.0'
# Example of Chunking (Grouping an item with its next)
def chunks(list, number): # Requires a list and a number
for index in range(0, len(list), number): # For every
# index inside of a number range st... | 4.4375 | 4 |
kmer-collapse.py | alexpreynolds/kmer-collapse | 3 | 50737 | #!/usr/bin/env python
'''
kmer-collapse.py
Starting with a set of kmers using a standard DNA alphabet (ACTG), collapse
it to an encoded, optimized set using IUPAC-derived, degenerate base alphabet.
'''
import sys
import json
import itertools as it
import marisa_trie as mt
"""
Generate all subsets of specified set. ... | 2.875 | 3 |
btb/selection/ucb1.py | csala/BTB_test | 0 | 50738 | <filename>btb/selection/ucb1.py
import random
import numpy as np
from btb.selection.selector import Selector
class UCB1(Selector):
"""
The most common Selector implementation.
Uses Upper Confidence Bound 1 algorithm (UCB1) for bandit selection.
"""
def bandit(self, choice_rewards):
"""
... | 3.734375 | 4 |
models/pointnet2/__init__.py | PointCloudYC/PointNet-modern.pytorch | 2 | 50739 | <filename>models/pointnet2/__init__.py
from .pointnet2_ssg_cls import PointNet2SSGCls
from .pointnet2_msg_cls import PointNet2MSGCls
from .pointnet2_ssg_semseg import PointNet2SSGSemSeg
from .pointnet2_msg_semseg import PointNet2MSGSemSeg | 1.132813 | 1 |
cicoclient/client.py | kbsingh/python-cicoclient | 3 | 50740 | <reponame>kbsingh/python-cicoclient
# Copyright Red Hat, Inc. 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
#
# http://www.apache.org/licenses/LICENSE-2.0... | 2.25 | 2 |
legacy/pruner_proto.py | PedroGabrielBHZ/esmam_ds | 2 | 50741 | <gh_stars>1-10
import copy
from rule import Rule
class Pruner:
def __init__(self, dataset, terms_mgr, sg_comparison):
self._terms_mgr = terms_mgr
self._dataset = dataset
self.current_rule = None
self._comparison = sg_comparison
def prune(self, rule: Rule, verbose=False) -> Ru... | 2.90625 | 3 |
Lib/site-packages/virtualenv/version.py | tejoyv/Flask_Health_Dashboard | 1 | 50742 | __version__ = "20.0.5" | 1.007813 | 1 |
ds_statsml/_statplots.py | airportpeople/dstools | 0 | 50743 | <gh_stars>0
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from cycler import cycler
from sklearn.linear_model import lars_path, LinearRegression
from sklearn.preprocessing import scale, label_binarize, MinMaxScaler
from sklearn.metrics import confusion_matrix, auc, roc_curve, r2_score, mean_... | 2.34375 | 2 |
oops_fhir/r4/code_system/strength_of_recommendation_rating.py | Mikuana/oops_fhir | 0 | 50744 | <reponame>Mikuana/oops_fhir
from pathlib import Path
from fhir.resources.codesystem import CodeSystem
from oops_fhir.utils import CodeSystemConcept
__all__ = ["StrengthOfRecommendationRating"]
_resource = CodeSystem.parse_file(Path(__file__).with_suffix(".json"))
class StrengthOfRecommendationRating:
"""
... | 2.296875 | 2 |
Geolocation/Data/Design2a/design2a_11k_test5/pilot.0000/rp_install/lib/python2.7/site-packages/radical/pilot/umgr/scheduler/base.py | radical-experiments/iceberg_escience | 1 | 50745 | <gh_stars>1-10
__copyright__ = "Copyright 2013-2016, http://radical.rutgers.edu"
__license__ = "MIT"
import os
import threading
import radical.utils as ru
from ... import utils as rpu
from ... import states as rps
from ... import constants as rpc
# -------------------------------------------------------... | 2.046875 | 2 |
conpype/test/test_pipeline.py | c0d1ngm0nk3y/pipeline-dsl | 0 | 50746 | import unittest
from conpype import Pipeline, InitTask
import base64
import os
import subprocess
from conpype.utils.docker_daemon import START_SCRIPT, STOP_SCRIPT
from conpype.concourse.__shared import set_concourse_context
from contextlib import contextmanager
@contextmanager
def concourse_ctx():
set_concourse_... | 2.0625 | 2 |
.ipynb_checkpoints/app-bak-checkpoint.py | Aroueterra/notable-flask | 2 | 50747 | import os
import cv2
import numpy as np
import tensorflow as tf
import tensorflow.compat.v1 as tf
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from flask_ngrok import run_with_ngrok
from flask import Flask,request,send_from_directory,render_template
# GLOBAL ACCESS
os.environ['TF_CPP_MIN_L... | 2.65625 | 3 |
ai/opencv/basic/play_video.py | bigfoolliu/liu_aistuff | 1 | 50748 | <reponame>bigfoolliu/liu_aistuff
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
播放一段视频
"""
import cv2
def play_video():
cap = cv2.VideoCapture("../videos/vtest.avi")
while cap.isOpened():
ret, frame = cap.read()
if not ret:
print("Can't receive frame (str... | 2.6875 | 3 |
src/badgr/datasets/dataset.py | KaiW-53/badgr | 110 | 50749 | <filename>src/badgr/datasets/dataset.py
class Dataset(object):
def __init__(self, env_spec):
self._env_spec = env_spec
def get_batch(self, batch_size, horizon):
raise NotImplementedError
def get_batch_iterator(self, batch_size, horizon, randomize_order=False, is_tf=True):
raise No... | 2.15625 | 2 |
relancer-exp/original_notebooks/loveall_appliances-energy-prediction/appliances-energy-prediction-lstm-arima-fbprophet.py | Chenguang-Zhu/relancer | 1 | 50750 | <reponame>Chenguang-Zhu/relancer
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import preprocessing, model_selection, metrics
# In[ ]:
#import the dataset in dataframe
data = pd.read_csv("../../../input/lov... | 2.96875 | 3 |
model_train.py | pymit/Memojify | 14 | 50751 | <reponame>pymit/Memojify
import keras
from keras.models import Sequential
from keras.layers.normalization import BatchNormalization
from keras.layers.convolutional import Conv2D
from keras.layers.core import Activation , Dense , Dropout , Flatten
from keras.layers import AveragePooling2D, MaxPooling2D, GlobalMaxPooling... | 2.34375 | 2 |
many_generators_many_branchers.py | timkordas/soa-sim | 0 | 50752 | <filename>many_generators_many_branchers.py
import random
import functools
import simpy
from SimComponents import RequestGenerator, RequestSink, RequestCompleter, RandomBrancher
# Ten generators, going into ten priority-queue branchers, with 15 shared completers
if __name__ == '__main__':
# random-variables for d... | 2.6875 | 3 |
rpi_electronics/i2c/mcp23017.py | lab-coding-de/rpi-electronics | 0 | 50753 | #!/usr/bin/python3
"""
Library for Raspberry Pi interfacing with the 16-Bit I/O Expander MCP23017
from Microchip Technology.
"""
__all__ = ["MCP23017", "LCD20x4"]
import time
import smbus
from collections import Iterable
class MCP23017:
"""
Class for the MCP23017 I/O port expander.
"""
REG_BASE_ADDR ... | 2.53125 | 3 |
Project_Spy_Games/code.py | sahil-mehta/ga-learner-dsmp-repo | 0 | 50754 | <gh_stars>0
# --------------
##File path for the file
file_path
def read_file(path):
f=open(path,'r')
sentence=f.readline()
f.close()
return sentence
sample_message=read_file(file_path)
#Code starts here
# --------------
#Code starts here
file_path_1
file_path_2
message_1=read_... | 3.203125 | 3 |
hu_wiwi_grades/__init__.py | NDelventhal/hu_wiwi_grades | 1 | 50755 | <reponame>NDelventhal/hu_wiwi_grades
from .hu_wiwi_grades import *
__version__ = '0.1.0'
__author__ = '<NAME>' | 0.9375 | 1 |
lib/template_loader.py | clouserw/olympia | 1 | 50756 | <reponame>clouserw/olympia<filename>lib/template_loader.py
# -*- coding: utf-8 -*-
from django.conf import settings
from jingo import Loader as JingoLoader, Template
class Loader(JingoLoader):
"""Use JINGO_EXCLUDE_PATHS to exclude templates based on their path.
jingo.Loader has a JINGO_EXCLUDE_APPS that onl... | 2.421875 | 2 |
gulp_version.py | FelixBoers/sublime-gulp | 138 | 50757 | <gh_stars>100-1000
import re
# Workaround for Windows ST2 not having disutils
try:
from distutils.version import LooseVersion
except:
# From distutils/version.py
class LooseVersion():
component_re = re.compile(r'(\d+ | [a-z]+ | \.)', re.VERBOSE)
def __init__ (self, vstring=None):
... | 2.203125 | 2 |
adminmgr/media/code/A3/task2/task1__ulCvYOT.py | IamMayankThakur/test-bigdata | 9 | 50758 | from pyspark.sql import SparkSession
from pyspark.sql.functions import explode
from pyspark.sql.functions import split
spark = SparkSession \
.builder \
.appName("StructuredNetworkWordCount") \
.getOrCreate()
# Create DataFrame representing the stream of input lines from connection to localhost:9999
# "ID"... | 3.328125 | 3 |
lib/db_preprocessor.py | rafelafrance/atram | 26 | 50759 | <gh_stars>10-100
"""Database functions for the preprocessor."""
import os
from os.path import join
from .db import DB_VERSION
def aux_db(cxn, temp_dir):
"""Create & attach a temporary database to the current DB connection."""
db_dir = join(temp_dir, 'db')
os.makedirs(db_dir, exist_ok=True)
db_name ... | 2.953125 | 3 |
examples/agents/pytorch_cnn.py | jtoy/sensenet | 59 | 50760 | import time,os,math,inspect,re,sys,random,argparse
from env import SenseEnv
from torch.autograd import Variable
import numpy as np
from itertools import count
from collections import namedtuple
from tensorboardX import SummaryWriter
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim a... | 2.34375 | 2 |
build_xml/insert_tables.py | DCCouncil/dc-law-tools | 3 | 50761 | <reponame>DCCouncil/dc-law-tools<filename>build_xml/insert_tables.py
"""
The Lexis parser does not parse tables, so this script
inserts manually-created html tables defined in tables.xml.
tables.xml *must be* updated when a new version of the code
comes out.
"""
import os.path
import lxml.etree as etree, re
DIR = os.... | 2.484375 | 2 |
findupd/rebuild.py | AOSC-Dev/scriptlets | 5 | 50762 | <filename>findupd/rebuild.py
#!/bin/python3
import sys
import os
import subprocess
def read_file(src_path):
with open(src_path, "r") as f:
return f.readlines()
def write_file(dest_path, contents):
with open(dest_path, "w") as f:
f.writelines(contents)
def get_pkgs(filename):
contents ... | 2.625 | 3 |
skcosmo/selection/orthogonalizers.py | Luthaf/sklearn-cosmo | 0 | 50763 | <reponame>Luthaf/sklearn-cosmo<gh_stars>0
# -*- coding: utf-8 -*-
"""
This module contains the necessary orthogonalizers for the CUR decomposition
subselection method.
Authors: <NAME>
<NAME>
"""
import numpy as np
def X_orthogonalizer(X_proxy, c, tol=1e-12):
"""
Orthogonalizes a feature matrix by... | 2.84375 | 3 |
src/sim/basicExampleTest/aco_test04.py | andremtsilva/dissertacao | 0 | 50764 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 21 07:57:49 2021
@author: amts
"""
import networkx as nx
import random
from ant_colony import ant_colony
import math
size =16
#size = 4
G = nx.fast_gnp_random_graph(size, .3)
#G = nx.complete_graph(size)
#G = nx.binomial_tree(size)
for (u, v) i... | 3.109375 | 3 |
experiments/ingredients/prepare/checkers.py | vishalbelsare/generalised-signature-method | 29 | 50765 | <gh_stars>10-100
"""
checkers.py
=======================================
Checks if a model is of a given type, to help with determining which route of preparation to go down.
"""
from sklearn.base import BaseEstimator
from experiments.dicts.grids import CLASSIFIERS
def check_sklearn(clf_string):
""" Given a class... | 2.5625 | 3 |
pennylane/debugging.py | therooler/pennylane | 539 | 50766 | <filename>pennylane/debugging.py
# Copyright 2018-2022 Xanadu Quantum Technologies 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
# Unl... | 2.234375 | 2 |
kaldifst/python/tests/test_determinize.py | csukuangfj/kaldifst | 10 | 50767 | #!/usr/bin/env python3
# Copyright 2021 Xiaomi Corporation (authors: <NAME>)
import kaldifst
# see also https://www.openfst.org/twiki/bin/view/FST/DeterminizeDoc
def test_determinize():
isym = kaldifst.SymbolTable()
isym.add_symbol("<eps>", 0)
isym.add_symbol("a", 1)
isym.add_symbol("c", 2)
... | 2.265625 | 2 |
run_GRU.py | nicktien007/Nick.Udic.RNN | 0 | 50768 | <filename>run_GRU.py
import gzip
import torch
import torch.nn as nn
import torch.optim as optim
import csv
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
import numpy as np
import matplotlib.pyplot as plt
import time
from torch.nn.utils.rnn import pack_padded_sequence
import math
# 超參數
f... | 2.6875 | 3 |
People/Rob/Meeting_04/demos/demo_logging.py | rmorgan10/ExpertPythonProgramming | 2 | 50769 | <filename>People/Rob/Meeting_04/demos/demo_logging.py
# A module to demo python's built-in logging package
import inspect
import logging
import logging.config
def basic():
"""
Shows how to utilize the basic functions of logging.
-- using basicConfig for straightforward logging
"""
# For demo, prin... | 4.125 | 4 |
pursuit/agents/base_agent.py | goncalo-rodrigues/thesis | 0 | 50770 | class Agent(object):
def __init__(self, id):
self.id = id
def act(self, state):
raise NotImplementedError()
def transition(self, state, actions, new_state, reward):
pass
| 2.546875 | 3 |
app.py | amrrs/wordle-spoiler | 1 | 50771 | import requests # this is to GET the javascript
import re # this is to do regular expression and extract the list of words
import streamlit as st #web app development
m = st.markdown("""
<style>
div.stButton > button:first-child {
background-color: #0000FF;
color:#ffffff;
}
div.stButton > button:hover {
... | 3.53125 | 4 |
code/part_I_C/renewable.py | Spacebody/MCM-ICM-2018-Problem-C | 1 | 50772 | import pandas as pd
import re
import numpy as np
import os
import sys
from collections import OrderedDict, defaultdict
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import stats, integrate
# load msncodes
msncodes = pd.read_csv("data/csv/original/msncodes.csv")
# load state ... | 2.453125 | 2 |
Codeforces/B_Multiplication_Table.py | anubhab-code/Competitive-Programming | 0 | 50773 | n = int(input())
arr = [list(map(int,input().split())) for i in range(n)]
ans = [0]*n
ans[0] = int(pow((arr[0][1]*arr[0][2])//arr[1][2], 0.5))
for i in range(1,n):
ans[i]=(arr[0][i]//ans[0])
print(*ans) | 3.109375 | 3 |
migrations/versions/schema/1e4faa3cf4bd_.py | Georgi2704/pricelist-fastapi-boilerplate | 0 | 50774 | """empty message
Revision ID: <KEY>
Revises: afacc23c2670
Create Date: 2019-11-27 09:22:33.188541
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "afacc23c2670"
branch_labels = None
depends_on = ... | 1.703125 | 2 |
revibe/platforms/helpers.py | Revibe-Music/core-services | 2 | 50775 | from revibe.platforms.platforms import *
from revibe._errors.platforms import PlatformNotFoundError
# -----------------------------------------------------------------------------
linked_platforms = [
Revibe,
YouTube,
Spotify,
]
def get_platform(string):
for platform in linked_platforms:
if s... | 2.53125 | 3 |
data_structures/linked_list/test.py | SRTjiawei/LegoBox | 0 | 50776 | import unittest
import collections_and_iterators
""" Linked lists - TESTS
Testing Collections programming examples from collections.py
"""
class TestObjectMethods(unittest.TestCase):
def setUp(self):
self.singleLinkList = collections_and_iterators.SinglyLinkedList()
self.singleLink... | 3.8125 | 4 |
software/multifluids_icferst/tools/gmsh_mesh_transform.py | msc-acse/acse-9-independent-research-project-Wade003 | 2 | 50777 | #!/usr/bin/env python
from optparse import OptionParser
import sys
import shutil
import math
#####################################################################
# Script starts here.
optparser=OptionParser(usage='usage: %prog region transformation mesh',
add_help_option=True,
... | 3.0625 | 3 |
fastapi/app/test/test_generator.py | terib0l/genicons | 0 | 50778 | import os
import random
import pytest
from fastapi.testclient import TestClient
from jsonschema import Draft7Validator
from pathlib import Path
from main import app
from app.test.schema.schema_generator import test_generate_product_schema
client = TestClient(app)
current_path = Path(__file__).resolve().parent
@py... | 2.359375 | 2 |
src/ContinuousTimeMarkovModel/transforms.py | vamsikk9/ContinuousTimeMarkovModel | 20 | 50779 | <gh_stars>10-100
import theano.tensor as TT
from pymc3.distributions.transforms import Transform, ElemwiseTransform
from pymc3.distributions.transforms import interval, logodds
import numpy as np
#__all__ = ['ratematrix','ratematrixoneway','anchoredbeta']
class RateMatrix(Transform):
name = "ratematrix"
def _... | 1.976563 | 2 |
resume/api/urls.py | jamedadi/jobnet | 3 | 50780 | <reponame>jamedadi/jobnet
from django.urls import path, include
from rest_framework import routers
from resume.api.views import ResumeModelViewSetApi
app_name = 'resume'
router = routers.SimpleRouter()
router.register('', ResumeModelViewSetApi)
urlpatterns = [
path('', include(router.urls)),
]
| 1.789063 | 2 |
catalyst/dl/core/__init__.py | andrey-avdeev/catalyst | 1 | 50781 | # flake8: noqa
from .callback import (
Callback, CallbackOrder, LoggerCallback, MeterMetricsCallback,
MetricCallback, MultiMetricCallback
)
from .experiment import Experiment
from .runner import Runner
from .state import RunnerState
| 1.039063 | 1 |
service/endpoints/health.py | choobinejad/sanic-baseline | 3 | 50782 | from sanic.response import json
from sanic import Blueprint
from sanic_openapi import doc
health_blueprint = Blueprint('health', url_prefix='/health', strict_slashes=True)
@health_blueprint.route('/', methods=['GET', 'OPTIONS'])
@doc.summary("Get health and stats about the service.")
@doc.produces(json)
async def h... | 2.515625 | 3 |
experimental/privacy_utils/__init__.py | lxuechen/fast-dpsgd | 29 | 50783 | <reponame>lxuechen/fast-dpsgd<filename>experimental/privacy_utils/__init__.py<gh_stars>10-100
from . import privacy_engine
| 1.015625 | 1 |
aoc2020/day03.py | austinsalonen/advent_of_code | 0 | 50784 | <filename>aoc2020/day03.py
import math
def input(path):
with open(path) as f:
return [line.strip() for line in f.readlines()]
def trees_in_path(trees, right, down):
x, tree_count = 0, 0
for idx, line in enumerate(trees):
if idx % down != 0: continue
if line[x % len(line)] == '#': tree_count += 1
x += ri... | 3.703125 | 4 |
code/technical-analysis_python/strategy/cci_emerging_trends.py | wuxuegithub/algotrading | 6 | 50785 | <reponame>wuxuegithub/algotrading
from .indicator import Indicator
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Commodity Channel Index (CCI) emerging trends
-
Buy when CCI surges above +100, sell when it plunges below -100
"""
class cciEmergingTrends(Indicator):
def __ini... | 3.140625 | 3 |
__init__.py | NeonGeckoCom/skill-translation | 0 | 50786 | <reponame>NeonGeckoCom/skill-translation
# -*- coding: utf-8 -*-
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework
# All trademark and other rights reserved by their respective owners
# Copyright 2008-2022 Neongecko.com Inc.
# Contributors: <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME... | 1.078125 | 1 |
yape/json_schema/schema.py | calebsmith/yape | 0 | 50787 | """The actual schema part of `json_schema`."""
from itertools import izip
from yape.json_schema.tokens import token_stream
json_types = (
list, dict, unicode, int, long, bool, type(None)
)
class SchemaError(Exception):
pass
class UnexpectedToken(SchemaError):
def __init__(self, token, expected=None... | 2.65625 | 3 |
db.py | AndeluPhan/PasswordManager | 0 | 50788 | <reponame>AndeluPhan/PasswordManager<gh_stars>0
import psycopg2
import psycopg2.extras
import time
import datetime
import re
import hashlib
import os
from cryptography.fernet import Fernet
def formatString(wordVal):
wordVal = wordVal.lower()
wordVal = wordVal.strip()
return wordVal
#to activate the virtua... | 3.359375 | 3 |
setup.py | Simplar/rppg_datasets | 10 | 50789 | <reponame>Simplar/rppg_datasets
import pathlib
from setuptools import setup, find_packages
DIR = pathlib.Path(__file__).parent
SRC = DIR / 'src'
requirements = (DIR / "requirements.txt").read_text().splitlines()
licence = (DIR / "LICENSE").read_text()
readme = (DIR / "README.md").read_text()
setup(
name='rppg-d... | 1.546875 | 2 |
keyboard_agent.py | kbehouse/study-visual-navigation | 0 | 50790 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import signal
import argparse
import numpy as np
from scene_loader import THORDiscreteEnvironment
from utils.tools import SimpleImageViewer
from scipy.misc import imsave
#
# Navigate the scene using your keyboar... | 2.03125 | 2 |
venv/textDetection.py | saurabhjha137/OCR_using_tesseract | 0 | 50791 | <filename>venv/textDetection.py<gh_stars>0
import cv2
import pytesseract
import numpy as np
from PIL import ImageGrab
import time
pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'
img = cv2.imread('Capture.JPG')
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
######################... | 2.8125 | 3 |
vuemarket/apps/goods/adminx.py | Huangkai1008/VueMarket | 1 | 50792 | <reponame>Huangkai1008/VueMarket
# -*- coding: utf-8 -*-
"""
Created by Huang
Date: 2018/9/4
"""
import xadmin
from goods.models import GoodsImage, Goods, GoodCategory
class GoodAdmin(object):
"""
商品
"""
# 显示的列
list_display = ["name", "click_num", "sold_num", "fav_num", "goods_num", "marke... | 1.898438 | 2 |
analysis/report/lib_db_test.py | coryschwartz/nebula-crawler | 66 | 50793 | import unittest
from lib_db import DBClient
class TestDBClient(unittest.TestCase):
client: DBClient
def setUp(self) -> None:
self.client = DBClient()
def test_integrity(self):
all_peer_ids = set(self.client.get_all_peer_ids())
online_peer_ids = set(self.client.get_online_peer_i... | 3.109375 | 3 |
slote/char_rec.py | dguevel/slote | 0 | 50794 | import numpy as np
from sklearn import svm
class character:
def __init__(self, raw_character):
self.identity = None
def recognize(characters, classifier):
for char in characters:
data = np.reshape(char.image_centered, np.prod(char.image_centered.shape)).reshape(1, -1)
char.ide... | 3.296875 | 3 |
core/settingsmanager.py | willemli/YoungBot | 11 | 50795 | <gh_stars>10-100
import json
class SettingsManager:
def __init__(self, file_name):
self.file_name = file_name
self.load()
def load(self):
print('[SettingsManager] Reading settings from ' + self.file_name)
self.settings = json.load(open(self.file_name))
def... | 2.953125 | 3 |
icinga/plugins/jvm_health/parsegarbagelogs.py | samrocketman/drexel-university | 13 | 50796 | <filename>icinga/plugins/jvm_health/parsegarbagelogs.py
#!/usr/bin/env python
#Author: <NAME>
import os.path
import os
sqlite_3 = 1;
try:
import sqlite3
sql = sqlite3;
except ImportError:
import sqlite
sql = sqlite;
sqlite_3 = 0;
from cStringIO import StringIO
import optparse
import re
import sys... | 2.234375 | 2 |
database.py | rbn42/python-mpd-script | 0 | 50797 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import logging
def add2(item, mpc):
"""
主要入口
"""
items = listall2(item, mpc)
items = _filter(items, mpc)
return items
def _filter(items, mpc):
occupied = []
playlists = []
for item in items:
if 'playlist' in item:
try:... | 2.625 | 3 |
settings.py | SecurityCompass/LabServer | 15 | 50798 | import datetime
SESSION_LIFETIME = datetime.timedelta(minutes=5)
| 1.59375 | 2 |
skimage/viewer/tests/test_utils.py | sumantrip/scikit-image | 8 | 50799 | # -*- coding: utf-8 -*-
from skimage.viewer import utils
from skimage.viewer.utils import dialogs
from skimage.viewer.qt import QtCore, QtGui, has_qt
from numpy.testing.decorators import skipif
@skipif(not has_qt)
def test_event_loop():
utils.init_qtapp()
timer = QtCore.QTimer()
timer.singleShot(10, QtGui... | 2.046875 | 2 |