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
website/rooms/forms.py
KiOui/bussen
0
12791451
<filename>website/rooms/forms.py from django import forms from .models import Room class RoomCreationForm(forms.Form): """Room Creation form.""" room_name = forms.CharField(max_length=128, required=True) def clean_room_name(self): """Clean room name.""" if Room.objects.filter(name=self.c...
2.90625
3
clara/transpiler/tree/__init__.py
asergiobranco/clara
4
12791452
import numpy as np class DecisionTreeClassifierTranspiler(object): def __init__(self, model): self.model = model self.build_classes() self.build_feature_idx() self.build_right_nodes() self.build_thresholds() def build_feature_idx(self): self.features_idx = ','...
2.84375
3
ordenenumeros.py
EBERTONSCHIPPNIK/Pequenos-codigospy
0
12791453
lista = [3,2,1] print(sorted(lista))
3.0625
3
test/test_fakeservertest.py
yimuniao/collectd-cloudwatch
220
12791454
import unittest import requests from helpers.fake_http_server import FakeServer class FakeServerTest(unittest.TestCase): SERVER = None @classmethod def setUpClass(cls): cls.SERVER = FakeServer() cls.SERVER.start_server() cls.SERVER.serve_forever() def setUp(self): se...
2.921875
3
MPKTA_Final_Project.py
Iqrar99/MPKT-A_Final_Project
0
12791455
#project akhir mpkta #semoga lancar #aminnn from tkinter import * lst = [] def readf(): with open('all.txt', 'r') as f: line = '' for i in range(68): while('<deskripsi>' not in line): line = f.readline() cmp = '' txt = '' while('<end...
3.390625
3
tests/test_problem_solving_algorithms_warmup.py
mxdzi/hackerrank
0
12791456
from problem_solving.algorithms.warmup import * def test_solve_me_first(): assert 5 == q1_solve_me_first.solveMeFirst(2, 3) assert 1100 == q1_solve_me_first.solveMeFirst(100, 1000) def test_simple_array_sum(): assert 31 == q2_simple_array_sum.simpleArraySum([1, 2, 3, 4, 10, 11]) def test_compare_the_t...
2.828125
3
izaber_flask_wamp/wamp.py
zaberaki/izaber-flask-wamp
0
12791457
<filename>izaber_flask_wamp/wamp.py<gh_stars>0 from .app import * class IZaberFlaskLocalWAMP(object): """ Allows the creation and sending of calls and functions """ def __init__(self,sockets,app): self.sockets = sockets self.app = app self.on_connect = [] self.on_disconnect...
2.59375
3
connectFourLab/game/agents/strategies/monteCarlo.py
yuriharrison/connect-four-lab
0
12791458
<reponame>yuriharrison/connect-four-lab<gh_stars>0 """Monte Carlo strategies""" import math from copy import copy, deepcopy from . import Strategy, RandomStrategy, ZobristHashingStrategy from . import RandomStrategy from ... import helpers from ...exceptions import BadImplementation class SimulationStrategy(RandomStr...
2.734375
3
textgrid-to-audacity.py
jimregan/wolnelektury-speech-corpus
2
12791459
#!/usr/bin/env python import textgrid import sys if len(sys.argv) != 2: print("textgrid-to-audacity.py [filename]") quit() tg = textgrid.TextGrid.fromFile(sys.argv[1]) started = False start=0.0 end=0.0 text=list() for i in tg[0]: if i.mark != '': if not started: start = i.minTime ...
2.859375
3
readonly/readonly/test_runner.py
WimpyAnalytics/django-readonly-schema
0
12791460
import contextlib import os import logging from django.test.runner import DiscoverRunner from django.conf import settings from django.db import connections logger = logging.getLogger(__name__) class LegacyDiscoverRunner(DiscoverRunner): """ See https://docs.djangoproject.com/en/1.7/topics/testing/advanced/#...
2.375
2
zukuzuku.py
frodotest/test
0
12791461
# coding: utf8 import datetime import logging import random import re import ssl import subprocess import threading import time from multiprocessing import Process as Thread import telebot from aiohttp import web from telebot import types import api import cherrypy import config import secret_config import text impo...
1.953125
2
shared/secrets.example.py
Mo-Talha/Nomad
0
12791462
MONGO_HOST = 'localhost' MONGO_PORT = 27017 MONGO_DATABASE = 'nomad' REDIS_HOST = 'localhost' REDIS_PORT = 6379 REDIS_DB = 0
1.132813
1
espresso.py
isikdos/Espresso
0
12791463
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 20 22:08:31 2019 @author: iaricanli """ import copy T = True F = False D = "_" """ Generate the inputs for the algorithm. A list of dictionarys. Each element of the list represents a different boolean expression input -- say if we are trying to r...
3.9375
4
bot/config/config.py
0x0bloodyknight/jdan734-bot
0
12791464
import yaml from pathlib import Path from os import environ class Config: def __init__(self, file_path="config.yml"): try: with open(file_path, encoding="UTF-8") as file: self.config = yaml.full_load(file.read()) except Exception: self.config = {} ...
2.765625
3
mediator/event/aggregate.py
dlski/python-mediator
12
12791465
from typing import Any, Dict, List, Optional, Tuple from mediator.event.base import EventPublisher class EventAggregateError(Exception): """ Event aggregate base error """ class ConfigEventAggregateError(AssertionError, EventAggregateError): """ Config event aggregate error. Raised when ev...
2.390625
2
samples/wsgi_session.py
UKTradeInvestment/pyslet
2
12791466
#! /usr/bin/env python import pyslet.xml.structures as xml from pyslet.wsgi import SessionApp, session_decorator class MyApp(SessionApp): settings_file = 'samples/wsgi_session/settings.json' def init_dispatcher(self): super(MyApp, self).init_dispatcher() self.set_method("/", self.home) ...
2.59375
3
finetune.py
kbehouse/vgg-face-keras
3
12791467
from keras.engine import Model from keras.layers import Flatten, Dense, Input from keras import optimizers from keras.preprocessing.image import ImageDataGenerator from vggface import VGGFace from sklearn.metrics import log_loss from one_face_predict import prdict_one_face from load_face_data import load_face_data ...
2.578125
3
assets_new_new/data/2021-03-05/json_for_classification/get_classification_file_with_padim_segment.py
ggzhang0071/PaDiM-Anomaly-Detection-Localization-master
0
12791468
<filename>assets_new_new/data/2021-03-05/json_for_classification/get_classification_file_with_padim_segment.py from get_classification_file_with_original_annotation import get_image_label_dict_from_original_annotation, get_classification_file_based_on_label original_annotation_path="/git/PaDiM-master/assets_new_new/d...
2.25
2
service_layer/customer_service_interface.py
yeonghwanchoi/Project_bank
0
12791469
from abc import ABC, abstractmethod class CustomerServiceInterface(ABC): @abstractmethod def get_all_accounts_for_user(self, id: int) -> list: pass
2.828125
3
scripts/benchmark/contract_data/__init__.py
zixuanzh/py-evm
1
12791470
import pathlib from typing import ( Iterable ) CONTRACTS_ROOT = "./scripts/benchmark/contract_data/" CONTRACTS = [ "erc20.sol" ] def get_contracts() -> Iterable[pathlib.Path]: for val in CONTRACTS: yield pathlib.Path(CONTRACTS_ROOT) / pathlib.Path(val)
2.28125
2
pgAdmin/tools/sqleditor/utils/tests/test_is_query_resultset_updatable.py
WeilerWebServices/PostgreSQL
0
12791471
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2020, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## import json impor...
2.1875
2
Data_generation.py
CS671/Assignment-4
0
12791472
import numpy as np import pickle as pkl def function_generator(init_num): seq = np.array([], dtype='int') n = init_num seq = np.append(seq, n) while True: if ((n%2)==0): next_number = n/2 next_number = np.asarray(next_number, dtype='int') seq = np.append(seq...
3.171875
3
PythonCode/MathModule.py
janw23/Ballance
2
12791473
<reponame>janw23/Ballance<filename>PythonCode/MathModule.py #PRZYDATNE FUNKCJE MATEMATYCZNE import math import heapq #zwrca znak liczby def sign(num): if num > 0: return 1.0 if num < 0: return -1.0 return 0.0 def softsign(num): if num < 0: return num / (1 - num) return num / (1 + num) #zwraca kwa...
3.0625
3
lib/utils/utils.py
TotalVariation/Flattenet
3
12791474
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by <NAME> (<EMAIL>) # ------------------------------------------------------------------------------ from __future__ import absolute_import from __future__ import divis...
2.84375
3
src/ralph/supports/migrations/0006_auto_20160615_0805.py
DoNnMyTh/ralph
1,668
12791475
<filename>src/ralph/supports/migrations/0006_auto_20160615_0805.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import ralph.lib.mixins.fields class Migration(migrations.Migration): dependencies = [ ('supports', '0005_auto_20160105_1222'), ...
1.59375
2
tools/gen_doc_files.py
joshddunn/crsfml
248
12791476
<filename>tools/gen_doc_files.py import os import textwrap import mkdocs_gen_files root = mkdocs_gen_files.config["plugins"]["mkdocstrings"].get_handler("crystal").collector.root nav = mkdocs_gen_files.open(f"api/index.md", "w") for module in ["System", "Window", "Graphics", "Audio", "Network", ""]: if module: ...
2.453125
2
doc/workflow/examples/example7.py
PyUtilib/PyUtilib
24
12791477
<gh_stars>10-100 import pyutilib.workflow import os.path import os currdir = os.path.dirname(os.path.abspath(__file__))+os.sep import sys if sys.platform.startswith('win'): INPUT = open('example7.txt','r') for line in INPUT: sys.stdout.write(line) INPUT.close() else: # @ex: class TaskH(pyutilib....
2.5
2
startup_scripts/240_virtualization_interfaces.py
systempal/netbox-docker
691
12791478
import sys from startup_script_utils import load_yaml, pop_custom_fields, set_custom_fields_values from virtualization.models import VirtualMachine, VMInterface interfaces = load_yaml("/opt/netbox/initializers/virtualization_interfaces.yml") if interfaces is None: sys.exit() required_assocs = {"virtual_machine"...
2.59375
3
src/atcoder/abc007/c/sol_0.py
kagemeka/competitive-programming
1
12791479
from __future__ import ( annotations, ) from typing import ( Generator, NoReturn ) class StdReader: def __init__( self, ) -> NoReturn: import sys self.buf = sys.stdin.buffer self.lines = ( self.async_readlines() ) self.chunks: Generator def async_readlines( self, )...
2.921875
3
afnumpy/lib/stride_tricks.py
FilipeMaia/afnumpy
31
12791480
<reponame>FilipeMaia/afnumpy import afnumpy import numpy def broadcast_arrays(*args, **kwargs): subok = kwargs.pop('subok', False) if kwargs: raise TypeError('broadcast_arrays() got an unexpected keyword ' 'argument {}'.format(kwargs.pop())) args = [afnumpy.array(_m, copy=Fa...
2.578125
3
tests/util_test.py
nickgaya/bravado-core
122
12791481
<reponame>nickgaya/bravado-core # -*- coding: utf-8 -*- from inspect import getcallargs import mock import pytest from bravado_core.util import AliasKeyDict from bravado_core.util import cached_property from bravado_core.util import determine_object_type from bravado_core.util import lazy_class_attribute from bravado...
2.109375
2
discord/ext/ui/item.py
Lapis256/discord-ext-ui
0
12791482
from typing import Any, Callable import discord class Item: def to_discord(self) -> Any: pass def check(self, func: Callable[[discord.Interaction], bool]) -> 'Item': pass
2.328125
2
bgg4py/valueobject/search.py
hiroaqii/bgg4py
1
12791483
from collections import OrderedDict from typing import List, Optional, Union from .bgg import Bgg class Item(Bgg): id: int type: str name: Optional[str] yearpublished: Optional[int] @classmethod def create(cls, itme: OrderedDict): _item = Item( id=Bgg.parse_int(itme.get("@...
2.859375
3
Networks.py
yanhuchen/Quantum-Graph-Convolutional-Network
3
12791484
<gh_stars>1-10 import random from QuantumGate import QuantumGate import numpy as np import scipy.sparse as sp from numpy import pi, sin, cos, sqrt, exp from copy import deepcopy class Networks: def __init__(self, n_qubit, n_class, nums, label): self.nums = nums self.label = label self.n_cl...
2.3125
2
Python tripartite framework/Django/code/mysite/app_model/models.py
Ljazz/studyspace
0
12791485
from django.db import models from django.contrib.auth.models import User from django.urls import reverse from django.utils.timezone import now from django.template.defaultfilters import slugify import uuid import os class Article(models.Model): STATUS_CHOICES = ( ('d', '草稿'), ('p', '发表'), ) ...
2.15625
2
uwsgi_sloth/commands/echo_conf.py
365moods/uwsgi
0
12791486
<reponame>365moods/uwsgi # -*- coding: utf-8 -*- import pkg_resources def echo_conf(args): print pkg_resources.resource_string('uwsgi_sloth', "sample.conf") def load_subcommand(subparsers): """Load this subcommand""" parser_analyze = subparsers.add_parser('echo_conf', help='Echo sample configuration fil...
2.40625
2
bims/views/under_development.py
Christiaanvdm/django-bims
0
12791487
<reponame>Christiaanvdm/django-bims<gh_stars>0 # coding=utf-8 from django.views.generic import TemplateView class UnderDevelopmentView(TemplateView): template_name = 'under_development.html'
1.210938
1
utility.py
DavideFrr/ibmqx_experiments
6
12791488
# Copyright 2017 Quantum Information Science, University of Parma, Italy. 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...
2
2
survey/migrations/0009_auto_20151120_1756.py
lundskommun/kartverktyget
0
12791489
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import ckeditor.fields class Migration(migrations.Migration): dependencies = [ ('survey', '0008_survey_image'), ] operations = [ migrations.AlterField( model_name='survey...
1.65625
2
agent/src/Basic_linux_commands/copy_move_delete.py
ekbanasolutions/aditas
2
12791490
import os import time import run_services from Basic_linux_commands.chown_chmod import chown from bigdata_logs.logger import getLoggingInstance log = getLoggingInstance() username = os.getenv("user") groupname = username def copy(src, file_list, dest, user_pass, *args): log.info("\nCopying\n") try: ...
2.546875
3
pytest_use_postgresql.py
admariner/django-sql-dashboard
293
12791491
import os import pytest from dj_database_url import parse from django.conf import settings from testing.postgresql import Postgresql postgres = os.environ.get("POSTGRESQL_PATH") initdb = os.environ.get("INITDB_PATH") _POSTGRESQL = Postgresql(postgres=postgres, initdb=initdb) @pytest.hookimpl(tryfirst=True) def pyte...
2.0625
2
ConvertText.py
danheeks/PyCAD
17
12791492
<gh_stars>10-100 from HeeksFont import ConvertHeeksFont ConvertHeeksFont()
1.429688
1
examples/mlp.py
AlexanderViand/EVA
0
12791493
<reponame>AlexanderViand/EVA # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. from eva import EvaProgram, Input, Output, evaluate, save, load from eva.ckks import CKKSCompiler from eva.seal import generate_keys from eva.metric import valuation_mse import os import time impo...
2.09375
2
tests/test_db_url.py
Swamii/django-bananas
0
12791494
<gh_stars>0 from urllib.parse import quote from django.test import TestCase from bananas import url __test__ = { 'Doctest': url } class DBURLTest(TestCase): def test_sqlite_memory(self): conf = url.database_conf_from_url('sqlite://') self.assertDictEqual(conf, { 'ENGINE': 'djan...
2.546875
3
python3-variant/scraper.py
yacmeno/one-piece-scraper
0
12791495
""" Script that scrapes Jaimini's box website to retrieve when was the last One Piece chapter released to then ask you if you want to read the chapter in your browser or download it """ from bs4 import BeautifulSoup import requests import webbrowser from os import getcwd url = 'https://jaiminisbox.com/reader/series/o...
3.6875
4
Python/Crawling/naver/jsontoxml.py
zionhan/TIL
1
12791496
import json import xmltodict with open('complexes.json', 'r', encoding='UTF-8') as f: jsonString = f.read() print('JSON input (json_to_xml.json):') print(jsonString) xmlString = xmltodict.unparse(json.loads(jsonString), pretty=True) print('\nXML output(json_to_xml.xml):') print(xmlString) with open('...
3.171875
3
optigurator/pareto.py
ovidner/staircase-optigurator
1
12791497
import numpy as np from openmdao.api import CaseReader from optigurator.utils import recording_filename def get_case_reader(data_dir, problem_constants): return CaseReader(recording_filename(data_dir, problem_constants.id)) def generate_valid_points(problem_constants, crm): for (i, case_id) in enumerate(cr...
2.25
2
data_pipeline/sql/alter_statement.py
iagcl/data_pipeline
16
12791498
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
1.820313
2
helper_scripts/shaderpatch.py
w23/Right_Hemisphere
2
12791499
<filename>helper_scripts/shaderpatch.py #!/usr/bin/env python3 import json import re import argparse parser = argparse.ArgumentParser(description='Patch minified shader') parser.add_argument('--patch', required=True, help='Minified file to patch') parser.add_argument('input', type=argparse.FileType('r'), help='Patch d...
2.78125
3
django_group_by/__init__.py
alissonmuller/django-group-by
25
12791500
""" This module contains the package exports. """ from .mixin import GroupByMixin
1.234375
1
src/read_data.py
GavinNishizawa/ncaa-march-madness-2018
1
12791501
""" Read in the data from csv files """ import pandas as pd import os import glob from save_data import save_object, load_object def load_csv(filename): # load data from pickle file if it exists obj = load_object(filename) if obj != None: return obj # otherwise load from csv else: ...
3.8125
4
bench/bench.py
ToriML/DNN-bench
16
12791502
<reponame>ToriML/DNN-bench<filename>bench/bench.py import timeit def benchmark_speed(benchmark_func, repeat=1000, number=1, warmup=100): assert repeat >= 2 * warmup, "Warmup should be at leat 2x smaller than repeat." out = timeit.repeat(benchmark_func, repeat=repeat, number=number) # remove warmup ou...
2.6875
3
Projekteuler/projecteuler_aufgabe001.py
kilian-funk/Python-Kurs
0
12791503
<filename>Projekteuler/projecteuler_aufgabe001.py """ Aufgabe 1 aus http://projecteuler.net (Deutsche Übersetzung auf http://projekteuler.de) Wenn wir alle natürlichen Zahlen unter 10 auflisten, die Vielfache von 3 oder 5 sind, so erhalten wir 3, 5, 6 und 9. Die Summe dieser Vielfachen ist 23. Finden Sie die Summe al...
2.71875
3
pytils/classes/_static.py
d33jiang/pytils
0
12791504
from typing import NoReturn, Type __all__ = [ 'static' ] def _raise_init(): raise NotImplementedError('Static classes cannot be instantiated') def static(cls) -> Type: """ Decorator for defining static classes. The resulting static class cannot be instantiated. If the __init__ method is define...
3.25
3
URL/util.py
Hydrophobefireman/self-host-google-fonts
0
12791505
from urllib.parse import ParseResult from os.path import realpath, dirname, join as _path_join import requests from json import load as json_load script_loc = realpath(__file__) script_dir = dirname(script_loc) del dirname del realpath mime_types: dict with open(_path_join(script_dir, "mimes.json")) as f: mime_ty...
2.671875
3
Setups/autoboard.py
matthewvanderson/MagicBot
1
12791506
from disnake.ext import commands from utils.clash import client, pingToChannel, getClan import disnake usafam = client.usafam clans = usafam.clans server = usafam.server class autoB(commands.Cog, name="Board Setup"): def __init__(self, bot: commands.Bot): self.bot = bot @commands.slash_command(name=...
2.328125
2
dev-infra/bazel/extract_js_module_output.bzl
yuchenghu/angular-cn
17
12791507
<filename>dev-infra/bazel/extract_js_module_output.bzl load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo", "JSEcmaScriptModuleInfo", "JSModuleInfo", "JSNamedModuleInfo") """Converts a provider name to its actually Starlark provider instance.""" def _name_to_js_module_provider(name): if name == "J...
1.976563
2
dopplerr/api/add_route.py
Stibbons/sonarr-sub-downloader-docker
9
12791508
# coding: utf-8 # Third Party Libraries from sanic_transmute import add_route from transmute_core.compat import string_type from transmute_core.function import TransmuteAttributes def describe_add_route(blueprint, **kwargs): # if we have a single method, make it a list. if isinstance(kwargs.get("paths"), st...
2.234375
2
easy_sdm/data/species_data.py
math-sasso/masters_research
1
12791509
import os from typing import Dict from abc import ABC from easy_sdm.data import ShapefileRegion import geopandas as gpd import numpy as np import pandas as pd import requests from easy_sdm.configs import configs from easy_sdm.utils import logger from typing import Dict, Optional from pathlib import Path class GBIFOc...
2.609375
3
tests/links_tests/model_tests/fpn_tests/test_head.py
souravsingh/chainercv
0
12791510
from __future__ import division import numpy as np import unittest import chainer from chainer import testing from chainer.testing import attr from chainercv.links.model.fpn import Head from chainercv.links.model.fpn import head_loss_post from chainercv.links.model.fpn import head_loss_pre def _random_array(xp, sh...
2
2
tfx/utils/channel.py
Bumbleblo/tfx
0
12791511
<gh_stars>0 # Copyright 2019 Google LLC. 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 # # Unless required by applica...
2.46875
2
charity_donation_app/users/views.py
ikolokotronis/donation_app
0
12791512
<filename>charity_donation_app/users/views.py from django.shortcuts import render, redirect from django.views import View from main.models import Donation, DonationCategories, \ TokenTemporaryStorage from django.contrib.auth.models import User from django.contrib.auth import authenticate, login, logout from django....
2.125
2
tableauserverclient/models/target.py
zuarbase/server-client-python
470
12791513
<filename>tableauserverclient/models/target.py """Target class meant to abstract mappings to other objects""" class Target: def __init__(self, id_, target_type): self.id = id_ self.type = target_type def __repr__(self): return "<Target#{id}, {type}>".format(**self.__dict__)
2.5625
3
LibMTL/weighting/GradVac.py
median-research-group/LibMTL
83
12791514
<reponame>median-research-group/LibMTL<filename>LibMTL/weighting/GradVac.py import torch, random import torch.nn as nn import torch.nn.functional as F import numpy as np from LibMTL.weighting.abstract_weighting import AbsWeighting class GradVac(AbsWeighting): r"""Gradient Vaccine (GradVac). This method ...
2.109375
2
asrtoolkit/data_handlers/stm.py
mgoldey/asrtoolkit-draft
0
12791515
#!/usr/bin/env python """ Module for reading STM files Expected file format is derived from http://www1.icsi.berkeley.edu/Speech/docs/sctk-1.2/infmts.htm#stm_fmt_name_0 This expects a segment from class derived in convert_text """ from asrtoolkit.data_structures.segment import segment def format_segment(seg): ""...
3.390625
3
core/management/commands/populate_db.py
dishad/ADD
0
12791516
<filename>core/management/commands/populate_db.py from django.core.management.base import BaseCommand from core.models import Category import os import json class Command(BaseCommand): help = 'Populate the deanslist database with some mock data to display in index.html' def _create_categories(self): with open('ca...
2.578125
3
server/entities/livro.py
marcia-santos/simpleBookstore
0
12791517
from entities.entityBase import * class Livro(EntityBase): __tablename__ = 'livro' id = sqlalchemy.Column(sqlalchemy.Integer,primary_key=True) isbn = sqlalchemy.Column(sqlalchemy.String(length=20)) titulo = sqlalchemy.Column(sqlalchemy.String(length=255)) autor = sqlalchemy.Column(sqlalchemy.String...
2.78125
3
PySimpleGUI_PyWebIO_Streamlit/test/image_clf.py
philip-shen/note_python
0
12791518
<filename>PySimpleGUI_PyWebIO_Streamlit/test/image_clf.py from PIL import Image import json import os import streamlit as st import pandas as pd import numpy as np from keras.preprocessing import image from keras.applications.xception import Xception, preprocess_input, decode_predictions st.set_option('deprecation.s...
3.25
3
test/python/proto2dict.py
jannekai/protoc-gen-elixir
3
12791519
<filename>test/python/proto2dict.py # -*- coding: utf-8 -*- from base64 import b64encode, b64decode from google.protobuf.descriptor import FieldDescriptor as FD def proto_to_dict(msg): result = {} for fd, value in msg.ListFields(): result[fd.name] = encode_value(fd, value, encode_func(fd)) return r...
2.625
3
setup.py
maximlt/project
0
12791520
<reponame>maximlt/project<gh_stars>0 import pathlib from setuptools import setup, find_packages import codecs import re # The directory containing this file HERE = pathlib.Path(__file__).parent # The text of the README file README = (HERE / "README.md").read_text() AUTOMATION_REQUIRE = ["tox>=3.12.1"] LINTERS_REQUIR...
1.546875
2
engines.py
Artemigos/rpi_adjustable_desk
0
12791521
import RPi.GPIO as gpio def up_off(): print("[debug] turning UP engines off") _OUT.left_up.off() _OUT.RIGHT_UP.off() def up_on(): print("[debug] turning UP engines on") _OUT.left_down.off() _OUT.right_down.off() _OUT.main.on() _OUT.left_up.on() _OUT.right_up.on() def down_off(): ...
2.875
3
tests/us23_test.py
pdamiano-11/Team-4-Code
4
12791522
# -*- coding: utf-8 -*- """ Created on Mon Oct 5 14:29:04 2020 @author: ptrda """ import os os.chdir(os.path.dirname(os.path.abspath('../tests'))) import sys sys.path.append(os.path.abspath('../Team-4-Code/src/UserStories')) sys.path.append(os.path.abspath('../Team-4-Code/src')) cwd = os.getcwd() os.chdir(os.path.j...
2.53125
3
app/authentication/urls.py
GiorgosXonikis/RestaurantReviews-RestAPI
0
12791523
from django.urls import path from .views import (PasswordResetView, PasswordResetValidationView) urlpatterns = [ path('password-reset/', PasswordResetView.as_view(), name='password_reset'), path('password-reset/validate/', PasswordResetValidationView.as_view(), name='password_reset-validat...
1.835938
2
9_Lesson9/exceptions/example4-else.py
turovod/Otus
0
12791524
<reponame>turovod/Otus my_dict = {"a": 1, "b": 2, "c": 3} # Without finally try: value = my_dict["a"] except KeyError: print("A KeyError occurred!") else: print("No error occurred!") # With finally try: value = my_dict["a"] except KeyError: print("A KeyError occurred!") else: print("No error...
3.703125
4
Part2/reply_post.py
tommakessense/RedditBot
0
12791525
from json import loads, dumps from random import randint import stanza import praw import re import os from urllib.parse import quote from stanza import Pipeline def log_into_reddit(): reddit = praw.Reddit('bot1') print(reddit.user.me()) return reddit def get_posts_replied_to(): # Have we run this co...
3.34375
3
model/utils_bert.py
sahara2001/editsql
0
12791526
<filename>model/utils_bert.py # modified from https://github.com/naver/sqlova import os, json import random as rd from copy import deepcopy import torch import torch.nn as nn import torch.nn.functional as F from .gated_graph_conv import GatedGraphConv from .bert import tokenization as tokenization from .bert.modeli...
2.109375
2
tests/test_fstr.py
rmorshea/fstr
0
12791527
import pytest from sys import version_info import fstr def test_basic(): template = fstr("{x} + {y} = {x + y}", x=1) assert template.format(y=2) == "1 + 2 = 3" assert template.format(y=3) == "1 + 3 = 4" def test_basic_format_language(): template = fstr("{x!r} + {y!r} = {x + y!r}", x="a") assert...
2.625
3
formidable/__init__.py
peopledoc/django-formidable
11
12791528
<reponame>peopledoc/django-formidable from .json_migrations import latest_version default_app_config = 'formidable.app.FormidableConfig' version = '7.2.0.dev0' json_version = latest_version
1.15625
1
1_fetch.py
doofmars/bgg-quartets
0
12791529
<reponame>doofmars/bgg-quartets # coding=utf-8 import json import os import configparser import requests as req # noinspection PyUnresolvedReferences from bs4 import BeautifulSoup, Tag config = configparser.ConfigParser() def load_data(url, file_name): """ Load data either from web or cache if already prese...
2.6875
3
kanbanflow_prj_selector/boards/board.py
igorbasko01/kanbanflow-prj-selector
0
12791530
<gh_stars>0 import requests import logging from ..constants import KFLOW_BASE_URL from .column import Column from .swimlane import Swimlane from .task import Task class Board(object): def __init__(self, token): self.log = logging.getLogger() self.FULL_BOARD_URL = f"{KFLOW_BASE_URL}/board" ...
2.78125
3
app/waterQual/DGSA/period.py
fkwai/geolearn
0
12791531
<gh_stars>0 from hydroDL import kPath from hydroDL.app import waterQuality, DGSA from hydroDL.data import gageII, usgs, gridMET from hydroDL.master import basins from hydroDL.post import axplot, figplot import matplotlib.pyplot as plt import importlib from astropy.timeseries import LombScargle import pandas as pd im...
2
2
tools/builder.py
dp92987/nginx-amplify-agent
308
12791532
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys from builders import deb, rpm, amazon from builders.util import shell_call __author__ = "<NAME>" __copyright__ = "Copyright (C) Nginx, Inc. All rights reserved." __license__ = "" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" if __name__ == '__main__':...
2.234375
2
socket_server.py
afinello/simple-echo-server
0
12791533
import socket, select import signal class SimpleSignalHandler: should_exit = False def __init__(self): signal.signal(signal.SIGINT, self.exit_gracefully) signal.signal(signal.SIGTERM, self.exit_gracefully) def exit_gracefully(self,signum, frame): self.should_exit = True class Client: addr = ...
2.9375
3
restApi/product/migrations/0002_auto_20201219_1633.py
rtx-abir/ecom
0
12791534
# Generated by Django 3.0.8 on 2020-12-19 21:33 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('category', '0001_initial'), ('product', '0001_initial'), ] operations = [ migrations.AddField( ...
1.53125
2
sg_covid_impact/make_glass_validate.py
nestauk/sg_covid_impact
2
12791535
<reponame>nestauk/sg_covid_impact # Scrip to validate glass data import pandas as pd import json import numpy as np import os import logging import requests from zipfile import ZipFile from io import BytesIO import altair as alt from sg_covid_impact.getters.glass_house import get_glass_house from sg_covid_impact.gette...
2.5625
3
setup.py
anapaulagomes/pardal-python
2
12791536
#!/usr/bin/env python # -*- coding: utf-8 -*- import codecs import os from setuptools import find_packages, setup def read(fname): file_path = os.path.join(os.path.dirname(__file__), fname) return codecs.open(file_path, encoding="utf-8").read() setup( name="pardal", version="0.1.0", author="<N...
1.445313
1
dataframe.py
UWSEDS/homework-4-documentation-and-style-hyspacex
0
12791537
"""Create dataframe and check the quality This script downloads a dataset from Seattle Open Data Portal and imports as a Pandas Dataframe. This tool checks if the dataframe: 1. Has at least 10 rows of data 2. Contains only the columns that specified as the second argument 3. Values in each column have the same python...
3.921875
4
test/language/constraints/python/StructureConstraintsTest.py
dkBrazz/zserio
86
12791538
import unittest import zserio from testutils import getZserioApi class StructureConstraintsTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.api = getZserioApi(__file__, "constraints.zs").structure_constraints def testReadCorrectColors(self): writer = zserio.BitStreamWriter()...
2.5625
3
notebook/2019-07-03_lit_in_biomarkers.py
jfear/larval_gonad
1
12791539
import yaml import pandas as pd from more_itertools import flatten import os os.chdir('notebook') fbgn2symbol = ( pd.read_feather('../references/gene_annotation_dmel_r6-26.feather', columns=['FBgn', 'gene_symbol']) .set_index('FBgn') .to_dict()['gene_symbol'] ) config = yaml.safe_load(open('../config/com...
2.1875
2
Prosjekt 4 - Raspberry pi/waveshare/yrApi/yr_data.py
stellanova88/DigiFab
0
12791540
""" <NAME> json from yr. Location Remmen, Halden: lat: 59.1304, lon: 11.3546, altitude: ca. 80 https://api.met.no/weatherapi/locationforecast/2.0/#!/data/get_compact_format request api: https://api.met.no/weatherapi/locationforecast/2.0/compact?altitude=80&lat=63.4305&lon=10.3950 curl: curl -X GET --heade...
3.328125
3
python/testData/resolve/ObjectMethods.py
jnthn/intellij-community
2
12791541
<filename>python/testData/resolve/ObjectMethods.py class A: x = 1 y = 1 class B(A): def foo(self): self.__repr__() # <ref>
1.898438
2
leetcode/Hash Table/242. Valid Anagram.py
yanshengjia/algorithm
23
12791542
""" Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: s = "anagram", t = "nagaram" Output: true Example 2: Input: s = "rat", t = "car" Output: false Follow up: What if the inputs contain unicode characters? How would you adapt your solution to such case? Use a hash...
4.125
4
mocks/mock_drive_manager.py
shepherdjay/-r-winnipegjets-scripts
0
12791543
"""Module containing the definition of a mocked out GDocs dependency. This is for test use only""" class MockDriveManager(): """Mocked out version of DriveManager for test purposes""" def __init__(self): none = None def get_file_entries(): none = None def get_drive_filetype()...
2.34375
2
out/production/mitmproxynew/mitmproxy/addons/browserup/har/har_verifications.py
580/mitmproxy
9
12791544
import re from glom import glom import json from jsonschema import validate from jsonschema import ValidationError from jsonpath_ng import parse class HarVerifications: def __init__(self, har): self.har = har def rmatch(self, val, str_rxp): if val is None: return False if ...
2.484375
2
apps/home/utils.py
MySmile/sfchat
4
12791545
from django.http import JsonResponse, HttpResponseNotFound from django.template import RequestContext, loader, Template, TemplateDoesNotExist import logging logger = logging.getLogger(__name__) def json_html_response(request, template_name, code, message): """ Provide response in json or html format accordin...
2.328125
2
setup.py
stolarczyk/peppy
15
12791546
<reponame>stolarczyk/peppy<filename>setup.py #! /usr/bin/env python import os import sys from setuptools import setup REQDIR = "requirements" def read_reqs(reqs_name): deps = [] with open(os.path.join(REQDIR, "requirements-{}.txt".format(reqs_name)), "r") as f: for l in f: if not l.stri...
2.296875
2
tests.py
iRobotCorporation/cfn-yaml-tags
7
12791547
<reponame>iRobotCorporation/cfn-yaml-tags import unittest import six from six.moves import reload_module import json import yaml import cfn_yaml_tags class CfnYamlTagTest(unittest.TestCase): def setUp(self): for module in [yaml.representer, yaml.dumper, yaml.constructor, yaml.loader, yaml]: r...
2.265625
2
prologlib/builtin/iso.py
gpiancastelli/prologlib
0
12791548
from ..parser import Atomic, Variable, Compound, List from ..parser import isvariable, isatom, isnumber, islist, ispartiallist, iscallable from ..core import BuiltIn ### ### Term unification (ISO 8.2) ### class Unify_2(BuiltIn): """'='(?term, ?term) If X and Y are NSTO (Not Subject To Occur-check)...
2.53125
3
ros/dataset_to_rosbag.py
sn0wflake/gta
4,498
12791549
#!/usr/bin/env python from itertools import izip import numpy as np import h5py from progress.bar import Bar import sys import rospy import rosbag from sensor_msgs.msg import Imu, Image def main(): if len(sys.argv) < 2: print("Usage: {} dataset_name".format(sys.argv[0])) exit(1) file_name = sys.argv[1] ...
2.234375
2
pokemon_entities/models.py
A1exander-Pro/pokemon_go_lesson
0
12791550
from django.db import models class Pokemon(models.Model): title = models.CharField(max_length=200, verbose_name="Русское название") title_en = models.CharField(max_length=200, verbose_name="Английское название", blank=True) title_jp = models.CharField(max_length=200, verbose_name="Японское название", blan...
2.078125
2