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 |
|---|---|---|---|---|---|---|
oop_di/container.py | ChubV/oop-di | 0 | 42100 | import inspect
from functools import partial
from typing import Any, Callable, Dict, List
from .service_builder import ServiceBuilder
from .types import NameType
class Container:
def __init__(self, params):
self._services: Dict[NameType, ServiceBuilder] = {}
self._params: Dict[NameType, Any] = pa... | 2.359375 | 2 |
test/wrappers/gpm/test_auth_wrapper.py | mohamey/gpm_to_spotify | 6 | 42101 | from exceptions.gpm.auth_exceptions import AuthException
from gmusicapi import Mobileclient
from oauth2client.client import OAuth2Credentials
from wrappers.gpm.auth_wrapper import AuthWrapper
from unittest.mock import MagicMock
from unittest import mock
import unittest
class AuthWrapperTest(unittest.TestCase):
... | 2.78125 | 3 |
setup.py | avanov/redmine_migrator | 3 | 42102 | <gh_stars>1-10
import os
from setuptools import find_packages
from setuptools import setup
readme = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
setup(
name='redmine_migrator',
version='0.3',
packages=find_packages(exclude=['tests']),
install_requires=[
'psycopg2',
... | 1.453125 | 1 |
time_series_transform/__init__.py | mrdragonbear/Time-Series-Transformer | 1 | 42103 | <gh_stars>1-10
from time_series_transform.transform_core_api import (
Pandas_Time_Series_Panel_Dataset,
Pandas_Time_Series_Tensor_Dataset,
)
from time_series_transform.stock_transform import (
Portfolio_Extractor,
Stock_Extractor
)
| 1.28125 | 1 |
Complier_Design/countlines/countlines.py | mayank-gubba/Compiler-Design | 0 | 42104 | <filename>Complier_Design/countlines/countlines.py
f=open('countlines.txt','rt')
n=0
for i in f:
n+=1
print(n)
f.close()
| 2.921875 | 3 |
aasaan/schedulemaster/views.py | deepakkt/aasaan | 0 | 42105 | from datetime import datetime
from django.shortcuts import render
from django.http import Http404
from .models import ProgramSchedule
from utils.datedeux import DateDeux
# Create your views here.
def display_single_schedule(request, schedule_id):
try:
schedule = ProgramSchedule.objects.get(id=int(schedu... | 2.21875 | 2 |
tokenizing-string.py | eltechno/python_course | 4 | 42106 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Created by techno at 25/04/19
#Feature: #Enter feature name here
# Enter feature description here
#Scenario: # Enter scenario name here
# Enter steps here
""" tokenizing a string and counting unique words"""
text = ('this is sample text with several words different... | 4.40625 | 4 |
src/NotYetSelfAware/layers/activations/tanh.py | ezalos/NotYetSelfAware | 1 | 42107 | <filename>src/NotYetSelfAware/layers/activations/tanh.py
import numpy as np
from .base import BaseActivation
class Tanh(BaseActivation):
def __init__(self) -> None:
pass
def forward(self, Z):
# A = np.tanh(Z)
up = np.exp(Z) - np.exp(-Z)
dn = np.exp(Z) + np.exp(-Z)
A = up / dn
return A
def backward(se... | 2.828125 | 3 |
make_graph_kernel_list.py | OminiaVincit/scale-variant-topo | 8 | 42108 | <filename>make_graph_kernel_list.py
import numpy as np
import glob
import os
import argparse
import re
from collections import defaultdict
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--exppath', '-e', type=str, required=True)
parser.add_argument('--infolder', '-i', ty... | 2.390625 | 2 |
tests/test_status.py | ekeyme/bio-pm | 0 | 42109 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Unit test for status"""
import sys
import unittest
from os.path import dirname, realpath
from pm.status import Y, Conserved, PM, NA
class RoutineTest(unittest.TestCase):
"""Routine test."""
def test_pm_status_gt_order(self):
"""Status should have a r... | 3.234375 | 3 |
tools/gen-precalc-tables.py | andrejo/zxmaze3d | 4 | 42110 | #! /usr/bin/env python3
import math
import decimal
N_DIRECTIONS = 256
# If rounded up to 384 and last element has max value, it has the bit
# pattern, that prevents bisection from searching past the last element.
N_PRECALC_DRAW_DIST = 384
# Python round() uses "banker's rounding", i.e. "round half even"
def roun... | 3.34375 | 3 |
chunair/kicad-footprint-generator-master/KicadModTree/nodes/specialized/RectLine.py | speedypotato/chuni-lite | 2 | 42111 | # KicadModTree 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.
#
# KicadModTree is distributed in the hope that it will be useful,
# bu... | 2.96875 | 3 |
microimprocessing/migrations/0006_auto_20200530_2236.py | mjirik/scaffanweb | 0 | 42112 | # Generated by Django 3.0.3 on 2020-05-30 20:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('microimprocessing', '0005_auto_20200530_2231'),
]
operations = [
migrations.AlterField(
model_name='serverdatafilename',
... | 1.546875 | 2 |
samples/web/content/apprtc/decline_page_test.py | jsmithersunique/thegetvip_RTCsamples | 0 | 42113 | # Copyright 2015 Google Inc. All Rights Reserved.
import json
import unittest
import webtest
from google.appengine.datastore import datastore_stub_util
from google.appengine.ext import ndb
from google.appengine.ext import testbed
import apprtc
import constants
import gcm_register
import gcmrecord
import room
import ... | 2.046875 | 2 |
code/data.py | CCChenhao997/EMCGCN-ASTE | 0 | 42114 | import math
import torch
import numpy as np
from collections import OrderedDict, defaultdict
from transformers import BertTokenizer
sentiment2id = {'negative': 3, 'neutral': 4, 'positive': 5}
label = ['N', 'B-A', 'I-A', 'A', 'B-O', 'I-O', 'O', 'negative', 'neutral', 'positive']
# label2id = {'N': 0, 'B-A': 1, 'I-A':... | 2.390625 | 2 |
unit_test/options_test.py | bbayles/cibuildwheel | 371 | 42115 | import platform as platform_module
import pytest
from cibuildwheel.__main__ import get_build_identifiers
from cibuildwheel.environment import parse_environment
from cibuildwheel.options import Options, _get_pinned_docker_images
from .utils import get_default_command_line_arguments
PYPROJECT_1 = """
[tool.cibuildwhe... | 2.109375 | 2 |
tests/sentry/coreapi/test_auth_from_request.py | uandco/sentry | 4 | 42116 | <reponame>uandco/sentry
from __future__ import absolute_import
import mock
import pytest
from django.core.exceptions import SuspiciousOperation
from sentry.coreapi import ClientAuthHelper, APIUnauthorized
def test_valid():
helper = ClientAuthHelper()
request = mock.Mock()
request.META = {'HTTP_X_SENTRY... | 2.03125 | 2 |
tests/connect_tests.py | adyekjaer/VersionOne.SDK.Python | 2 | 42117 | <filename>tests/connect_tests.py
from testtools import TestCase
from testtools.assertions import assert_that
from testtools.matchers import Equals
from testtools.content import text_content
import sys
if sys.version_info >= (3,0):
from urllib.error import HTTPError
else:
from urllib2 import HTTPError
# try the... | 2.4375 | 2 |
src/test_monitoriza_url.py | atareao/monitoriza-url | 5 | 42118 | <reponame>atareao/monitoriza-url
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
import os
import json
from checkurl import CheckUrl
from telegramapi import Chat
class TestCheckUrl(unittest.TestCase):
def test_is_up(self):
url = 'https://www.google.com'
checkUrl = CheckUrl(url)
... | 2.53125 | 3 |
Bot/cogs/Auto Moderation/Emojis.py | No1IrishStig/Watchdog_Public | 8 | 42119 | import re
from discord.ext import commands
from utils import sql
from utils.functions import func
from cogs.Core.Rules import Rules
from cogs.Core.Language import Language
class MassEmoji(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.store = {} # Guilds Cache
@commands.Cog.lis... | 2.125 | 2 |
twitter-analytics/code/3-model_evaluation/precision/results.py | worldbank/SDG-big-data | 2 | 42120 | <reponame>worldbank/SDG-big-data
our_method_top50_dict = {
2: {
'is_hired_1mo': 0.98,
'is_unemployed': 0.98,
'lost_job_1mo': 0.74,
'job_search': 0.12,
'job_offer': 1.0},
0: {
'is_hired_1mo': 0.92,
'is_unemployed': 0.06,
'lost_job_1mo': 0.3,
... | 2.140625 | 2 |
site/trips/models.py | CKPBot/site | 0 | 42121 | <gh_stars>0
from django.db import models
class Post(models.Model):
iden = models.CharField(max_length=100)
content = models.CharField(max_length=100)
domain = models.CharField(max_length=100, null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
class Article(models.Model):
content = model... | 2.140625 | 2 |
Changelogs/changelog.py | SamuelNovak/GJAR_IoT | 0 | 42122 | import os, sys
import time
import argparse
import yaml
from collections import namedtuple
from yattag import Doc, indent
parser = argparse.ArgumentParser(description="A tool for consolidating YAML changelogs.")
parser.add_argument("-l", "--location", action="store", help="Only specify if changelog location differs fro... | 2.875 | 3 |
Algorithm-Selection/gripsPredictorPkg/__init__.py | GregorCH/algoselection | 2 | 42123 | <gh_stars>1-10
__all__ = ['predictor', 'tests']
| 1.054688 | 1 |
dataactcore/migrations/versions/9960bbbe4d92_indexing_domain_models.py | brianherman/data-act-broker-backend | 1 | 42124 | """Indexing domain models
Revision ID: 9960bbbe4d92
Revises: d<PASSWORD>
Create Date: 2017-09-06 13:09:21.210982
"""
# revision identifiers, used by Alembic.
revision = '9960bbbe4d92'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(engine_n... | 1.78125 | 2 |
tests/starkex/test_helpers.py | clifton/dydx-v3-python | 109 | 42125 | <gh_stars>100-1000
from dydx3.starkex.helpers import fact_to_condition
from dydx3.starkex.helpers import generate_private_key_hex_unsafe
from dydx3.starkex.helpers import get_transfer_erc20_fact
from dydx3.starkex.helpers import nonce_from_client_id
from dydx3.starkex.helpers import private_key_from_bytes
from dydx3.st... | 2.21875 | 2 |
tslearn/docs/examples/plot_barycenters.py | johannfaouzi/tslearn | 1 | 42126 | # -*- coding: utf-8 -*-
"""
Barycenters
===========
This example shows three methods to compute barycenters of time series.
For an overview over the available methods see the :mod:`tslearn.barycenters`
module.
*tslearn* provides three methods for calculating barycenters for a given set of
time series:
* *Euclidean b... | 3.203125 | 3 |
ENIIGMA/Stats/barplot_GA.py | willastro/ENIIGMA-fitting-tool | 0 | 42127 | <reponame>willastro/ENIIGMA-fitting-tool<gh_stars>0
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import MultipleLocator, FormatStrFormatter, ScalarFormatter, LogLocator, AutoMinorLocator
import pandas as pd
def to_sub(s):
subs = {u'0': u'\u2080',
u'1': u'\u2081',
... | 2.515625 | 3 |
venv/Lib/site-packages/plotnine/stats/stat_boxplot.py | EkremBayar/bayar | 0 | 42128 | import numpy as np
import pandas as pd
import pandas.api.types as pdtypes
from ..utils import resolution
from ..doctools import document
from .stat import stat
@document
class stat_boxplot(stat):
"""
Compute boxplot statistics
{usage}
Parameters
----------
{common_parameters}
coef : flo... | 2.75 | 3 |
docs/src/tutorial/doctest_setup.py | franzinc/agraph-python | 25 | 42129 | # This document contains definitions of functions and variables used
# in multiple tutorial examples. Each code fragment is actually passed to Sphinx
# twice:
# - This whole file is imported in a hidden, global setup block
# - The example in which the function is defined included its code from this
# file.
#
... | 2.109375 | 2 |
visdialch/encoders/rva.py | yuleiniu/rva | 68 | 42130 | <filename>visdialch/encoders/rva.py
import torch
from torch import nn
from torch.nn import functional as F
from visdialch.utils import DynamicRNN
from visdialch.utils import Q_ATT, H_ATT, V_Filter
from .modules import RvA_MODULE
class RvAEncoder(nn.Module):
def __init__(self, config, vocabulary):
... | 2.234375 | 2 |
apps/startsmart/annotator/tools/MemoryMonitor.py | david00medina/startsmart | 0 | 42131 | from threading import Thread
from statistics import mean
import nvidia_smi
import time
class MemoryMonitor(Thread):
def __init__(self, delay):
super(MemoryMonitor, self).__init__()
self.__stopped = False
self.__delay = delay
nvidia_smi.nvmlInit()
handle = nvidia_smi.nvmlDe... | 2.78125 | 3 |
jp.atcoder/arc139/arc139_b/31252158.py | kagemeka/atcoder-submissions | 1 | 42132 | def solve() -> int:
n, a, b, x, y, z = map(int, input().split())
y = min(y, a * x)
z = min(z, b * x)
if y * b > z * a:
a, b = b, a
y, z = z, y
mn_cost = 1 << 60
if n // a <= a - 1:
for i in range(n // a + 1):
j, k = divmod(n - i * a, b)
... | 2.921875 | 3 |
profile_support.py | matikasiyanda/21cmNEST | 1 | 42133 | import __builtin__
try:
profile = __builtin__.profile
except AttributeError:
# No line profiler, provide a pass-through version
def profile(func): return func
| 1.617188 | 2 |
dfelf/cvsfileelf.py | KrixTam/dfelf | 0 | 42134 | <reponame>KrixTam/dfelf<filename>dfelf/cvsfileelf.py<gh_stars>0
import pandas as pd
from moment import moment
from ni.config import Config
from dfelf import DataFileElf
from dfelf.commons import logger
class CSVFileElf(DataFileElf):
def __init__(self, output_dir=None, output_flag=True):
super().__init__(... | 2.265625 | 2 |
pytransfer/progressbar.py | PapiCZ/pyshare | 0 | 42135 | <gh_stars>0
from tqdm import tqdm
class AdvancedTqdm(tqdm):
def finish(self, message):
self.clear()
self._lock.acquire()
self.moveto(abs(self.pos))
self.sp(message)
self.fp.write('\r') # place cursor back at the beginning of line
self.moveto(-abs(self.pos))
... | 2.578125 | 3 |
service/run_topic_modeling.py | atypon/OCTIS | 0 | 42136 | <gh_stars>0
import argparse
import os
import string
import time
from collections import defaultdict
from datetime import datetime
import psutil as psutil
from octis.models.CTM import CTM
from octis.models.ProdLDA import ProdLDA
from octis.models.Scholar import scholar
from octis.preprocessing.preprocessing import Pre... | 2.21875 | 2 |
objects/ArticleExtractor.py | jclukas/MedicalResearchTool | 0 | 42137 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os, sys, re
sys.path.append("{0}/Desktop/cbmi/reproduce/python/MedicalResearchTool/objects".format(os.environ['HOME'])) #TODO
sys.path.append("{0}/Desktop/cbmi/reproduce/python/MedicalResearchTool".format(os.environ['HOME']))
import nltk
import requests
from pprin... | 2.78125 | 3 |
Python/ElectrodePotential/propagate.py | mrchipzhou/tutorial-notes | 0 | 42138 | # -*- coding: utf-8 -*-
import math
import numpy as np
import matplotlib.pyplot as plt
#Constants
GNa = 120 #Maximal conductance(Na+) ms/cm2
Gk = 36 #Maximal condectance(K+) ms/cm2
Gleak = 0.3 #Maximal conductance(leak) ms/cm2
cm = 1 #Cell capacitance uF/cm2
delta = 0.01 #Axon condectivity ms2
ENa = 50 #Nernst poten... | 2.265625 | 2 |
cryptofield/algorithms/berlekamp.py | SergeyBel/cryptofield | 0 | 42139 | <filename>cryptofield/algorithms/berlekamp.py
from cryptofield.fieldpolynom import *
from cryptofield.algorithms.field_algorithms import *
def Berlekamp(F, polynom):
f = polynom.copy()
factors = list()
if f.deg() <= 1:
factors.append(f)
return factors
if not f.c[-1] == FElement(F, 1):
factors.app... | 2.59375 | 3 |
db_api/extensions.py | chengjf/db-api | 0 | 42140 | # from flask_login import LoginManager
from flask_restless import APIManager
from flask_sqlalchemy import SQLAlchemy
from flask import logging
__author__ = 'sharp'
db = SQLAlchemy()
restless = APIManager(app=None, flask_sqlalchemy_db=db)
logger = logging.getLogger()
# login_manager = LoginManager()
| 2.09375 | 2 |
api/src/application/wsgi.py | iliaskaras/VCFHandler | 0 | 42141 | from application.factories import vcf_handler_api
application = vcf_handler_api(
name="VCF Handler API",
)
| 1.148438 | 1 |
app/__init__.py | oOo0oOo/FoodWorld | 0 | 42142 | from flask import Flask, Blueprint
from flask_ask import Ask
from flask_sqlalchemy import SQLAlchemy
from config import config
# Extensions
db = SQLAlchemy()
alexa = Ask(route = '/')
# Main blueprint
main = Blueprint('main', __name__)
from . import models, views
def create_app(config_name = 'development'):
app... | 2.359375 | 2 |
molo/core/management/commands/remove_all_featured_articles.py | Ishma59/molo | 25 | 42143 | from __future__ import absolute_import, unicode_literals
from django.core.management.base import BaseCommand
from molo.core.models import ArticlePage
class Command(BaseCommand):
def handle(self, **options):
ArticlePage.objects.all().update(
featured_in_latest=False,
featured_in_la... | 1.46875 | 1 |
StravaAPI/swagger_client/models/vpn_configuration.py | jonberthet/EuroTrip_2018 | 0 | 42144 | <gh_stars>0
# coding: utf-8
"""
Platform API
The REST API for Platform.sh.
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class VpnConfiguration(object):
"""
NOTE: This class is auto generated by th... | 2.15625 | 2 |
example/example_tr.py | tolgahanuzun/markovch | 5 | 42145 | from markovch import markov
diagram = markov.Markov('./data_tr.txt')
print(diagram.result_list(50))
| 1.757813 | 2 |
exercinpt2.py | fabianocardosodev/exercicios-Python-cursoIntens | 0 | 42146 | <reponame>fabianocardosodev/exercicios-Python-cursoIntens
pessoas_jantar = input("Boa noite,quantas pessoas estão para jantar?:")
pessoas_jantar = int(pessoas_jantar)
if pessoas_jantar >= 8:
print("Desculpe como vocês estão em " + str(pessoas_jantar)
+ " pessoas,precisarão aguardar termos mesas disponiveis.")
... | 3.84375 | 4 |
src/cli.py | nikshinde1996/xkcd-cli | 2 | 42147 | <filename>src/cli.py
import click
import json
import requests
import logging
import webbrowser
from PIL import Image
from io import BytesIO
from random import randint
try:
from src import logger
except ImportError as error:
import logger
logger = logger.setup()
@click.group()
@click.option('--debug', is_fla... | 2.578125 | 3 |
src/test/test_plot.py | sdat2/seager19 | 5 | 42148 | <reponame>sdat2/seager19
"""Test the plot settings in `src.plot_settings`."""
import os
import numpy as np
import matplotlib.pyplot as plt
from src.plot_utils import (
ps_defaults,
label_subplots,
set_dim,
STD_CLR_LIST,
BRICK_RED,
OX_BLUE,
)
from src.constants import PROJECT_PATH
def test_plot... | 2.28125 | 2 |
tests/test_either.py | hellerve/hawkweed | 20 | 42149 | from itertools import chain
from nose.tools import *
from hawkweed.monads.either import Either, Left, Right, is_right,\
is_left, is_either, either, lefts, rights, partition_eithers
from hawkweed.functional.primitives import identity
def test_right():
assert_equal(Right(10).bind(identity), 10)
def test_not... | 2.546875 | 3 |
Computer_Science/6_Machine_Learning/Classification/p2_knn_from_scratch_bike_data.py | Soumya14022002/Algos-for-all-Amigos | 10 | 42150 | <reponame>Soumya14022002/Algos-for-all-Amigos
"""
Machine Learning Task -
Binary Classification of Bike Sharing Service Data, after appropriate Data Processing
Using KNN With no libraries to solve the Problem
"""
import time # To calculate run time
import csv # To import the dataset
import random # To shuffl... | 3.65625 | 4 |
run.py | kele/WhatchaDoin | 0 | 42151 | <gh_stars>0
__author__ = 'kele'
import click
import threading
from app.core.WhatchaDoin import WhatchaDoin
from app.networking.udp import UdpNetworking
from app.core.AddressBook import AddressBook
from app.ui.pyside.pyside import PySideUI
@click.command()
@click.option('--port', default=8104, help='Port number')
d... | 2.390625 | 2 |
perspective/table.py | texodus/perspective-python | 1 | 42152 | import numpy as np
import pandas as pd
from .libbinding import t_schema, t_dtype, t_table
class Perspective(object):
def __init__(self, column_names, types):
self._columns = {}
dtypes = []
for name, _type in zip(column_names, types):
dtypes.append(self._type_to_dtype(_type))
... | 2.640625 | 3 |
plugins/custom_resolver/run_test/custom_resolver.py | jingtaoh/USD-Cookbook | 332 | 42153 | <reponame>jingtaoh/USD-Cookbook<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module tests if the custom resolver works."""
# IMPORT FUTURE LIBRARIES
from __future__ import print_function
# IMPORT THIRD-PARTY LIBRARIES
from pxr import Ar
def main():
"""Run the main execution of the cu... | 2.15625 | 2 |
FEV_KEGG/Experiments/22.py | ryhaberecht/FEV-KEGG | 0 | 42154 | <reponame>ryhaberecht/FEV-KEGG<gh_stars>0
"""
Context
-------
:mod:`19` found many EC numbers new to an example group of Enterobacteriales vs. the super group of Gammaproteobacteria.
"108/190 -> 56.8% of EC numbers in Enterobacteriales are new, compared to Gammaproteobacteria consensus"
Question
--------
Could this be... | 2.234375 | 2 |
src/run_classifier.py | petrapoklukar/versa | 1 | 42155 | <reponame>petrapoklukar/versa<filename>src/run_classifier.py<gh_stars>1-10
"""
Script to reproduce the few-shot classification results in:
"Meta-Learning Probabilistic Inference For Prediction"
https://arxiv.org/pdf/1805.09921.pdf
The following command lines will reproduce the published results within error-bars:
Omn... | 1.882813 | 2 |
genre/util/util_cam_para.py | wagnew3/Amodal-3D-Reconstruction-for-Robotic-Manipulationvia-Stability-and-Connectivity--Release | 0 | 42156 | <filename>genre/util/util_cam_para.py
import numpy as np
def read_cam_para_from_xml(xml_name):
# azi ele only
import xml.etree.ElementTree
e = xml.etree.ElementTree.parse(xml_name).getroot()
assert len(e.findall('sensor')) == 1
for x in e.findall('sensor'):
assert len(x.findall('transform... | 2.921875 | 3 |
tests/test_views.py | WilliamOtieno/django-serverless-cron | 32 | 42157 | <filename>tests/test_views.py<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_django_serverless_cron
------------
Tests for `django_serverless_cron` views module.
"""
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from django_s... | 2.109375 | 2 |
app/app/tests/utils/utils.py | cs-nerds/lishebora-shipping-service | 0 | 42158 | <reponame>cs-nerds/lishebora-shipping-service
import random
import string
def random_lower_string() -> str:
return "".join(random.choices(string.ascii_lowercase, k=32))
def random_code() -> str:
return str(random.randint(0, 1000))
def random_currency() -> str:
return "".join(random.choices(string.asci... | 2.90625 | 3 |
src/djanban/apps/api/views/boards.py | diegojromerolopez/djanban | 33 | 42159 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
import json
from django.db import transaction
from django.http import Http404, HttpResponseBadRequest
from django.http import JsonResponse
from djanban.apps.api.http import JsonResponseMethodNotAllowed, JsonResponseNot... | 2.15625 | 2 |
Semana03Atividade1/Questao04_S3.py | Marvingms7/IFPI | 0 | 42160 | <reponame>Marvingms7/IFPI
def total(n):
return n <= 9 and n >= 0
def main():
n = int(input("Digite um numero entre 0 e 9, caso contrario será falso: "))
resultado = total(n)
print(f' o numero é {resultado}')
if __name__ == '__main__':
main() | 3.9375 | 4 |
app.py | saharshleo/pid-tuning-gui | 0 | 42161 | <filename>app.py
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication
import sys
from UI import layout
import serial.tools.list_ports
import pyqtgraph
import time
import math
import pyqtgraph as pg
import json
from server.tcp import tcp_server
from server.udp import udp_server
from server... | 2.53125 | 3 |
tridentstream/dbs/shelve/tests.py | tridentstream/mediaserver | 6 | 42162 | import os
import shutil
import tempfile
import unittest
from django.test import TestCase
from ...plugins import DatabaseCacheLayer
from .handler import ShelfDatabasePlugin
class ShelfDatabaseTest(TestCase):
def setUp(self):
self.temp_path = tempfile.mkdtemp()
self.db_path = os.path.join(self.tem... | 2.390625 | 2 |
venv/Lib/site-packages/keystoneauth1/extras/_saml2/_loading.py | prasoon-uta/IBM-coud-storage | 48 | 42163 | <gh_stars>10-100
# 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, software
# di... | 1.757813 | 2 |
tests/common/test_op/relu6_grad.py | KnowingNothing/akg-test | 1 | 42164 | <filename>tests/common/test_op/relu6_grad.py
# Copyright 2019 Huawei Technologies Co., Ltd
#
# 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
#
# U... | 2.203125 | 2 |
draft/rpi_main.py | industrial-robotics-lab/omni-platform-python | 0 | 42165 | <filename>draft/rpi_main.py
#!/usr/bin/env python3
# Receive car control + Transmit video
import cv2, imutils, socket, base64
from threading import Thread
from communication import SerialTransceiver
from utils import rescale
import time
tcp_server_address = ("192.168.0.119", 10001)
udp_server_address = ("192.168.0.119... | 2.84375 | 3 |
Game6/Game6_kor.py | Chomin21/Games | 0 | 42166 | <gh_stars>0
# 저자: Charles
# 공공 번호; Charles의 피카츄
# python 작은 게임 시리즈 만들기 - FlappyBird
import Bird
import Pipe
import pygame
from pygame.locals import *
# 일부 상수 정의
WIDTH, HEIGHT = 640, 480
# 메인 함수
def main():
# 초기화
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT), 0, 32)
pygame.dis... | 2.796875 | 3 |
experiments/visualization/constraint_visualization_gm.py | hsivan/automon | 1 | 42167 | <filename>experiments/visualization/constraint_visualization_gm.py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from test_utils.functions_to_monitor import func_entropy, func_variance
from automon import GmEntropyNode, GmVarianceNode
from test_utils.node_stream import NodeStrea... | 2.46875 | 2 |
experiments/make_index.py | ericmjl/protein-systematic-characterization | 0 | 42168 | <gh_stars>0
import os
from pypandoc import convert_file
def get_md_files(directory):
"""
Iterates over all files in a directory and returns a list of markdown
files that are present in that directory.
"""
md_files = []
for f in os.listdir(directory):
if f.endswith(('.md', '.MD', '.mark... | 3.078125 | 3 |
kjn_biedronka_demo/kjn_pricetag/apps.py | kornellewy/kjn_biedronka_demo | 1 | 42169 | from django.apps import AppConfig
class KjnPricetagConfig(AppConfig):
name = 'kjn_pricetag'
| 1.125 | 1 |
mingle/utilities/scatter_corner.py | jason-neal/companion_simulations | 1 | 42170 | <filename>mingle/utilities/scatter_corner.py
import numpy as np
from pandas.compat import lrange, zip
from pandas.core.dtypes.missing import notnull as notna
from pandas.plotting._tools import _set_ticks_props, _subplots
# Adapted slightly from pandas scatter matrix. pass plotting if in the corner you dont want to sh... | 3.484375 | 3 |
Competitive_Coding/Ways_to_Climbing_Up_Stairs.py | Arko98/Alogirthms | 5 | 42171 | # Problem Statement: https://leetcode.com/problems/climbing-stairs/
class Solution:
def climbStairs(self, n: int) -> int:
# Base Cases
if n==1:
return 1
if n==2:
return 2
# Memoization
memo_table = [1]*(n+1)
# Initializati... | 3.703125 | 4 |
REESSimulation/solver.py | erleben/pyREES | 3 | 42172 | <filename>REESSimulation/solver.py
import sys
sys.path.append('/usr/local/lib/python/')
import openmesh as OM
import numpy as np
import scipy.sparse as sparse
import REESMath.vector3 as V3
import REESMath.quaternion as Q
import REESMath.matrix3 as M3
import REESMass.mass as MASS
import REESMesh.mesh as MESH
import R... | 2.40625 | 2 |
orders/constants.py | pmaigutyak/mp-shop-orders | 0 | 42173 | <filename>orders/constants.py
from django.utils.translation import ugettext_lazy as _
DAYS_OF_WEEK = [
_('Monday'),
_('Tuesday'),
_('Wednesday'),
_('Thursday'),
_('Friday'),
_('Saturday'),
_('Sunday')
]
| 1.609375 | 2 |
test-scheduler/server/src/step/step_manager.py | opnfv/bottlenecks | 1 | 42174 | <gh_stars>1-10
##############################################################################
# Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this... | 2 | 2 |
models.py | Fernan1122/BusinessWork_Back | 0 | 42175 | from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DATE
from sqlalchemy.orm import relationship
from database import Base
class User(Base):
__tablename__ = "users"
username = Column(String, primary_key=True, index=True)
email = Column(String, unique=True, index=True)
name = Column(... | 2.921875 | 3 |
src/drivers/misc/status.py | isys-vision/rosweld_drivers | 2 | 42176 | <filename>src/drivers/misc/status.py
#pylint: skip-file
"""
ROSWELD
Version 0.0.1, March 2019
http://rosin-project.eu/ftp/rosweld
Copyright (c) 2019 PPM Robotics AS
This library is part of ROSWELD project,
the Focused Technical Project ROSWELD - ROS based framework
for planning, monitoring and control of multi-pass r... | 2.0625 | 2 |
openpathsampling/high_level/part_in_b_tps.py | bolhuis/openpathsampling | 64 | 42177 | from openpathsampling.high_level.network import FixedLengthTPSNetwork
from openpathsampling.high_level.transition import FixedLengthTPSTransition
import openpathsampling as paths
class PartInBFixedLengthTPSTransition(FixedLengthTPSTransition):
"""Fixed length TPS transition accepting any frame in the final state.
... | 2.4375 | 2 |
misc/rename_testset.py | dekape/rsna-xray | 0 | 42178 | <gh_stars>0
import os
import random
import pandas as pd
EXTENSIONS = ["PNG", "png"]
def is_valid_image(img_path):
ext = img_path.split(".")[-1]
if ext in EXTENSIONS:
return True
else:
return False
def get_img_paths(path):
print("Reading images in %s"%path)
img_paths = []
for... | 2.71875 | 3 |
players/admin.py | rymcimcim/django-foosball | 1 | 42179 | from django.contrib import admin
from players.models import Player
class PlayerAdmin(admin.ModelAdmin):
pass
admin.site.register(Player, PlayerAdmin)
| 1.453125 | 1 |
sistemaDeGestaoDeServicosPublicos/Orgao/views.py | deyviddalbem/TrabalhoDeConclusaoDeCurso | 0 | 42180 | <reponame>deyviddalbem/TrabalhoDeConclusaoDeCurso<filename>sistemaDeGestaoDeServicosPublicos/Orgao/views.py
import json
from social_django.models import UserSocialAuth
from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView
from django.shortcuts import render, redirect, get_object_or_4... | 2.03125 | 2 |
payments/utils.py | Ashwin-Dev-P/Thumki-Final-Hosting | 1 | 42181 | from . import Checksum
from django.conf import settings
import requests
import json
def VerifyPaytmResponse(response):
response_dict = {}
if response.method == "POST":
data_dict = {}
for key in response.POST:
data_dict[key] = response.POST[key]
MID = data_dict['MID']
... | 2.234375 | 2 |
main/Scraper.py | tanishkaa31/Air-Quality-Index-Prediction | 1 | 42182 | <gh_stars>1-10
import requests
from datetime import datetime
import pandas as pd
from .models import Data,Data_Predicted
data = Data()
data1 = Data_Predicted()
def scrap():
url = "https://api.ambeedata.com/latest/by-city"
querystring = {"city":"Delhi"}
headers = {
'x-api-key': "<KEY>",
... | 2.890625 | 3 |
metaflow/tests/flows/joins.py | celsiustx/metaflow | 1 | 42183 | <filename>metaflow/tests/flows/joins.py<gh_stars>1-10
from metaflow import FlowSpec
from metaflow import api as ma
from metaflow.api import foreach, step, join
class OldJoinFlow1(FlowSpec):
@step
def start(self):
self.next(self.generate_ints)
@step
def generate_ints(self):
self.ints =... | 2.359375 | 2 |
src/model/base_net.py | timctho/random-wired-nn-tensorflow | 8 | 42184 | <reponame>timctho/random-wired-nn-tensorflow
import os
import tensorflow as tf
class RandWire(object):
def __init__(self, config, is_training):
self.base_channel = config['Model']['base_channel']
self.is_training = is_training
self.num_class = config['Data']['num_class']
self.grap... | 2.34375 | 2 |
client/client.py | paoli7612/Elements | 4 | 42185 | <gh_stars>1-10
import socket, time, threading
class Client:
def __init__(self):
self.running = True
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def start(self, ip, port):
connected = False
timeout = 0
while not connected:
try:
... | 3.15625 | 3 |
Server/Python/utils/dbs3_logfile_parser.py | vkuznet/DBS | 8 | 42186 | <filename>Server/Python/utils/dbs3_logfile_parser.py<gh_stars>1-10
#!/usr/bin/env python
from __future__ import print_function
from optparse import OptionParser
import json, os, re, sys
def get_command_line_options(executable_name, arguments):
parser = OptionParser(usage="%s options" % executable_name)
parser.... | 2.703125 | 3 |
cyberdynedyndnscli/__init__.py | droberin/cyberdyne-dyndns | 0 | 42187 | import time
import datetime
import requests
class CyberdyneDynDns():
debug = False
hostname = None
username = None
password = <PASSWORD>
last_known_external_ip_address = None
# server_address = "https://cyberdyne.es/dyndns/update"
server_address = "http://api.cyberdyne.es/update/dyndns"
... | 2.921875 | 3 |
caffe2/python/operator_test/jsd_ops_test.py | chocjy/caffe2 | 585 | 42188 | # Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 1.945313 | 2 |
PROJECTS/concatination.py | varunverma760/fpga-from-coursera | 1 | 42189 | #concatenation
# youtuber = " <NAME>" #some string concatenation
# print("subscribe to "+ youtuber)
# print("subscribe to {}" .format(youtuber))
# print(f"subscriber to {youtuber}")
adj= input("Adjective: ")
verb1 = input("Verb: ")
verb2 = input("Verb: ")
famous_person = input("Famous Person: ")
madlib = f"Computer is... | 4.03125 | 4 |
trilearn/graph/subtree_sampler.py | melmasri/trilearn | 10 | 42190 | from collections import deque
import networkx as nx
import numpy as np
def random_subtree(T, alpha, beta, subtree_mark):
""" Random subtree of T according to Algorithm X in [1].
Args:
alpha (float): probability of continuing to a neighbor
beta (float): probability of non empty subtree
... | 3.4375 | 3 |
train.py | FlashTek/attention-is-all-you-need-keras | 25 | 42191 | <filename>train.py
from model import create_model
from utility.utility import load_training_data, load_validation_data
from utility.language_encoder import LanguageEncoder
import numpy as np
import keras.backend as K
from keras.models import load_model
import pathlib
from matplotlib import pyplot as plt
from keras.opti... | 2.75 | 3 |
apero/core/constants/param_functions.py | njcuk9999/apero-drs | 1 | 42192 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Constants parameter functions
DRS Import Rules:
- only from apero.lang and apero.core.constants
Created on 2019-01-17 at 15:24
@author: cook
"""
from collections import OrderedDict
import copy
import numpy as np
import os
import pkg_resources
import shutil
import sy... | 2.03125 | 2 |
test/integration/ggrc/converters/test_import_issuetracked_objects.py | pavelglebov/ggrc-core | 1 | 42193 | <filename>test/integration/ggrc/converters/test_import_issuetracked_objects.py<gh_stars>1-10
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Integration tests for IssueTracker updates via import cases."""
# pylint: disable=invalid-name,too-many-public... | 2.09375 | 2 |
clubadm/apps.py | clubadm/clubadm | 25 | 42194 | from django.apps import AppConfig
class ClubADMConfig(AppConfig):
name = "clubadm"
verbose_name = "Клуб анонимных Дедов Морозов"
| 1.15625 | 1 |
algs/0053_Maximum_Subarray.py | torpedoallen/leetcodes | 0 | 42195 | <reponame>torpedoallen/leetcodes
import sys
class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
if n == 1:
return nums[0]
v_now, v_max = 0, -sys.maxsize
for i in range(n):
... | 3.171875 | 3 |
Semana 2/7.Imagenes digitales/midiendo el tiempo.py | NSnietol/IntroduccionVisionComputadorOpenCVedX | 0 | 42196 | from math import sin #para usar la función seno
from time import time #importamos la función time para capturar tiempos
x = list(range(0,100)) #vector de valores desde 0 a 99
y = [0.0 for i in range(len(x))] #inicializamos el vector de resultados con 100 valores 0.0
tiempo_inicial = time()
for i in range(100):... | 3.234375 | 3 |
apps/nagios/views.py | crazy-canux/zmonitoring | 0 | 42197 | # -*- coding: utf-8 -*-
# Copyright (C) <NAME> <<EMAIL>>
#
# 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,... | 1.617188 | 2 |
Dataset/Leetcode/train/55/147.py | kkcookies99/UAST | 0 | 42198 | class Solution:
def XXX(self, nums: List[int]) -> bool:
l = len(nums)
start = l-1
end = 1
for index in range(1,l):
val = nums[start - index]
if val >= end:
end = 1
else:
end += 1
return end == 1
| 2.8125 | 3 |
app/main/forms.py | Tee-Mureithi/pitches-app | 0 | 42199 | from flask_wtf import Form
from flask_wtf import FlaskForm
from wtforms import StringField,TextAreaField,SubmitField,SelectField
#from flask_wtf import import Required
#from wtforms.validators import Required
class PitchForm(FlaskForm):
title = StringField('Pitch title')
text = TextAreaField('Text')
cate... | 2.71875 | 3 |