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
carbonplan_forest_risks/setup/loading.py
norlandrhagen/forest-risks
20
29100
<gh_stars>10-100 import pathlib import urlpath def loading(store=None): if store is None: raise ValueError('data store not specified') if store == 'gs': base = urlpath.URL('gs://') elif store == 'az': base = urlpath.URL('https://carbonplan.blob.core.windows.net') elif store ==...
2.46875
2
remove_svn_folder.py
sdenisen/test
0
29101
<filename>remove_svn_folder.py __author__ = 'Sergey' import shutil import os import stat def read_all_directory_path(root_folder, final_directory_list=[], folder_for_remove='.svn'): under_files_and_folders = os.listdir(root_folder) if os.path.split(root_folder)[1] == folder_for_remove: final_directo...
2.9375
3
tackle/__init__.py
robcxyz/tackle-box
5
29102
"""Main package for tackle box.""" __version__ = "0.1.0-alpha.4"
0.898438
1
app/core/console/base.py
cPoolChia/ChiaAutoplotter-Worker
2
29103
<gh_stars>1-10 from abc import ABC, abstractmethod from typing import Any, AsyncIterable, Callable, Awaitable, Optional, Union import uuid class BaseCommandExecution(ABC): @abstractmethod async def execute( self, command: str, *, stdin: Optional[bytes] = None, cwd: Optional[str] = None ) -> None: ...
2.5
2
apps/flow/run.py
rainydaygit/testtcloudserver
349
29104
from apps.flow.settings import config if config.SERVER_ENV != 'dev': from gevent import monkey monkey.patch_all() else: pass from apps.flow.views.deploy import deploy from apps.flow.views.flow import flow from library.api.tFlask import tflask def create_app(): app = tflask(config) register_blue...
1.851563
2
villas/controller/components/gateways/villas_relay.py
VILLASframework/VILLAScontroller
0
29105
from villas.controller.components.gateway import Gateway class VILLASrelayGateway(Gateway): def __init__(self, manager, args): # Some default properties props = { 'category': 'gateway', 'type': 'villas-relay', 'realm': manager.realm, 'name': args['i...
1.945313
2
ticket/triggers/trg_ticket_prioridade.py
rafaelnoronha/tickets
0
29106
<reponame>rafaelnoronha/tickets def trigger(): return """ CREATE OR REPLACE FUNCTION trg_ticket_prioridade() RETURNS TRIGGER AS $$ DECLARE prioridade_grupo smallint; prioridade_subgrupo smallint; BEGIN prioridade_grupo ...
1.84375
2
itertable/gis/mixins.py
1Q1-Open-Source/itertable
16
29107
<filename>itertable/gis/mixins.py<gh_stars>10-100 import fiona from shapely import wkt, geometry from ..loaders import FileLoader from ..parsers.base import BaseParser from ..mappers import TupleMapper class FionaLoaderParser(FileLoader, BaseParser): """ Composite loader & parser mixin for GIS data, powered b...
2.15625
2
src/service_framework/connections/out/requester.py
ZacharyATanenbaum/service_framework
1
29108
""" File to house a requester connection """ from logging import getLogger import zmq from service_framework.utils.connection_utils import BaseConnection from service_framework.utils.msgpack_utils import msg_pack, msg_unpack from service_framework.utils.socket_utils import get_requester_socket LOG = getLogger(__name...
2.484375
2
module/quantization/cluster_q.py
fightingnoble/Robust-ReRAM-NN
0
29109
# from sklearn.cluster._kmeans import * import copy from typing import Union import torch import torch.nn as nn from sklearn.cluster._robustq import * from .quantizer import Quantizer __all__ = ['MiniBatchRobustqTorch', 'RobustqTorch'] class ClusterQuantizerBase(Quantizer): def __init__(self, n_feature=1, n_cl...
2.265625
2
kattis/Shopping List.py
jaredliw/python-question-bank
1
29110
<reponame>jaredliw/python-question-bank # CPU: 0.18 s n_rows, _ = map(int, input().split()) common_items = set(input().split()) for _ in range(n_rows - 1): common_items = common_items.intersection(set(input().split())) print(len(common_items)) print(*sorted(common_items), sep="\n")
3.703125
4
revuo/forms/__init__.py
Lasanha/revuo
1
29111
from .blog_item import FormBlogItem from .edit_profile import FormEditProfile from .news_item import FormNewsItem from .publication import FormPublication
1.078125
1
helperscripts/es2json.py
waehniger/efre-lod-elasticsearch-tools
0
29112
<reponame>waehniger/efre-lod-elasticsearch-tools #!/usr/bin/python3 # -*- coding: utf-8 -*- from datetime import datetime import json import elasticsearch import argparse import logging import sys, os, time, atexit from signal import SIGTERM #needed for Daemon from httplib2 import Http #needed for put_dict c...
2.265625
2
4/1.py
ZYM-PKU/Raspberry-3B
0
29113
import time import os import spidev as SPI import SSD1306 from PIL import Image, ImageDraw, ImageFont # 调用相关库文件 from datetime import datetime PATH = os.path.dirname(__file__) RST = 19 DC = 16 bus = 0 device = 0 # 树莓派管脚配置 disp = SSD1306.SSD1306(rst=RST, dc=DC, spi=SPI.SpiDev(bus, device)) disp.begin() disp.clear() ...
2.65625
3
python/943.find-the-shortest-superstring.py
stavanmehta/leetcode
0
29114
class Solution: def shortestSuperstring(self, A: List[str]) -> str:
2.71875
3
DjangoDemo/language/chart.py
gaivin/GWeb
1
29115
<reponame>gaivin/GWeb #!/usr/bin/env python # encoding: utf-8 """ @version: v1.0 @author: <NAME> @license: Apache Licence @contact: <EMAIL> @site: @software: PyCharm @file: chart.py @time: 10/10/2018 4:14 PM """ from pyecharts import Bar, Line, WordCloud import pandas as pd import random...
2.65625
3
code/evaluate.py
kajal-puri/point-normals-upsampling
2
29116
# -*- coding: utf-8 -*- import torch import argparse import numpy as np from model import PointCloudNet from code.utils import fp_sampling, knn_patch, helper_function import os parser = argparse.ArgumentParser() parser.add_argument('--num_points', default=1024, type=int, help='Number of points ...
2.1875
2
xyz2image.py
hentr/xyz2image
0
29117
<gh_stars>0 ''' Authors: <NAME>(<EMAIL>) and <NAME> This script is for generating normalised Gaussian simulated annular dark-field scanning transmission electron microscopy (ADF-STEM) images from input atomic coordinates. For rapidly generating a large dataset, it approximates a contrast similar to multislice simulate...
2.546875
3
CollegeBuddy_backend/framework/api/API_Exception.py
tejan-singh/CollegeBuddy
2
29118
<reponame>tejan-singh/CollegeBuddy<filename>CollegeBuddy_backend/framework/api/API_Exception.py class APIException(Exception): def __init__(self, message, code=None): self.context = {} if code: self.context['errorCode'] = code super().__init__(message)
1.875
2
ex084.py
BrianBeyer/pythonExercicios
0
29119
lista = [] pess = [] men = 0 mai = 0 while True: pess.append(str(input('Nome:'))) pess.append(float(input('Peso:'))) if len(lista)==0:# se nao cadastrou ninguem ainda mai = men = pess[1]#o maior é o mesmo que o menor e igual pess na posicao 1 que é o peso else: if pess[1] > mai: ...
3.546875
4
src/solution/3_longest_substring_without_repeating_characters.py
rsj217/leetcode-in-python3
1
29120
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: max_len = 0 l, r = 0, 0 count = dict() while r < len(s): count[s[r]] = count.get(s[r], 0) + 1 while count[s[r]] > 1: count[s[l]] = count[s[l]] - 1 l += 1 ...
3.078125
3
search_engine/worker.py
Dhruvacube/search-engine
0
29121
import importlib from uvicorn.workers import UvicornWorker class DynamicUvicornWorker(UvicornWorker): """ This class is called `DynamicUvicornWorker` because it assigns values according to the module available Union['asyncio', 'uvloop'] It also set `lifespan` to `off` :) """ spam_spec = impo...
2.546875
3
src/deviceinterface.py
nlitz88/metrics
0
29122
<filename>src/deviceinterface.py class DeviceInterface: # This operation is used to initialize the device instance. Accepts a dictionary that is read in from the device's yaml definition. # This device_config_yaml may contain any number of parameters/fields necessary to initialize/setup the instance for data co...
2.84375
3
tensorflow/python/debug/lib/debug_events_reader.py
scentini/tensorflow
27
29123
# Copyright 2019 The TensorFlow Authors. 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...
1.890625
2
src/amuse/couple/bridge.py
aatrani/amuse
0
29124
""" bridge-like integrator for amuse the bridge class provides a bridge like coupling between different gravitational integrators. In this way a system composed of multiple components can be evolved taking account of the self gravity of the whole system self consistently, while choosing the most appropiate i...
3.234375
3
active.py
cgretzem/leaguepkg
1
29125
<gh_stars>1-10 """ Handles classes and methods for an active local Game. Classes: `ActiveGame` - Represents an active LOL game `Player` - represents a player inside the game `ActivePlayer` - subclass of player, represents host `Item` - represents an item in game Methods: `check_status()`...
3.234375
3
UMLRT2Kiltera_MM/transformation_eq_outside/HExitPoint2BProcDefWhetherOrNotExitPtHasOutgoingTrans.py
levilucio/SyVOLT
3
29126
<reponame>levilucio/SyVOLT<gh_stars>1-10 from core.himesis import Himesis import uuid class HExitPoint2BProcDefWhetherOrNotExitPtHasOutgoingTrans(Himesis): def __init__(self): """ Creates the himesis graph representing the DSLTrans rule ExitPoint2BProcDefWhetherOrNotExitPtHasOutgoingTran...
2.40625
2
shellish/command/contrib/ini.py
personnelink/shellish
4
29127
<gh_stars>1-10 """ Show the INI config(s) used by a command tree. """ from .. import command class Show(command.Command): """ Show current INI configuration. Programs may make use of a configuration file which is usually located in your $HOME directory as .<prog>_config. The file is a standard INI ...
3.359375
3
Report folder/Total_image_PCA_analysis/PCA_image_all_samples_1_plot.py
xiaoyanLi629/Coffee-ring-effect-image-analysis
0
29128
import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np from PIL import Image import pandas as pd from sklearn.decomposition import PCA from scipy.spatial.distance import pdist, squareform from scipy.sparse.linalg import eigs from numpy import linalg as LA from mpl_toolkits.mplot3d import Ax...
2.046875
2
example/example_person.py
Shadow-linux/ex_dataclass
18
29129
<reponame>Shadow-linux/ex_dataclass import typing from ex_dataclass import ex_dataclass, asdict, field, EXpack @ex_dataclass class User: # default_factory: 需要给一个类(可callable的对象) name: str = field(default_factory=str) # default: 给定一个默认值 age: int = field(default=0) @ex_dataclass class Team: team_na...
2.96875
3
class and objects/Mro.py
ZephyrAveryl777/Python-Programs
6
29130
''' mro stands for Method Resolution Order. It returns a list of types the class is derived from, in the order they are searched for methods''' print(__doc__) print('\n'+'-'*35+ 'Method Resolution Order'+'-'*35) class A(object): def dothis(self): print('From A class') class B1(A): de...
3.609375
4
src/petmail/test/test_eventsource.py
warner/petmail
25
29131
from twisted.trial import unittest from ..eventsource import EventSourceParser class FakeTransport: disconnecting = False def parse_events(s): fields = [] p = EventSourceParser(lambda name, data: fields.append((name,data))) p.makeConnection(FakeTransport()) p.dataReceived(s) return fields cla...
2.6875
3
coffea/nanoevents/methods/systematics/__init__.py
Junaid-muhamad/coffea
0
29132
from coffea.nanoevents.methods.systematics.UpDownSystematic import UpDownSystematic __all__ = ["UpDownSystematic"]
1.078125
1
etl/parsers/etw/Microsoft_Windows_SecurityMitigationsBroker.py
IMULMUL/etl-parser
104
29133
<filename>etl/parsers/etw/Microsoft_Windows_SecurityMitigationsBroker.py # -*- coding: utf-8 -*- """ Microsoft-Windows-SecurityMitigationsBroker GUID : ea8cd8a5-78ff-4418-b292-aadc6a7181df """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct fro...
1.890625
2
workbench/speech_text/_deepspeech/segment_audio.py
NAshwinKumar/deep-read
6
29134
from pydub import AudioSegment from pydub.silence import split_on_silence def segment(filename,foldername): """ filename : str foldername: str folder to put all the chunks """ sound_file = AudioSegment.from_file(filename) sound_file = sound_file.set_channels(1) sound_file = sound_file.set_frame_rate(16000) ...
3.359375
3
01_Language/01_Functions/python/fread.py
cliff363825/TwentyFour
3
29135
# coding: utf-8 import os size = os.path.getsize("test.txt") with open("test.txt", mode="r") as f: print(f.read(size))
2.796875
3
CalculateLodsTool.py
makeling/AGSSmartVectorTileTools
3
29136
# -*- coding: utf-8 -*- # !/usr/bin/python __author__ = 'ma_keling' # Version : 1.0.0 # Start Time : 2018-12-20 # Update Time : # Change Log : ## 1. ## 2. ## 3. import arcpy import CalculateLods def execute(): in_map = arcpy.GetParameter(0) arcpy.AddMessage("Input map : ...
2.3125
2
neolearnit/src/main/python/get_vocabulary.py
BBN-E/LearnIt
5
29137
<reponame>BBN-E/LearnIt import sys, os, re, codecs, json, glob import random from random import randint from collections import defaultdict from collections import Counter from sets import Set words=Set() def read_json_data(strJsonFile): with codecs.open(strJsonFile, 'r', encoding='utf-8') as f: try: ...
2.96875
3
interactive_widgets/backend/contexts/docker_context.py
h3ndrk/interactive-widgets-backend
0
29138
<filename>interactive_widgets/backend/contexts/docker_context.py import aiodocker import interactive_widgets.backend.contexts.context class DockerContext(interactive_widgets.backend.contexts.context.Context): async def __aenter__(self): self.docker = aiodocker.Docker( url=self.configuration....
2.0625
2
custom_components/xiaomi_cloud_map_extractor/vacuum_manager.py
elad-bar/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor
0
29139
import io import logging import time from typing import List, Optional from custom_components.xiaomi_cloud_map_extractor.common.map_data import MapData from custom_components.xiaomi_cloud_map_extractor.types import Colors, Drawables, ImageConfig, Sizes, Texts try: from miio import RoborockVacuum, DeviceException ...
1.84375
2
util.py
yasser888/Semantic-Segmentation-SDC-P12
0
29140
<filename>util.py import os; import time; cont_file_path = './cont.txt'; log_file_path = './logs/'; def can_continue(): can_cont = True; if os.path.exists(cont_file_path): with open(cont_file_path,'r') as f: line = f.readline(); if(line=='Y'): print("Cont..."); ...
2.921875
3
vtr_flow/scripts/benchtracker/flask_cors/__init__.py
HackerFoo/vtr-verilog-to-routing
1
29141
# -*- coding: utf-8 -*- """ flask_cors ~~~~ Flask-CORS is a simple extension to Flask allowing you to support cross origin resource sharing (CORS) using a simple decorator. :copyright: (c) 2014 by <NAME>. :license: MIT, see LICENSE for more details. """ from .decorator import cross_origin from ...
1.3125
1
ownblock/ownblock/apps/parking/views.py
danjac/ownblock
3
29142
from rest_framework import viewsets from .models import Vehicle from .serializers import VehicleSerializer class VehicleViewSet(viewsets.ModelViewSet): model = Vehicle serializer_class = VehicleSerializer def pre_save(self, obj): if obj.resident_id is None: obj.resident = self.requ...
2.328125
2
Pages/checkout_overview_page.py
gykudo/sauce_demo
0
29143
from Locators.checkout_overview_locator import CheckoutOverviewLocator from Objects.product import Product from Pages.base_page_object import BasePage from Utils.utility import Utils class CheckoutOverViewPage(BasePage): def __init__(self, driver): super().__init__(driver) def get_product_overview_info(self...
2.328125
2
plugin.video.vstream/resources/lib/comaddon.py
akuala/REPO.KUALA
2
29144
# -*- coding: utf-8 -*- # https://github.com/Kodi-vStream/venom-xbmc-addons import xbmcaddon, xbmcgui, xbmc """System d'importation from resources.lib.comaddon import addon, dialog, VSlog, xbmcgui, xbmc """ """ from resources.lib.comaddon import addon addons = addon() en haut de page. utiliser une fonction comad...
2.171875
2
android/replace_apk_resource_pro/replace_source.py
roceys/tools_python
130
29145
<filename>android/replace_apk_resource_pro/replace_source.py #!/usr/bin/env python # encoding: utf-8 """ @version: v1.0 @author: xag @license: Apache Licence @contact: <EMAIL> @site: http://www.xingag.top @software: PyCharm @file: replace_source.py @time: 4/25/19 10:46 @description:替换apk的资源文件 """ from f...
2.65625
3
catalog/bindings/gmd/circle_by_center_point_type.py
NIVANorge/s-enda-playground
0
29146
from dataclasses import dataclass from bindings.gmd.arc_by_center_point_type import ArcByCenterPointType __NAMESPACE__ = "http://www.opengis.net/gml" @dataclass class CircleByCenterPointType(ArcByCenterPointType): pass
2.046875
2
python_modules/dagster/dagster_tests/cli_tests/workspace_tests/multi_file_target_workspace/example_one/pipelines.py
kstennettlull/dagster
0
29147
# type: ignore[attr-defined] from solids import example_one_solid # pylint: disable=import-error from dagster import pipeline @pipeline def example_one_pipeline(): example_one_solid()
1.226563
1
src/rxn_network/firetasks/utils.py
bigboyabhisthi/reaction-network
1
29148
<reponame>bigboyabhisthi/reaction-network "Utility Fireworks functions borrowed from the atomate package." import logging import os import sys from typing import Optional def env_chk( val: str, fw_spec: dict, strict: Optional[bool] = True, default: Optional[str] = None, ): """ Code borrowed fr...
2.359375
2
train.py
aryachiranjeev/TIC-TAC-TOE-using-RL-
0
29149
import random import torch from game import Game from agent import RLAgent from moves import Moves game=Game() agent=RLAgent() moves=Moves() num_win=0 #initialize no. of win by human num_lose=0 #initialize no. of win by ai but loss by human num_tie=0 random.seed(1000) def check_board_and_may_update_state_values():...
2.796875
3
iota-clients/python-client/receive_msg.py
fprotopapa/iota-and-iot
1
29150
# receive_msg.py # # SPDX-FileCopyrightText: Copyright 2021 <NAME> # # SPDX-License-Identifier: MIT # # Receive message from IOTA tangle # import iota_client import os import pprint # Config msg_meta = False env_node_address = 'HORNET_NODE_ADDRESS' # Print Message data def show_message(message, meta=False): if...
2.515625
3
py3status/modules/systemd_suspend_inhibitor.py
boucman/py3status
1
29151
# -*- coding: utf-8 -*- """ Turn on and off systemd suspend inhibitor. Configuration parameters: format: display format for this module (default '[\?color=state SUSPEND [\?if=state OFF|ON]]') lock_types: specify state to inhibit, comma separated list https://www.freedesktop.org/wiki/Software/sy...
2.609375
3
maze/maze.py
SteliosKliafas/shortest_path_algorithms
0
29152
<filename>maze/maze.py import numpy as np import time def create_maze(): height = input("\n Enter the number of rows: ") width = input("\n Enter the number of columns: ") if height.isdigit() and width.isdigit(): height, width = int(height), int(width) grid = np.random.randint(0, 10, (height...
4.03125
4
lexer.py
standy66/kaleidoscope-python
1
29153
<gh_stars>1-10 from typing import Callable from enum import Enum from io import TextIOBase import sys class TokenType(Enum): EOF = -1 DEF = -2 EXTERN = -3 IDENTIFIER = -4 NUMBER = -5 OP = -6 class Token: GENERIC_TOKEN_TYPES = [TokenType.NUMBER, TokenType.IDENTIFIER, TokenType.OP] d...
2.796875
3
astrosql/deprecated/query.py
ketozhang/astroSQL
0
29154
import peeweedb import astropy.units as u def get_by_basename(db, table, basename): """Get data from SQL database by basename. Returns a list of dict""" if isinstance(table, str): assert table in db.get_tables(), "Sanity Check Failed: Table queried does not exist" table = peeweedb.tabl...
2.96875
3
venv/lib/python3.8/site-packages/ansible_collections/community/general/plugins/modules/remote_management/redfish/ilo_redfish_info.py
saeedya/docker-ansible
1
29155
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2021-2022 Hewlett Packard Enterprise, Inc. All rights reserved. # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = ''...
1.789063
2
train/solver.py
nhonth/DeLF-pytorch
315
29156
<reponame>nhonth/DeLF-pytorch #!/usr/bin/env python # -*- coding: utf-8 -*- ''' PyTorch Implementation of training DeLF feature. Solver for step 1 (finetune local descriptor) nashory, 2018.04 ''' import os, sys, time import shutil import torch import torch.nn as nn import torch.optim as optim from torch.autograd impo...
2.375
2
models/p2pnet.py
mfatiho/CrowdCounting-P2PNet
89
29157
import torch import torch.nn.functional as F from torch import nn from util.misc import (NestedTensor, nested_tensor_from_tensor_list, accuracy, get_world_size, interpolate, is_dist_avail_and_initialized) from .backbone import build_backbone from .matcher import build_mat...
2.4375
2
visualize_fullscene.py
ronhlee/retinanet_ATR
1
29158
<gh_stars>1-10 import numpy as np import torchvision import os import argparse import warnings warnings.filterwarnings('ignore') from PIL import Image, ImageDraw import torch from torch.utils.data import Dataset, DataLoader from torchvision import datasets, models, transforms import torchvision.ops from retinanet.datal...
2.078125
2
data_sqlalchemy/word.py
natter1/estonian_learner
0
29159
import datetime from data_sqlalchemy.modelbase import SqlAlchemyBase import sqlalchemy as sa class Word(SqlAlchemyBase): __tablename__ = "words" # id = sa.Column(sa.Integer, primary_key=True, autoincrement=True) id = sa.Column(sa.String, primary_key=True) created_date = sa.Column(sa.DateTime, default...
2.984375
3
nodes/BASE/socket_type.py
nwtajcky/RenderStackNode
0
29160
import bpy from bpy.props import * from ...preferences import get_pref def update_node(self, context): try: self.node.node_dict[self.name] = self.value # update node tree self.node.update_parms() except Exception as e: print(e) class RenderNodeSocketInterface(bpy.types.NodeSo...
2.515625
3
webapp/journal_plugins/example_plugin/models.py
TheCDC/journal_app
2
29161
<filename>webapp/journal_plugins/example_plugin/models.py<gh_stars>1-10 from webapp.extensions import db
1.132813
1
Unsupervised/autoencoder/evaluate_model.py
darshil0193/CSC-522---Object-Recognition
0
29162
from keras.models import load_model import numpy as np import pandas as pd from keras.preprocessing.image import ImageDataGenerator from sklearn.cluster import KMeans from time import time # Takes a pandas dataframe containing the cluster assignment and ground truth for each data point # and returns the purity of the ...
2.796875
3
pkgs/core/bdsim/core/components.py
CallumJHays/bdsim.micropython
0
29163
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Components of the simulation system, namely blocks, wires and plugs. """ from abc import ABC, abstractmethod from typing import Any, Iterable, List, Optional as Opt, Tuple, Union, TYPE_CHECKING from typing_extensions import Literal from bdsim.core import np if TYPE_CH...
2.765625
3
code/alg/placement/random.py
S-Lab-System-Group/ChronusArtifact
7
29164
<reponame>S-Lab-System-Group/ChronusArtifact<filename>code/alg/placement/random.py import os, sys import math import random sys.path.insert(0, os.path.basename(__file__) + os.sep + '..' + os.sep + '..') from server.switch import _Switch from server.node import _Node from utils import util from alg.utils.topology import...
2.421875
2
fbl_handler/test_message_id_extractor.py
wheekey/fbl-handler
0
29165
<reponame>wheekey/fbl-handler from unittest import TestCase from fbl_handler.message_id_extractor import MessageIdExtractor class TestMessageIdExtractor(TestCase): def setUp(self): self.message_id_extractor = MessageIdExtractor() def test_extract_from_yandex_fbl(self): with open('files/yande...
2.671875
3
evohome_rf/opentherm.py
NotBobTheBuilder/evohome_rf
0
29166
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # """Evohome RF - Opentherm processor.""" import logging import struct from typing import Any from .const import __dev_mode__ DEV_MODE = __dev_mode__ _LOGGER = logging.getLogger(__name__) if DEV_MODE: _LOGGER.setLevel(logging.DEBUG) # Data structure shamelessy cop...
2.046875
2
mut/viz.py
RPGroup-PBoC/mwc_mutants
3
29167
import bokeh.io import bokeh.plotting import bokeh.layouts import bokeh.palettes import seaborn as sns import numpy as np import os import matplotlib.pyplot as plt import matplotlib def plotting_style(grid=True): """ Sets the style to the publication style """ rc = {'axes.facecolor': '#E3DCD0', ...
2.6875
3
pipeline/decorator.py
jnis77diver/django-pipeline
0
29168
<reponame>jnis77diver/django-pipeline<filename>pipeline/decorator.py # -*- coding: utf-8 -*- from __future__ import unicode_literals """ This code is a part of django.utils.six on https://github.com/django/django/blob/stable/2.2.x/django/utils/six.py removed form Django 3.0 To keep the backward compatibility ...
2.375
2
nowplaying/recognition/theaudiodb.py
whatsnowplaying/whats-now-playing
16
29169
<gh_stars>10-100 #!/usr/bin/env python3 ''' start of support of theaudiodb ''' from html.parser import HTMLParser import logging import logging.config import logging.handlers import os import requests import requests.utils import nowplaying.bootstrap import nowplaying.config from nowplaying.recognition import Recogn...
2.53125
3
reno/tests/test_create.py
mail2nsrajesh/reno
0
29170
# -*- coding: utf-8 -*- # 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, softw...
2.109375
2
maindb/query.py
DesmondYuan/ArtSearch
0
29171
<reponame>DesmondYuan/ArtSearch import os import io import os import pandas as pd import numpy as np from google.cloud import vision from PIL import Image from google.cloud import vision from sklearn.metrics.pairwise import cosine_similarity from sklearn.metrics import mean_squared_error as MSE import pickle as pkl imp...
2.4375
2
tests/common/scripts/cleaning/test_strip.py
arkhn/fhir-river
42
29172
<filename>tests/common/scripts/cleaning/test_strip.py<gh_stars>10-100 from common.scripts.cleaning import strip def test_clean_identity(): assert strip(None) == "" assert strip("NaN") == "" row_input = "Holà chicanos" assert strip(row_input) == row_input
2.03125
2
app.py
Munawwar/image-background-remove-tool
0
29173
<filename>app.py from main import process import os import platform import subprocess import sys import threading import webview def worker_thread(window, inputfiles, model): print('processing started ...') count = 0 for inputfile in inputfiles: count += 1 (inputfilepath, inputfilename) = os.pa...
2.59375
3
grpc_django/models.py
soheltarir/grpc-django
12
29174
<filename>grpc_django/models.py from django.contrib.auth.models import AbstractUser # Create your models here. class ContextUser(AbstractUser): """ Just an abstract model class to represent Auth user coming as context in GRPC requests """ class Meta: abstract = True def __str__(self): ...
2.671875
3
models/vgg_cifar_lp.py
mengjian0502/BNFusionTrain
0
29175
import math import torch.nn as nn from .modules import QConv2d, QLinear def make_layers(cfg, batch_norm=False, wbit=4, abit=4): layers = list() in_channels = 3 for v in cfg: if v == 'M': layers += [nn.MaxPool2d(kernel_size=2, stride=2)] elif v == 'A': layers += [nn....
2.140625
2
library/central_templates.py
ageoffron/aruba-central-ansible-role
1
29176
#!/usr/bin/python ''' Central Templates Ansible Module ''' # MIT License # # Copyright (c) 2020 Aruba, a Hewlett Packard Enterprise company # # 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 w...
1.726563
2
habitat/_common/models/date.py
matrach/habitatOS
1
29177
from django.db import models from django.utils.translation import ugettext_lazy as _ from habitat.timezone import get_timezone timezone = get_timezone() class MissionDate(models.Model): date = models.CharField( verbose_name=_(timezone.DATE_VERBOSE_NAME), help_text=_(timezone.DATE_HELP_TEXT), ...
2.34375
2
tools/view_control_loop.py
gbalke/bldc-controller
0
29178
#!/usr/bin/env python from __future__ import print_function import sys import serial import time from math import sin, cos, pi import argparse import ast from comms import * from boards import * from livegraph import livegraph if __name__ == '__main__': parser = argparse.ArgumentParser(description='Drive motor m...
2.609375
3
pylot/planning/messages.py
fangedward/pylot
0
29179
<filename>pylot/planning/messages.py import erdos class WaypointsMessage(erdos.Message): """Message class to be used to send waypoints. Optionally can also send a target speed for each waypoint. Args: timestamp (:py:class:`erdos.timestamp.Timestamp`): The timestamp of the message. ...
2.96875
3
Intro/3_Smooth_Sailing/10_commonCharacterCount.py
RylandGomez/CS-Arcade
0
29180
<gh_stars>0 def solution(s1, s2): ''' EXPLANATION ------------------------------------------------------------------- I approached this problem by creating two dictionaries, one for each string. These dictionaries are formatted with characters as keys, and counts as values. I then iterate over e...
3.859375
4
semlabs/iteralg/sem1.py
Revengerzz/Labs
0
29181
a = float(input('Введите число: ')) def koren (a): x = 3 k = 0 if (a<0): raise ValueError('Ошибка, введите число, меньшее нуля') while k != (a**0.5): k = 0.5 * (x + a/x) x = k return(k) print('Корень из числа ' + str(a) + ' равен ' + str(koren(a)))
3.984375
4
dataset_tools/dataset_case/base_case.py
jprashant21/ElNeuKGQA
0
29182
from typing import Optional class BaseCaseMethodNotImplemented(Exception): """ Exception when a BaseCase method has not been implemented. """ pass class BaseCase: """ Base class for representing a dataset case with a mandatory question text and an optional question id and sparql query an...
3.5
4
06.8_bst_spiral.py
EashanKaushik/Data-Structures
0
29183
<gh_stars>0 class Node: def __init__(self, data=None, left=None, right=None): self._left = left self._data = data self._right = right @property def left(self): return self._left @left.setter def left(self, left): self._left = left @property def right(self): return self._right @right.setter def ...
3.625
4
app/run.py
Jaghwani/Disaster-Response-Pipeline
0
29184
<gh_stars>0 import json import plotly import pandas as pd from nltk.stem import WordNetLemmatizer from nltk.tokenize import word_tokenize from flask import Flask from flask import render_template, request, jsonify from plotly.graph_objs import Bar from sklearn.externals import joblib from sqlalchemy import create_eng...
2.890625
3
workflow/scripts/data/__init__.py
percyfal/wg-genealogy-smk
1
29185
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __all__ = ("natural_earth",) from .natural_earth import natural_earth
1.28125
1
1_mundo_exercicios/ex012.py
GuilhermeLima182/CursoDePython
0
29186
#Faça um programa que pergunte ao usuario o valor do produto, #e mostre o valor final com 5% de desconto. valorProduto = float(input('Qual o valor do produto? R$ ')) desconto = (valorProduto * 5) / 100 vFinal = valorProduto - desconto print('O valor do produto é R${}'.format(valorProduto)) print('O novo valor com o d...
3.84375
4
python/plot_meridional_avg_multiple_fields_climo.py
E3SM-Project/a-prime
1
29187
<reponame>E3SM-Project/a-prime # # Copyright (c) 2017, UT-BATTELLE, LLC # All rights reserved. # # This software is released under the BSD license detailed # in the LICENSE file in the top level a-prime directory # ###Work in Progress: Plot meridional averages for different fields in the same plot. ###07/03/2017 impor...
1.953125
2
sample/sample.py
dogwood008/python-kabusapi
11
29188
<reponame>dogwood008/python-kabusapi import kabusapi url = "localhost" port = "18081" # 検証用, 本番用は18080 password = "<PASSWORD>" # 初期設定・トークン取得 api = kabusapi.Context(url, port, password) # 取得トークンの表示 print(api.token) # トークンを指定した初期設定 パスワードが不要 api = kabusapi.Context(url, port, token='<PASSWORD>') # 注文発注 (現物買い) data =...
2.46875
2
tests/runtime/doubling_vector.py
yangdanny97/chocopy-python-compiler
7
29189
<reponame>yangdanny97/chocopy-python-compiler<filename>tests/runtime/doubling_vector.py # A resizable list of integers class Vector(object): # Attributes items: [int] = None size: int = 0 # Constructor def __init__(self:"Vector"): self.items = [0] # Returns current capacity def cap...
3.921875
4
refinery/units/blockwise/map.py
bronxc/refinery
0
29190
<reponame>bronxc/refinery<filename>refinery/units/blockwise/map.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- from typing import Dict, Optional, Sequence from refinery.units.blockwise import Arg, BlockTransformation from refinery.lib.tools import isbuffer class map(BlockTransformation): """ Each block of...
2.640625
3
Python-codes-CeV/51-Arithmetic_P.py
engcristian/Python
1
29191
<reponame>engcristian/Python ''' Arithmetic progression with 10 elements. ''' first_term = int(input('Type the first term of this A.P: ')) reason = int(input('Type the reason of this A.P: ')) last_term = first_term + (50-1)*reason # A.P formula for c in range (first_term, last_term + reason , reason): print(c, end...
3.625
4
src/cascade_at/executor/dismod_db.py
ihmeuw/cascade-at
1
29192
<reponame>ihmeuw/cascade-at #!/usr/bin/env python import logging import sys from pathlib import Path from typing import Union, List, Dict, Any, Optional, Tuple import os import numpy as np import pandas as pd from cascade_at.core import CascadeATError from cascade_at.context.model_context import Context from cascade_a...
1.703125
2
astropy/config/__init__.py
xiaomi1122/astropy
0
29193
<filename>astropy/config/__init__.py<gh_stars>0 # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains configuration and setup utilities for the `astropy` project. This includes all functionality related to the affiliated package index. """ from __future__ import (absolute_import, div...
1.367188
1
ABC169/F.py
shimomura314/AtcoderCodes
0
29194
<filename>ABC169/F.py import sys from collections import defaultdict input = sys.stdin.readline mod = 998244353 def extgcd(a,b): r = [1,0,a] w = [0,1,b] while w[2] != 1: q = r[2]//w[2] r2 = w w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]] r = r2 w = w2 return [w[0],...
2.46875
2
ferry/nlp/fetch/fetch_evals.py
coursetable/ferry
4
29195
<reponame>coursetable/ferry # pylint: skip-file import json import requests url = "http://localhost:8085/v1/graphql" def fetch_evals(term, dump=True): query = ( """ query MyQuery { courses(where: { season: {season_code: {_eq: \"""" + str(term) + """\"}...
3.140625
3
spec/person.py
ace6807/spec-data-validation-pattern
1
29196
<reponame>ace6807/spec-data-validation-pattern from dataclasses import dataclass from . import Spec from dto.person import PersonDTO @dataclass class HasNameSpec(Spec): def passes(self, candidate: PersonDTO) -> bool: return candidate.name is not None and candidate.name != "" @dataclass class HasAgeSpec(...
3.25
3
src/wattbike_importer.py
sdresearch/what-watt1
0
29197
import requests HUB_LOCATION = 'http://hub.wattbike.com/ranking/getSessionRows?sessionId=' class HubClient: def __init__(self, location=None): self.location = location if location else HUB_LOCATION def _validate_session_id(self, session_id): # TODO: add regex validation of session_id ...
2.828125
3
main/views.py
ericrobskyhuntley/vialab.mit.edu
0
29198
<filename>main/views.py from django.shortcuts import get_object_or_404, render from django.http import Http404 from .models import MainMetadata from cal.models import Event from classes.models import ClassInstance from cal.models import Event from datetime import date, timedelta # Create your views here. def about(r...
2.015625
2
backend/generate-events.py
daveygit2050/kow-london.co.uk
0
29199
<reponame>daveygit2050/kow-london.co.uk<gh_stars>0 import json import requests import tenacity from bs4 import BeautifulSoup from geopy.geocoders import Nominatim from urllib.parse import parse_qs from urllib.parse import urlparse @tenacity.retry(retry=tenacity.retry_if_exception_type(IOError), wait=tenacity.wait_fix...
2.9375
3