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 |
|---|---|---|---|---|---|---|
src/bananas/admin/api/schemas/__init__.py | beshrkayali/django-bananas | 26 | 54600 | from drf_yasg.utils import (
swagger_auto_schema as schema,
swagger_serializer_method as schema_serializer_method,
)
from .yasg import (
BananasSimpleRouter as BananasRouter,
BananasSwaggerSchema as BananasSchema,
)
__all__ = (
"schema",
"schema_serializer_method",
"BananasRouter",
"Ba... | 1.507813 | 2 |
cami/scripts/windows.py | hugmyndakassi/hvmi | 677 | 54601 | #
# Copyright (c) 2020 Bitdefender
# SPDX-License-Identifier: Apache-2.0
#
import yaml
import struct
import os
import crc32
from options import get_options_for_os_version
from objects import CamiYAMLObject, CamiObject, CamiAtom, CamiDataTable, FilePointerException, get_all_objects
from common import IntrocoreVersion
fr... | 1.984375 | 2 |
tests/test_fstore.py | dsroche/obliv | 2 | 54602 | <reponame>dsroche/obliv<filename>tests/test_fstore.py
#!/usr/bin/env python3
"""Test program for the fstore class."""
import unittest
import tempfile
import random
from obliv import fstore
def randbytes(s):
return bytes(random.getrandbits(8) for _ in range(s))
class TestFstore(unittest.TestCase):
def setUp(... | 2.71875 | 3 |
application/libraries/python-parse-html/get-links.py | vutran-vn/research-project | 0 | 54603 | #!/usr/bin/env python2
from bs4 import BeautifulSoup
import urllib2
import json
import re
import time
config_siblings = [];
#Read data from config.json
with open('../../../data/links/config-siblings.json', 'r') as f1:
try:
config_siblings = json.load(f1)
# if the file is empty the ValueError will be th... | 2.734375 | 3 |
label_mapping.py | AbdulSaif/Image-Classifier | 0 | 54604 | # This function takes a file that has labels and flowers name reads it and it
# then returns it as dictionary containing labels as index and flowers name as
# values
def label_mapping(filename):
# importing required python module to read .json file
import json
with open(filename, 'r') as f:
label_... | 3.953125 | 4 |
KOPy/instruments/osiris/ddf.py | alexrudy/KOPy | 0 | 54605 | # -*- coding: utf-8 -*-
"""
Data Definition File
"""
import astropy.units as u
from astropy.coordinates import SkyCoord
from .coords import OsirisInstrumentFrame
from ..coords import AstrometricFrame
class SpectrographParameters(object):
"""Spectrograph parameters"""
def __init__(self, filter, scale, itime, ... | 2.703125 | 3 |
0064.minimum_path_sum/solution.py | WZMJ/Algorithms | 5 | 54606 | from typing import List
class Solution:
def min_path_sum(self, grid: List[List[int]]) -> int:
"""
到达一个节点只有两种情况,上面的节点和左边的节点,只需要算个较小值,就是最小路径
f(i, j) = min(f(i-1, j), f(i, j-1)) + grid(i, j)
还可以直接修改原数组,空间复杂度为O(1)
"""
ans = [0] * len(grid[0])
ans[0] = grid[0][0... | 3.640625 | 4 |
Chapter08/src/config.py | jvstinian/Python-Reinforcement-Learning-Projects | 114 | 54607 | child_network_params = {
"learning_rate": 3e-5,
"max_epochs": 100,
"beta": 1e-3,
"batch_size": 20
}
controller_params = {
"max_layers": 3,
"components_per_layer": 4,
'beta': 1e-4,
'max_episodes': 2000,
"num_children_per_episode": 10
}
| 1.171875 | 1 |
2._Learning_Python/A._Basic_-_no_OOP/5._Dicts_and_Sets/2._Sets/set_1_challenge.py | sanjarcode/python3_notes | 0 | 54608 | # WAP that takes some text and returns a list of all characters
# in the text which are not vowels, sorted in alphabetical order.
# You can either enter the text from the keyboard or
# initialize a string variable with the string
# soln get the set and subtract the set from the vowels set
# text = set(input().lower()... | 3.921875 | 4 |
main/forms.py | Unryh/rcevo | 0 | 54609 | # -*- coding: utf-8 -*-
# from django.contrib.auth.models import User
from django import forms
from models.models import AdvancedUser, CommentModel
import django.forms.widgets as widgets
class UserForm(forms.ModelForm):
username = forms.CharField(min_length=3, max_length=40)
password = forms.CharField(widget=... | 2.65625 | 3 |
udec/ulogger.py | flasker/udec | 0 | 54610 | <filename>udec/ulogger.py<gh_stars>0
#!/usr/bin/python
###############################################################################
## Description
###############################################################################
###############################################################################
## Impor... | 2.15625 | 2 |
python/ejercicios/pokemons/__init__.py | fhuertas/uah-mbi-2019-streaming | 2 | 54611 | SEED = 1
TOPIC_POKEMONS = 'pokemons'
TOPIC_USERS = 'users'
GROUP_DASHBOARD = 'dashboard'
GROUP_LOGIN_CHECKER = 'checker'
DATA = 'data/pokemon.csv'
COORDINATES = {
'GAUSS_LAT_MADRID': {'mu': 40.45, 'sigma': 0.2},
'GAUSS_LON_MADRID': {'mu': -3.60, 'sigma': 0.4},
'GAUSS_LAT_SEGOVIA': {'mu': 40.95, 'sigma': ... | 1.3125 | 1 |
Fun With Python/Convert_Photo_to_sketch.py | abhim4536/Python-Game | 0 | 54612 | from tkinter import ttk
from tkinter import *
import cv2
from tkinter.filedialog import *
root = Tk()
root.withdraw
o_file = askopenfilename(initialdir = os.getcwd(), title = "Select Image File", filetypes = (("jpg file", "*.jpg"), ("png file", "*.png"),("jpeg file", "*.jpeg"), ("All file", "*.*")))
image = cv2.imread... | 3 | 3 |
renamerename/tests/test_app.py | mhmdkanj/RenameRename | 0 | 54613 | import pytest
import os
import re
import json
from renamerename.executor.app import run, parse_args
class TestApp:
@pytest.fixture
def dir_files(self):
return set(['wintercourse_doc.tar.gz', 'img.jpeg',
'summercourse_doc.tar.gz', 'icon.png',
'fallcourse_doc.tar... | 2.296875 | 2 |
setup.py | caedonhsieh/ps-munna | 0 | 54614 | <reponame>caedonhsieh/ps-munna
from setuptools import setup
with open('README.md') as file:
long_description = file.read()
# TODO - replace with details of your project
setup(
name='munna',
description='Pokemon Showdown MatchUp Neural Network Analysis',
version='0.0.1',
author='<NAME>',
auth... | 1.460938 | 1 |
answers/leetcode/Longest Valid Parentheses/Longest Valid Parentheses.py | FeiZhan/Algo-Collection | 3 | 54615 | <reponame>FeiZhan/Algo-Collection
class Solution(object):
def longestValidParentheses(self, s):
"""
:type s: str
:rtype: int
"""
longest = 0
stack = []
begin = -1
for i in range(len(s)):
if '(' == s[i]:
stack.append(i)
... | 2.9375 | 3 |
src/anaplan_api/ImportTask.py | pieter-pot/anaplan-api | 0 | 54616 | <filename>src/anaplan_api/ImportTask.py
from .TaskFactory import TaskFactory
from .AnaplanConnection import AnaplanConnection
from .Action import Action
from .ParameterAction import ParameterAction
from .Parser import Parser
from .ImportParser import ImportParser
class ImportTask(TaskFactory):
"""Factory to generate... | 2.75 | 3 |
asab/web/webcrypto.py | TeskaLabs/asab | 23 | 54617 | import base64
import secrets
import cryptography.hazmat.primitives.ciphers
import cryptography.hazmat.primitives.ciphers.algorithms
import cryptography.hazmat.primitives.ciphers.modes
import cryptography.hazmat.backends
'''
This module provides AES GCM based payload protection.
Flow:
1. aes_gcm_generate_key() to ge... | 2.734375 | 3 |
01-Exercicios/Aula007/Ex2.py | AmandaRH07/Python_Entra21 | 0 | 54618 | #--- Exercício 2 - Funções
#--- Escreva uma função que leia dois números do console
#--- Armazene cada número em uma variável
#--- Realize a divisão entre os dois números e armazene o resultado em uma terceira variável
#--- Imprima o resultado e uma mensagem usando f-string
def divisao(num1, num2):
if num2 == 0:
... | 4.125 | 4 |
testfinal.py | JDMusc/Online-Bullying-Image-Classifcation | 0 | 54619 | from PIL import Image
import sys
import torch
import preprocessing as pp
import vggTransfer
f_name = str(sys.argv[1])
device = torch.device("cuda")
vgg = vggTransfer.loadVgg(n_classes = 10)
if torch.cuda.is_available():
vgg = vgg.to(device)
vgg.load_state_dict(torch.load('model_11.pt'))
vgg.eval()
tform = pp... | 2.453125 | 2 |
get-target-sequences.py | germs-lab/illumina-redesign-allen | 0 | 54620 | import sys, screed
d = {}
for record in screed.open(sys.argv[1]):
ncbi_id = record.name.split(' ')[0].rsplit('|',2)[1]
seq = record.sequence
d[ncbi_id] = seq
for line in open(sys.argv[2]):
assay, ncbi, start, end = line.rstrip().split('\t')
start = int(start)
end = int(end)
target = d[ncbi... | 2.5625 | 3 |
tests/tfTests/testTrans2L.py | Los-Phoenix/Word2vec_LP | 1 | 54621 | #coding:utf-8
#这个文件是一层的迁移网络:
import sys
import numpy as np
import tensorflow as tf
from tensorflow.contrib import learn
reload(sys)
sys.setdefaultencoding('utf-8')
#gensim文件的读取
#思路是这样的:
#先读取两个字典:word 和 char
#再打开word 的embedding,构建wordEmbedding
#再打开char的embedding,构建charEmbedding
#再查一下
#把输入层和输出层打印出来就好了
fDictWord = open... | 3.09375 | 3 |
tests/testsClean.py | ttm/gmaneLegacy | 1 | 54622 | import gmaneLegacy as g, importlib
dl=g.DownloadGmaneData('~/.gmane2/')
dl.downloadListIDS()
#dl.getDownloadedLists()
#dl.correctFilenames()
dl.cleanDownloadedLists()
| 1.664063 | 2 |
Python2/Modulo_3_exe_pratico.py | Belaschich/SoulON | 0 | 54623 | <filename>Python2/Modulo_3_exe_pratico.py
"""
1. Crie uma base de dados chamada sistema_escolar_soul_on
2. Crie uma tabela alunos com os campos id, nome, matricula, turma.
3. Alimente a tabela com os seguintes dados:
"""
import mysql.connector
db = mysql.connector.connect(
host = "localhost",
user = "root",
... | 3.3125 | 3 |
ude_ros_env/ude_ros_env/ros_env_side_channel.py | aws-deepracer/ude-ros-bridge | 1 | 54624 | #################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"). ... | 1.75 | 2 |
docker/config.py | DerryHub/the-TaobaoLive-Commodity-Identify-Competition | 4 | 54625 | <filename>docker/config.py<gh_stars>1-10
import argparse
def get_args_efficientdet():
parser = argparse.ArgumentParser("EfficientDet")
parser.add_argument("--image_size", type=int, default=512, help="The common width and height for all images")
parser.add_argument("--batch_size", type=int, default=128, hel... | 2.28125 | 2 |
scripts/get-html-for-url.py | isoboroff/crawl-eval | 7 | 54626 | #!/usr/bin/env python3.5
import json
from json import JSONDecodeError
import sys
from collections import Counter
from urllib.parse import urlsplit
import argparse
lineno = 0
ctypes = Counter()
parser = argparse.ArgumentParser(description='Dump the raw web page content given a URL from the JSON on stdin')
parser.add_a... | 3.296875 | 3 |
lrcpaser.py | dewrfe53535/misc | 0 | 54627 | <reponame>dewrfe53535/misc
# -!- coding: utf-8 -!-
import time
import copy
def lrcremoveinfo(lrc):
lines = lrc.split('\n')
if lines[-1] == '':
afterlines = copy.deepcopy(lines)[:-1]
else:
afterlines = copy.deepcopy(lines)
offs = 0
for i in range(len(afterlines)): #忽略所有ID标签
... | 2.703125 | 3 |
src/utils/live.py | LadaOndris/IBT | 0 | 54628 | import matplotlib.pyplot as plt
import numpy as np
import pyrealsense2 as rs
from src.utils.plots import _plot_depth_image_live
def generate_live_images():
pipe = rs.pipeline()
cfg = rs.config()
cfg.enable_stream(rs.stream.depth, 640, 480)
pipe.start(cfg)
try:
while True:
fram... | 2.640625 | 3 |
Project 14 -- Deep Cardiac Segmentation/rvseg/models/__init__.py | Vauke/Deep-Neural-Networks-HealthCare | 274 | 54629 | <reponame>Vauke/Deep-Neural-Networks-HealthCare
from .convunet import unet
from .dilatedunet import dilated_unet
from .dilateddensenet import dilated_densenet, dilated_densenet2, dilated_densenet3
| 1.132813 | 1 |
modules/faculty_calc.py | u-keisuke/UT_calculator | 0 | 54630 | <gh_stars>0
import numpy as np
from collections import defaultdict
def f_calc(s_dict):
f_data_dict = {}
for senior_faculty, array in s_dict.items():
array = np.array(array)
f_data_dict[senior_faculty]={}
f_data_dict[senior_faculty]["average"] = array.mean()
f_data_dict[sen... | 2.859375 | 3 |
todo/migrations/0001_initial.py | jonpas/FERI-WebApps | 0 | 54631 | # Generated by Django 3.0 on 2019-12-16 19:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='List',
fields=[
... | 1.757813 | 2 |
generate_demog_maps.py | AfricasVoices/Project-IMAQAL | 0 | 54632 | <filename>generate_demog_maps.py<gh_stars>0
import argparse
import json
from core_data_modules.cleaners import Codes
import sys
from collections import OrderedDict
import csv
from core_data_modules.logging import Logger
from core_data_modules.traced_data.io import TracedDataJsonIO
from src.lib import PipelineConfigur... | 2.4375 | 2 |
src/dsalgo/sqrt_decomposition.py | kagemeka/python-algorithms | 1 | 54633 | <gh_stars>1-10
from __future__ import annotations
import typing
from dsalgo.algebra.abstract.abstract_structure import Monoid
from dsalgo.number_theory.floor_sqrt import floor_sqrt
S = typing.TypeVar("S")
class SqrtDecomposition(typing.Generic[S]):
def __init__(self, monoid: Monoid[S], arr: list[S]) -> None:
... | 2.65625 | 3 |
Mali.py | CGATOxford/genserv-zope | 0 | 54634 | <gh_stars>0
import string
import re
import types
from cStringIO import StringIO
class AlignedString:
mGapChars = ("-", ".")
mGapChar = "-"
def __init__(self, identifier, fr, to, s):
self.mId = identifier
self.mFrom = fr
self.mTo = to
self.mString = s
def __len__(self... | 2.90625 | 3 |
tests/day13_test.py | zoeimogen/AoC2018 | 1 | 54635 | #!/usr/bin/python3
'''Advent of Code 2018 Day 15 tests'''
import unittest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from aoc2018 import day13 # pylint: disable=wrong-import-position
class TestUM(unittest.TestCase):
'''Unit Tests'''
def test_day13par... | 2.53125 | 3 |
src/run_sign.py | abhinavGupta16/opensearch-build | 0 | 54636 | <filename>src/run_sign.py
#!/usr/bin/env python
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
import sys
from sign_workflow.sign_args import SignArgs
from sign_workflow.si... | 2.09375 | 2 |
recohut/models/lorentzfm.py | sparsh-ai/recohut | 0 | 54637 | <reponame>sparsh-ai/recohut
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/models/models.lorentzfm.ipynb (unless otherwise specified).
__all__ = ['LorentzFM']
# Cell
import torch
from torch import nn
from itertools import combinations
from .layers.embedding import EmbeddingLayer
from .layers.interaction import Inn... | 2.015625 | 2 |
tests/func_tests/test_items.py | grololo06/jinja2schema | 0 | 54638 | # coding: utf-8
import pytest
from jinja2schema import InvalidExpression
from jinja2schema.core import infer
from jinja2schema.model import Dictionary
def test_items():
template = '''
{% macro selectinputdict(name, values, value=0, addemptyrow=false ,extrataginfo='') -%}
<select name="{{ name }}" id="{{ name... | 2.328125 | 2 |
ndg_oauth_server/ndg/oauth/server/lib/register/register_base.py | cedadev/ndg_oauth | 2 | 54639 | """OAuth 2.0 WSGI server middleware providing MyProxy certificates as access tokens
"""
__author__ = "<NAME>"
__date__ = "12/12/11"
__copyright__ = "(C) 2011 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "<EMAIL>"
__revision__ = "$Id$"
from beake... | 2.34375 | 2 |
switch_inputs/__init__.py | Switch-Mexico/switch-inputs | 1 | 54640 | <gh_stars>1-10
# This file is needed to impport the package
import os
import sys
# Append current folder to path
ROOT = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, ROOT)
from cli import main
def cli():
return main(obj={})
if __name__ == '__main__':
cli()
| 1.945313 | 2 |
lib/junno/datasets/dataset.py | LIV4D/JuNNo | 0 | 54641 | <reponame>LIV4D/JuNNo<filename>lib/junno/datasets/dataset.py
"""This module is used to build **Dataset**
which are a convenient way to deal with database. Each dataset contains a primary key identifying a row,
and one or many columns. A column is an instance of :class:`DataSetColumn`.
In the general idea, a dataset ne... | 2.90625 | 3 |
src/features/plinkio.py | cnr-ibba/SMARTER-database | 0 | 54642 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 9 15:58:40 2021
@author: <NAME> <<EMAIL>>
Try to model data operations on plink files
"""
import io
import re
import csv
import logging
from pathlib import Path
from dataclasses import dataclass
from tqdm import tqdm
from mongoengine.errors imp... | 2.125 | 2 |
subtractor/pixel.py | sthagen/subtractor | 0 | 54643 | <reponame>sthagen/subtractor
# -*- coding: utf-8 -*-
# pylint: disable=c-extension-no-member,expression-not-assigned,line-too-long,logging-fstring-interpolation
"""Juggle with pixels."""
import typing
import png # type: ignore
from PIL import Image # type: ignore
from pixelmatch.contrib.PIL import pixelmatch
OPTION... | 2.515625 | 3 |
src/configs/config.py | kumardeepak/file-server | 0 | 54644 | <filename>src/configs/config.py
import logging
import os
import configs
from configs import development as dev_config
logging.basicConfig(
filename=os.getenv("SERVICE_LOG", "server.log"),
level=logging.DEBUG,
format="%(levelname)s: %(asctime)s \
pid:%(process)s module:%(module)s %(message)s",
d... | 2.0625 | 2 |
Algorithms_medium/1698. Number of Distinct Substrings in a String.py | VinceW0/Leetcode_Python_solutions | 4 | 54645 | <reponame>VinceW0/Leetcode_Python_solutions<filename>Algorithms_medium/1698. Number of Distinct Substrings in a String.py
"""
1698. Number of Distinct Substrings in a String
Medium
Given a string s, return the number of distinct substrings of s.
A substring of a string is obtained by deleting any number of characters... | 3.984375 | 4 |
tests/unit_tests/test_version.py | realead/cyvml | 0 | 54646 | <gh_stars>0
import unittest
import cyvml
class VersionTester(unittest.TestCase):
def test_major(self):
self.assertEqual(cyvml.__version__[0], 0)
def test_minor(self):
self.assertEqual(cyvml.__version__[1], 1)
def test_last(self):
self.assertEqual(cyvml.__version__[2], 0)
| 2.59375 | 3 |
AtCoder/ABC/000-159/ABC144_C.py | sireline/PyCode | 0 | 54647 | import math
N = int(input())
for i in range(1, int(math.sqrt(N))+1)[::-1]:
if N%i == 0:
print(N//i+i-2)
break
| 3.359375 | 3 |
wxPython/build/Mac/setup_daemon.py | typeWorld/typeWorldApp | 13 | 54648 | <filename>wxPython/build/Mac/setup_daemon.py
from setuptools import setup
import os
from ynlib.web import GetHTTP
version = GetHTTP('https://api.type.world/latestUnpublishedVersion/world.type.guiapp/mac/')
if version == 'n/a':
print('Can’t get version number')
sys.exit(1)
os.system('rm -rf ~/Code/TypeWorldApp... | 2.078125 | 2 |
hdlConvertor/__init__.py | the-moog/hdlConvertor | 184 | 54649 | from ._hdlConvertor import HdlConvertorPy as HdlConvertor, ParseException | 1.15625 | 1 |
labelbox/data/serialization/ndjson/__init__.py | nickaustinlee/labelbox-python | 0 | 54650 | from .converter import NDJsonConverter
| 1.101563 | 1 |
optimus/engines/cudf/cudf.py | Pcosmin/Optimus | 1,045 | 54651 | class CUDF:
def __init__(self):
self._cudf = None
| 1.546875 | 2 |
restaurant/schema.py | miguel550/restaurant | 0 | 54652 | import graphene
import dishes.schema
class Query(dishes.schema.Query, graphene.ObjectType):
pass
class Mutations(graphene.ObjectType):
create_category = dishes.schema.CreateCategory.Field()
edit_category = dishes.schema.EditCategory.Field()
delete_category = dishes.schema.DeleteCategory.F... | 2 | 2 |
poem/Poem/poem_super_admin/migrations/0001_initial.py | kzailac/poem | 0 | 54653 | # Generated by Django 2.0.9 on 2019-04-30 08:38
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Probe',
fields=[
('id', models.AutoField(au... | 1.882813 | 2 |
factorial.py | Rajashekar2504/GitBasics | 0 | 54654 | def factorial(n):
if n == 1:
return n
else:
return n*factorial(n-1)
number = int(input("Enter a number: "))
if number < 0:
print("Sorry, factorial does not exist for negative numbers")
elif number == 0:
print("The factorial of 0 is 1")
els... | 4.1875 | 4 |
forest/core.py | mobilecoinofficial/forest | 17 | 54655 | <reponame>mobilecoinofficial/forest
#!/usr/bin/python3.9
# Copyright (c) 2021 MobileCoin Inc.
# Copyright (c) 2021 The Forest Team
"""
The core chatbot framework: Message, Signal, Bot, PayBot, and app
"""
import ast
import asyncio
import asyncio.subprocess as subprocess # https://github.com/PyCQA/pylint/issues/1469
im... | 1.796875 | 2 |
docs/source/platformdirective.py | mgrundy/sikuli | 1,292 | 54656 | <gh_stars>1000+
from sphinx import addnodes
from sphinx.util.compat import Directive
from sphinx.util.compat import make_admonition
from docutils import nodes
class platform_node(nodes.Admonition, nodes.Element): pass
class PlatformDirective(Directive):
has_content = True
required_arguments = 1
optional_a... | 2.203125 | 2 |
pinga/_nbdev.py | hmelberg/pinga | 0 | 54657 | # AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"nothing_here": "00_core.ipynb",
"expand_hyphen": "notation.ipynb",
"del_dot": "notation.ipynb",
"del_zero": "notation.ipynb",
"get_unique": "notation.ipynb",
"exp... | 1.695313 | 2 |
src/proposals/tests/test_templatetags.py | kaka-lin/pycon.tw | 47 | 54658 | import pytest
from django.contrib.auth import get_user_model
from django.template import Context, Template
from proposals.models import AdditionalSpeaker, TalkProposal
def render_template(template_string, context_data=None):
context_data = context_data or {}
return Template(template_string).render(Context(c... | 2.296875 | 2 |
cumulative_function.py | lwoznicki/Python-simple-code | 0 | 54659 | <gh_stars>0
def cumulative(list_of_numbers):
cumulative_sum = 0
new_list = []
for i in list_of_numbers:
cumulative_sum += i
new_list.append(cumulative_sum)
return new_list
list = [1,2,3,4,5,6,7,8,9]
print(cumulative(list)) | 3.625 | 4 |
documents/models.py | acdh-oeaw/thunau-old | 0 | 54660 | from django.db import models
from django.core.urlresolvers import reverse
from vocabs.models import SkosConcept
from places.models import Place
from bib.models import Book
class Institution(models.Model):
name = models.CharField(max_length=300, blank=True)
abbreviation = models.CharField(max_length=300, blank... | 2.28125 | 2 |
abstract-factory/BeforeAbstractFactory/__main__.py | Tomvictor/python-design-patterns | 0 | 54661 | <gh_stars>0
from factories.gm import ChevySpark, ChevyCamaro, CadillacCTS
from factories.ford import FordFiesta, FordMustang, LincolnMKS
from random import randint
makers = ('gm', 'ford')
editions = ('Econonmy', 'Sport', 'Luxury')
maker = makers[randint(0, 1)]
edition = editions[randint(0, 2)]
if maker == 'g... | 2.921875 | 3 |
run.py | Terkea/Shared-Power | 3 | 54662 | import threading
import app.models
import app.view
import calendar
from datetime import date, datetime
from app.models import session
from app.models.booking import Booking
from app.models.returns import Returns
def init_database():
app.models.__init__
def init_gui():
app.view.__init__
def generate_invo... | 2.484375 | 2 |
disp/analysis/airssutils.py | zhubonan/disp | 1 | 54663 | <gh_stars>1-10
"""
Toolkit for working with AIRSS style SHELX files
Collection of function to work with AIRSS
"""
import re
from collections import namedtuple
from subprocess import check_output
import pandas as pd
import numpy as np
from ase import Atoms
from ase.geometry import cellpar_to_cell
from pymatgen.entri... | 2.171875 | 2 |
plugins/example_collector/test/test_config.py | someengineering/resoto | 126 | 54664 | from resotolib.config import Config
from resoto_plugin_example_collector import ExampleCollectorPlugin
def test_config():
config = Config("dummy", "dummy")
ExampleCollectorPlugin.add_config(config)
Config.init_default_config()
# assert Config.example.region is None
| 1.78125 | 2 |
tests/html_form/test_form.py | filfreire/questions-three | 5 | 54665 | from unittest import TestCase, main
from urllib.parse import parse_qs, quote_plus, urlencode, urljoin
from expects import expect, be_empty, contain, equal
from twin_sister.expects_matchers import raise_ex
from questions_three.html_form import HtmlForm
import questions_three.html_form.exceptions as exceptions
from twi... | 2.703125 | 3 |
bzl/opam.bzl | obazl/orocksdb | 0 | 54666 | PACKAGES = {
"ctypes": ["0.17.1", ["ctypes.foreign"]],
"ctypes-foreign": ["0.4.0"], # WARNING: requires libffi-dev
}
opam = struct(
version = "2.0",
switches = {
"mina-0.1.0": struct(
default = True,
compiler = "4.07.1",
packages = PACKAGES
),
... | 1.601563 | 2 |
utility.py | kercos/PickMeUp | 10 | 54667 | # -*- coding: utf-8 -*-
import re
import logging
import string
import textwrap
from collections import OrderedDict
def representsInt(s):
try:
int(s)
return True
except ValueError:
return False
def representsFloat(s):
try:
float(s)
return True
except ValueError:
... | 3.328125 | 3 |
Head_Thread_0_39.py | fabiankung/RPiMV | 0 | 54668 | <filename>Head_Thread_0_39.py
# -*- coding: utf-8 -*-
"""
Codes to:
1. Enable multi-threading.
2. Open a serial communication thread using pySerial to interface with
external Robot Controller (RC).
3. Open raspiberry pi camera thread - picamera using native interface in a thread.
Default camera resolution ... | 3.03125 | 3 |
lego/apps/users/serializers/memberships.py | andrinelo/lego | 0 | 54669 | <gh_stars>0
from rest_framework import serializers
from lego.apps.users.fields import PublicUserField
from lego.apps.users.models import AbakusGroup, Membership, User
class MembershipSerializer(serializers.ModelSerializer):
user = PublicUserField(queryset=User.objects.all())
class Meta:
model = Memb... | 2.21875 | 2 |
ezcliy/positional.py | kpostekk/ezcliy | 0 | 54670 | <gh_stars>0
from typing import Optional, Any
from ezcliy.exceptions import MissingPositional
class Positional:
"""Asign value (by source order) to object, allows asking for value or provide default one."""
value: str = None
"""Fetched value by positional"""
description: str = None
"""Description... | 3.1875 | 3 |
test/unittest_split/unittest_split.py | FrancisLi196/featurizer | 0 | 54671 | <filename>test/unittest_split/unittest_split.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
import torch
from featurizer.functions.split import *
import create_expected_output_split as ceo
import numpy as np
import pandas as pd
class TestSplitMethods(unittest.TestCase):
def setUp(self):
... | 3 | 3 |
uiModels.py | wodiu188/LoR_Master | 1 | 54672 | <filename>uiModels.py
from typing import List
import json
class OpponentFlask:
def __init__(self):
self.history = []
class DeckDetail:
def __init__(self, matches: int , winNum: int, time: str):
self.matches = matches
self.winNum = winNum
self.time = time
self.history = ... | 2.5625 | 3 |
adict/__init__.py | arseniiv/adict | 0 | 54673 | # aDict — simple dictionary handling
#
# Authors:
# arseniiv <<EMAIL>>
#
# To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
# You should have received a ... | 0.804688 | 1 |
src/evaluateData/heart.py | berkott/SciFair | 2 | 54674 | <gh_stars>1-10
import heartpy as hp
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter
from scipy.signal import find_peaks, periodogram
import numpy as np
import glob
class heart:
def __init__(self):
basePath = "/home/berk/Code/SciFair/src"
print(glob.glob(basePath + '/assets... | 2.484375 | 2 |
draw.py | 23subbhashit/Virtual-pen | 0 | 54675 | import cv2
import numpy as np
class drawingCanvas():
def __init__(self):
self.penrange = np.load('penrange.npy')
self.cap = cv2.VideoCapture(0)
self.canvas = None
self.x1,self.y1=0,0
self.val=1
self.draw()
def draw(self):
while True:
... | 2.859375 | 3 |
pyramid_oereb/standard/create_yaml.py | openoereb/pyramid_oereb | 4 | 54676 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import optparse
import os
from mako.template import Template
from pyramid.path import AssetResolver
from shutil import copyfile
def _create_standard_yaml_config_(name='pyramid_oereb_standard.yml',
database='postgresql://postgres:password@localh... | 2.546875 | 3 |
Assignment 3. Paxos/Inputs/Input.py | WailAbou/Distributed-Processing | 0 | 54677 | <reponame>WailAbou/Distributed-Processing
from Simulation.Agents import Proposer, Acceptor
from Simulation.Message import Message, MessageTypes
from Simulation.Network import Event
proposers, acceptors = {}, {}
def read_input(file_path):
global proposers, acceptors
n_proposers, n_acceptors, max_ticks, event... | 2.734375 | 3 |
tutorials/W3D2_DynamicNetworks/solutions/W3D2_Tutorial2_Solution_a20da002.py | liuxiaomiao123/NeuroMathAcademy | 2 | 54678 | <filename>tutorials/W3D2_DynamicNetworks/solutions/W3D2_Tutorial2_Solution_a20da002.py
def EIderivs(E_grid, I_grid, pars):
"""
Time derivatives for E/I variables (dE/dt, dI/dt).
"""
tau_E, a_E, theta_E = pars['tau_E'], pars['a_E'], pars['theta_E']
tau_I, a_I, theta_I = pars['tau_I'], pars['a_I'], pars['the... | 2.71875 | 3 |
accounts/models.py | srijannnd/GetDoc-API | 0 | 54679 | <filename>accounts/models.py
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.base_user import AbstractBaseUser
from django.core.mail import send_mail
from accounts.managers import UserManager
from django.db... | 2.28125 | 2 |
BYSJ_GUI/test.py | LANCEREN/Graduation-Design_CSharp | 0 | 54680 | <filename>BYSJ_GUI/test.py
import cv2
import argparse
ap = argparse.ArgumentParser(description="python part")
input = ap.add_mutually_exclusive_group()
input.add_argument("-f","--file",type=str,help="input file path",default="default")
input.add_argument("--folder",type=str,help="input folder path",default="default")
... | 2.75 | 3 |
check.py | Knowledge-Graph-Hub/NEAT-kghub-scheduler | 0 | 54681 | <gh_stars>0
# check.py
"""Utility for checking KG-Hub projects for
updated NEAT config YAMLs.
If one is found, it is retrieved
and assigned a unique identifier based
on its bucket LastModified.
If:
* the config is in a build directory
* and there is not yet a graph_ml directory in that build dir
then the run continue... | 2.671875 | 3 |
tests/install_tools_locally.py | incerto-crypto/solitude | 7 | 54682 | import argparse
from solitude.tools import Solc, GanacheCli, EthLint
from solitude.common import update_global_config
from conftest import (
SOLIDITY_ALL_VERSIONS, GANACHE_ALL_VERSIONS, ETHLINT_ALL_VERSIONS, LOCAL_TOOLDIR)
def main():
p = argparse.ArgumentParser()
p.add_argument(
"--nolocks",
... | 2.25 | 2 |
Chapter 04/pjme_hourly_timeseries.py | bpbpublications/Time-Series-Forecasting-using-Deep-Learning | 7 | 54683 | <gh_stars>1-10
import matplotlib.pyplot as plt
from ch4.training_datasets import get_pjme_timeseries
plt.title('PJME Hourly')
plt.plot(get_pjme_timeseries()[:500])
plt.show()
| 2.15625 | 2 |
func.py | gcosne/OceanographyProject | 8 | 54684 | <gh_stars>1-10
# Usefull functions for notebooks
__author__ ='<EMAIL>'
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from sklearn.cluster import KMeans
import numpy as np
import os
import glob
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import matplo... | 3.109375 | 3 |
python/tests/test_1154.py | SousaPedro11/urionlinejudge | 0 | 54685 | <filename>python/tests/test_1154.py
import io
from unittest import TestCase
from unittest import mock
from unittest.mock import patch
from python.implementations.problem1154 import Problem1154
@patch('builtins.input', side_effect=['34', '56', '44', '23', '-2'])
class Test1154(TestCase):
def test_1154(self, mocke... | 2.828125 | 3 |
code_base/bandwidth_configurator.py | ManuelMeinen/SCIONLab_Bandwidth_Limiter | 0 | 54686 | # Copyright 2018 ETH Zurich
#
# 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, sof... | 1.898438 | 2 |
app.py | alexander-paskal/youtube-transcript-generator | 0 | 54687 | """
To run this in a publically available setting, use --host=0.0.0.0
at the command line
"""
from flask import Flask, render_template, request
from typing import Dict
from src.video_captions import Video
import datetime
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def home():
if request.m... | 3.4375 | 3 |
photo-processor.py | kalemena/photo-tools | 0 | 54688 | <filename>photo-processor.py
#!/usr/bin/env python
# Scroll through specified folder and rename photos based on EXIF metadata.
# Rename videos based on file time.
# Duplicate MOV MJPEG video transcoded in x264 lossless.
#
# Example usage
# ./photo-processor.py -s <source folder>
# Example manual convert video
# conve... | 3.015625 | 3 |
cue_queue/bin/__init__.py | JacksonMaxfield/queue-cue | 3 | 54689 | <filename>cue_queue/bin/__init__.py
# -*- coding: utf-8 -*-
"""Bin scripts package for cue-queue."""
| 1.109375 | 1 |
lifelong_rl/samplers/data_collector/step_collector.py | kzl/lifelong_rl | 67 | 54690 | <reponame>kzl/lifelong_rl
from collections import deque, OrderedDict
import numpy as np
from lifelong_rl.util import eval_util
from lifelong_rl.util.eval_util import create_stats_ordered_dict
from lifelong_rl.data_management.utils.path_builder import PathBuilder
from lifelong_rl.samplers import StepCollector
class ... | 1.828125 | 2 |
WebMirror/OutputFilters/SeriesPageCommon.py | fake-name/ReadableWebProxy | 193 | 54691 | <gh_stars>100-1000
import json
import os.path
import cachetools
MIN_RATING_STARS = 2.5
# * 2 to convert from stars to 0-10 range actually used
MIN_RATING_FLOAT = MIN_RATING_STARS * 2
MIN_RATE_CNT = 3
MIN_CHAPTERS = 4
@cachetools.cached(cachetools.TTLCache(100, 60*5))
def _load_lut_internal():
outf = ... | 2.359375 | 2 |
turq/editor.py | XiaoboHe/turq | 45 | 54692 | <filename>turq/editor.py<gh_stars>10-100
# pylint: disable=unused-argument
import base64
import hashlib
import html
import mimetypes
import os
import pkgutil
import posixpath
import socket
import socketserver
import string
import threading
import wsgiref.simple_server
import falcon
import werkzeug.formparser
import ... | 2.0625 | 2 |
8085 compiler/src/lexer.py | Anindita7/8085-IDE | 0 | 54693 | <reponame>Anindita7/8085-IDE<filename>8085 compiler/src/lexer.py
labels={}
def lex(filecontents):
filecontents=list(filecontents)
tokens=[]
#Implementations left#
#Stack keywords
#Rotate
#16 bit operations
#JUMP operations
keywords=["STA","MVI","MOV","LDA","ADD","ADC","ADI","ACI","SUB","SUI","SBB","SBI... | 2.34375 | 2 |
setup.py | CS207-Project-Team-1/cs207-FinalProject | 0 | 54694 | <reponame>CS207-Project-Team-1/cs207-FinalProject
#!/usr/bin/env python
from setuptools import setup
setup(
name="AutoDiffX",
version="0.2",
packages=['ad'],
# metadata to display on PyPI
author="<NAME>",
author_email="<EMAIL>",
description="Lightweight Package for Automatic Differentiati... | 1.140625 | 1 |
api/webdriver_threading.py | gbazilio/nfebrasil | 4 | 54695 | import os
import threading
import time
from selenium import webdriver
class WebDriverThread(threading.Thread):
def __init__(self, application_scoped_drivers, unique_id,
timeout=50, interval=1):
super(WebDriverThread, self).__init__()
self.timeout = timeout
self.interval =... | 2.640625 | 3 |
radbm/tests/search_elba_hbkl.py | duchesneaumathieu/radbm | 0 | 54696 | <filename>radbm/tests/search_elba_hbkl.py
import unittest, torch
import numpy as np
from radbm.search.elba import HBKL
from radbm.search.mbsds import HashingMultiBernoulliSDS
class TestHBKL(unittest.TestCase):
def test_step(self):
torch.manual_seed(0)
model = HBKL(
torch.nn.Linear(32,16... | 2.375 | 2 |
configs/visdrone/cascade_rcnn_hrnetv2p_w40_1x.py | tjiiv-cprg/mmdetection-tjiiv | 0 | 54697 | _base_ = './cascade_rcnn_r101_fpn_1x.py'
model = dict(
pretrained='open-mmlab://msra/hrnetv2_w40',
backbone=dict(
_delete_=True,
type='HRNet',
extra=dict(
stage1=dict(
num_modules=1,
num_branches=1,
block='BOTTLENECK',
... | 1.429688 | 1 |
preprocessing/split_dataset.py | clinfo/DEFMap | 20 | 54698 | <reponame>clinfo/DEFMap<filename>preprocessing/split_dataset.py
import argparse
from operator import itemgetter
import os
from sklearn.model_selection import KFold
def get_parser():
parser = argparse.ArgumentParser(
description='description',
usage='usage'
)
parser.add_argument(
'-... | 2.390625 | 2 |
pkgs/conf-pkg/src/genie/libs/conf/isis/nxos/isis.py | miott/genielibs | 94 | 54699 |
# -- ISIS
# nxos: interface <intf> / ip router isis someword
# nxos: interface <intf> / ipv6 router isis someword
# nxos: interface <intf> / isis authentication key-chain someword
# nxos: interface <intf> / isis authentication key-chain someword level-1
# nxos: interface <intf> / isis authentication key-chain someword... | 1.523438 | 2 |