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
tests/integration/cmor/_fixes/cmip5/test_cnrm_cm5.py
markelg/ESMValCore
26
50900
"""Test CNRM-CM5 fixes.""" import unittest from cf_units import Unit from iris.cube import Cube from esmvalcore.cmor.fix import Fix from esmvalcore.cmor._fixes.cmip5.cnrm_cm5 import Msftmyz, Msftmyzba class TestMsftmyz(unittest.TestCase): """Test msftmyz fixes.""" def setUp(self): """Prepare tests."...
2.234375
2
artifacts/collector.py
mattchurchill/artifacts
1
50901
<reponame>mattchurchill/artifacts<filename>artifacts/collector.py #!/usr/bin/python # -*- coding: utf-8 -*- """The collector definition objects. These classes allow us to validate artifact definitions by instantiating them as objects. For your implementation you want to likely implement collector objects that actual c...
2.5
2
pdbsync/core/plugins/db_create.py
knightliao/pdbsync
8
50902
# !/usr/bin/env python # coding=utf8 import tempfile from pdbsync.core.plugins.execute import PyExecute class DbCreateExecutor(PyExecute): def __init__(self, dest_db): super(DbCreateExecutor, self).__init__(dest_db) def run(self, **kwargs): create_sql = "DROP DATABASE IF EXISTS `%s`;\ ...
2.484375
2
tests/unittest/test_optimizer.py
brettkoonce/gluon-nlp
1
50903
# 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.75
2
cogs/common.py
Digbigpig/FinalFight
0
50904
<filename>cogs/common.py import sys import traceback from discord.ext import commands import settings from cogs.utils import inserts, exceptions from cogs.utils import perms class Common: """ Common commands. """ # TODO: Move error handlers to handlers.py or something def __init__(self, bot)...
2.515625
3
speedysvc/web_monitor/WebServiceManager.py
mcyph/shmrpc
4
50905
import sys from datetime import datetime LColours = [ 'red', 'green', 'blue', 'purple', 'orange', 'brown', 'pink', 'cyan', 'magenta', 'yellow' ] class WebServiceManager: def __init__(self, jinja2_env): self.jinja2_env = jinja2_env self.DServices = {} # TODO: Replace me, directly...
2.796875
3
test.py
amifunny/tf-stitch
8
50906
<filename>test.py # Subprocess to run CLI for package import subprocess import unittest import os MODULE = "python -m tf_stitch" MODULE_ARG = MODULE.split() # File to generate FILENAME = "output.py" class Test(unittest.TestCase): def execute_query( self, args, filename=FILENAME ): """ Execute command to gener...
3.015625
3
src/python/fsqio/pants/wiki/subsystems/confluence_subsystem.py
jglesner/fsqio
252
50907
<gh_stars>100-1000 # coding=utf-8 # Copyright 2019 Foursquare Labs Inc. All Rights Reserved. from __future__ import absolute_import, division, print_function, unicode_literals import urllib from pants.subsystem.subsystem import Subsystem from pants.util.memo import memoized_property class ConfluenceSubsystem(Subsy...
2.171875
2
athene/beamer/beamer.py
Genius1512/athene
1
50908
import sys from sys import argv sys.path.append("../athene") import requests from athene.console import console from rich.status import Status # parse identifiers to keys def parse_key(key: str): try: return { "close": "3B", "vidmute": "3E", "freeze": "47", ...
2.5625
3
tests/test_views.py
The-Compiler/crashbin
0
50909
from http import HTTPStatus import pytest from django import urls from crashbin_app.models import Bin, OutgoingMessage, NoteMessage, Label pytestmark = pytest.mark.django_db def test_home(admin_client): response = admin_client.get(urls.reverse("home")) assert response.status_code == HTTPStatus.OK asse...
2.0625
2
callbacks/dbconn_callbacks.py
peilinja/A-medical-business-data-quality-check-web-tool
1
50910
<filename>callbacks/dbconn_callbacks.py import json import dash from dash import html from dash import dcc import dash_bootstrap_components as dbc import pandas as pd import numpy as np import plotly.express as px from dash.dependencies import Output, Input, State from datetime import datetime, timedelta from server i...
2.1875
2
impacts_estimation/exceptions.py
openfoodfacts/off-product-environmental-impact
3
50911
<gh_stars>1-10 """ Exceptions used by the impact estimation program """ class RecipeCreationError(Exception): pass class SolverTimeoutError(Exception): pass class NoKnownIngredientsError(Exception): pass class NoCharacterizedIngredientsError(Exception): pass
1.421875
1
fbx/lib/Python27_x64/py3.py
whaison/Python27
0
50912
from fbx import * print('Hello world') print("C:/Python27/fbx/lib/Python27_x64/") print("OK__?")
1.40625
1
oreto_utils/json_utils.py
OhRetro/oreto-utils
0
50913
<reponame>OhRetro/oreto-utils #JSON import json from oreto_utils.file_utils import File class JSON: def __init__(self, jsonfile:str, path:str="./"): jsonfile = jsonfile.removesuffix(".json") self.json_file = File(jsonfile, ".json", path) #It will return the whole json file content def...
2.9375
3
methods/points/match.py
ciampluca/counting_perineuronal_nets
6
50914
<reponame>ciampluca/counting_perineuronal_nets<filename>methods/points/match.py import numpy as np from scipy.optimize import linear_sum_assignment from scipy.spatial.distance import cdist # wrapper for scipy's Hungarian algorithm to deal with infs in the cost matrix # https://github.com/scipy/scipy/issues/6900#issue...
2.234375
2
lightnion/http/ntor.py
pthevenet/lightnion
120
50915
import lightnion as lnn import nacl.public import base64 def hand(guard, encode=True): identity = base64.b64decode(guard['router']['identity'] + '====') onion_key = base64.b64decode(guard['ntor-onion-key'] + '====') ephemeral_key, payload = lnn.crypto.ntor.hand(identity, onion_key) if encode: ...
2.359375
2
threespot/documentation/management/commands/build_docs.py
macfound/django-threespot
6
50916
<reponame>macfound/django-threespot import subprocess from django.core.management.base import BaseCommand from threespot.documentation import app_settings class Command(BaseCommand): """ This Django management command allows you to publish the sphinx documentation for the project. It is run thusly:...
2.171875
2
consts.py
farhad-rezazadeh/snake
0
50917
import json f = open("config.json") data = json.loads(f.read()) f.close() back_color = data['back_color'] fruit_color = data['fruit_color'] block_color = data['block_color'] cell_size = data['cell_size'] block_cells = data['block_cells'] table_size = data['table_size'] height = data['height'] width = data['width']...
2.5
2
tests/test_create.py
yasuotakei/torrent_parser
1
50918
<reponame>yasuotakei/torrent_parser<filename>tests/test_create.py from __future__ import unicode_literals import collections import hashlib import io import os.path import unittest from torrent_parser import TorrentFileParser, TorrentFileCreator class TestCreate(unittest.TestCase): TEST_FILES_DIR = os.path.join...
2.515625
3
backend/YouGrowGirl/plants/models.py
IsoHan/You-Grow-Girl
1
50919
from django.db import models # Create your models here. # example model class Plant(models.Model): common_name = models.CharField(max_length=100, unique=True) img_name = models.CharField(max_length=100, default=False) sunlight = models.CharField(max_length=100, blank=True) moisture = models.CharField...
2.34375
2
tests/test_workspace.py
chaosiq/chaosiq-cloud
4
50920
<filename>tests/test_workspace.py # -*- coding: utf-8 -*- import os from tempfile import NamedTemporaryFile from unittest.mock import patch from chaoscloud.workspace import workspace_metadata, \ set_workspace_path, get_workspace_path, initialize_workspace_path, \ get_loaded_workspace_data, set_workspace_data, ...
2.234375
2
reid/loss/virtual_ce.py
JeremyXSC/MCN-MT
51
50921
from __future__ import absolute_import import torch from torch import nn from torch.autograd import Variable from torch.nn import functional as F from scipy.stats import norm import numpy as np class VirtualCE(nn.Module): def __init__(self, beta=0.1): super(VirtualCE, self).__init__() self.beta ...
2.15625
2
packager/third_party/libwebm/libwebm.gyp
nevil/shaka-packager
1
50922
<filename>packager/third_party/libwebm/libwebm.gyp # Copyright 2015 Google Inc. All rights reserved. # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd { 'includes': [ ], 'targets': [ { 't...
0.746094
1
get_ckt_yr_from_case.py
praneethy91/5_Law-Sentiment
0
50923
import pandas as pd import pickle as pkl data=pd.read_stata("data/BloombergVOTELEVEL_Touse.dta",chunksize=100,convert_categoricals=False) data_sliced=pd.DataFrame() print("started slicing") for chunk in data: data_sliced = data_sliced.append(chunk[['Circuit', 'caseid', 'date']], ignore_index=True) print("started p...
2.703125
3
TwitterClient.py
Yin-Zhang-TR/DSproject12
0
50924
import os import sys from tweepy import API from tweepy import OAuthHandler def get_twitter_auth(): try: consumer_key='F0imGgOVzAzOpDuayoaIvSTC0' consumer_secret_key='<KEY>' access_token='<KEY>' access_secret_token='<KEY>' print("Connected Successfully") ex...
2.671875
3
tests/refs/some_pkg/__init__.py
amirkdv/sphinxcontrib-wiki
1
50925
# -*- coding: utf-8 -*- """ First paragraph of docs. .. wikisection:: faq :title: Why? Well... Second paragraph of docs. """
0.8125
1
hexrd/imageseries/load/metadata.py
glemaitre/hexrd
27
50926
<reponame>glemaitre/hexrd<filename>hexrd/imageseries/load/metadata.py """metadata tools for imageseries""" import os import yaml import numpy as np def yamlmeta(meta, path=None): """ Image sequence metadata *path* is a full path or directory used to find the relative location of files loaded via t...
2.265625
2
lenstools/scripts/raytracing.py
asabyr/LensTools
1
50927
<gh_stars>1-10 ######################################################## ############Ray Tracing scripts######################### ######################################################## from __future__ import division,with_statement import sys,os import time import gc from operator import add from functools import re...
1.53125
2
core/wsgi.py
vlafranca/stream_framework_example
102
50928
""" WSGI config for pinterest_example project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings") from django...
1.75
2
test_module.py
eshutan/astr-19
0
50929
<reponame>eshutan/astr-19 def hello_world(): print("hello world, we made a module")
1.421875
1
APIScan/models.py
sporiyano/archerysec
1
50930
<reponame>sporiyano/archerysec<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models # Create your models here. class APIScan_db(models.Model): project_id = models.UUIDField(blank=True) scan_url = models.URLField(blank=True) scan_id = models.UUIDField(...
2.125
2
tests/test/mixed_vschema/vschema_basic.py
mace84/script-languages
6
50931
#!/usr/opt/bs-python-2.7/bin/python # -*- coding: utf-8 -*- import unittest import datetime import re from datetime import datetime, timedelta from textwrap import dedent import sys import os sys.path.append(os.path.realpath(__file__ + '/../../../lib')) import udf import exatest from vschema_common import VSchemaTes...
2.03125
2
src/address/address.py
acud/py-swarm
1
50932
<reponame>acud/py-swarm<gh_stars>1-10 class Address(object): def __init__(self,addr): self.addr=addr @classmethod def fromhex(cls,addr): return cls(bytes.fromhex(addr)) def equal(self,other): if not isinstance(other, Address): raise Exception('peer is not an address...
3.09375
3
CursoEmVideoPython/hello_world.py
miguelabreuss/scripts_python
0
50933
import emoji print(emoji.emojize('Python é :thumbs_up:'))
2
2
OnlySnarf/src/classes/promotion.py
sec-js/onlysnarf
41
50934
<reponame>sec-js/onlysnarf<gh_stars>10-100 import re from datetime import datetime from .driver import Driver from .settings import Settings from .user import User from PyInquirer import prompt from PyInquirer import Validator, ValidationError ## from .validators import AmountValidator, MonthValidator, LimitValidator, ...
2.65625
3
recommend/eusolver/scripts/job_list_icfp_one_shot.py
jiry17/IntSy
7
50935
# job_list_one_shot.py --- # # Filename: job_list_one_shot.py # Author: <NAME> # Created: Tue Jan 26 15:13:19 2016 (-0500) # # # Copyright (c) 2015, <NAME>, University of Pennsylvania # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided tha...
1.3125
1
routines/transposeProducts.py
nonapod/thunderhawk
1
50936
<gh_stars>1-10 import os import sys # Check to see if we're in the app root directory, if we are add it to the path, if not, exit. cwd = os.getcwd() if "src" in os.listdir() and "Thunderhawk.py" in os.listdir(os.path.join(cwd, "src")): sys.path.append(cwd) os.chdir(cwd) else: raise Exception("Routines shou...
2.296875
2
couchdb_cluster_admin/__init__.py
dimagi/couchdb-cluster-admin
2
50937
from __future__ import absolute_import from __future__ import unicode_literals __version__ = "0.7.0"
1.070313
1
telnet.py
melihteke/istihza
0
50938
import getpass import telnetlib HOST = "192.168.178.55" user = input("Enter your telnet username: ") password = <PASSWORD>() tn = telnetlib.Telnet(HOST) tn.read_until(b"Username: ") tn.write(user.encode('ascii') + b"\n") if password: tn.read_until(b"Password: ") tn.write(password.encode('ascii') + b"\n") tn...
3.0625
3
Mastering Django source/section1/part3/mixins.py
PacktPublishing/Mastering-Django-Web-Development
5
50939
class OnlyStaffMixin(object): def dispatch(self, request, *args, **kwargs): if not request.user.is_staff: messages.error(request, "Only Staff members can do this.") try: return HttpResponseRedirect(request.META['HTTP_REFERER']) except KeyEr...
2.0625
2
spikeforest/sf_batch/compute_unit_snrs.py
tjd2002/spikeforest2
0
50940
<reponame>tjd2002/spikeforest2 import numpy as np def get_random_spike_waveforms(*,recording,sorting,unit,snippet_len,max_num,channels=None): st=sorting.getUnitSpikeTrain(unit_id=unit) num_events=len(st) if num_events>max_num: event_indices=np.random.choice(range(num_events),size=max_num,replace=Fa...
2.390625
2
train.py
thinkreed/ECBSR
162
50941
import torch import torch.nn as nn import torch.nn.functional as F from datas.benchmark import Benchmark from datas.div2k import DIV2K from models.ecbsr import ECBSR from torch.utils.data import DataLoader import math import argparse, yaml import utils import os from tqdm import tqdm import logging import sys import ti...
1.9375
2
root/os/DSAA/DataStructuresAndAlgorithms/python/chutils/chutils/chasyncio/aio_bench.py
chyidl/chyidlTutorial
5
50942
<reponame>chyidl/chyidlTutorial<gh_stars>1-10 #! /usr/bin/env python3 # -*- coding: utf-8 -*- # # aio_bench.py # chasyncio # # 🎂"Here's to the crazy ones. The misfits. The rebels. # The troublemakers. The round pegs in the square holes. # The ones who see things differently. They're not found # of rules. And they have...
2.9375
3
path_planner/src/solver.py
eSpace-epfl/rospace-planning
0
50943
# @copyright Copyright (c) 2017, <NAME> (<EMAIL>) # # @license zlib license # # This file is licensed under the terms of the zlib license. # See the LICENSE.md file in the root of this repository # for complete details. """Class holding the definition of the Solver, which outputs a manoeuvre plan given a scenario.""" ...
2.875
3
results/v161_cuda70_k40c.py
supreethms1809/magma-2.2.0
31
50944
<reponame>supreethms1809/magma-2.2.0 import numpy from numpy import array, nan, inf version = '1.6.1' cuda = '7.0' device = 'Kepler K40c' cpu = '2x8 core Sandy Bridge E5-2670' # ------------------------------------------------------------ # file: v1.6.1/cuda7.0-k40c/cgeev.txt # numactl --interleave=all ./test...
1.585938
2
pytorch_lightning_pbt_examples/lab/__init__.py
corypaik/pytorch-lightning-pbt
1
50945
#!/usr/bin/env python # -*- coding: utf-8 -*- # --------------------- # PyTorch Lightning PBT # Authors: <NAME> # Rocket Romero # Updated: May. 2020 # --------------------- """ Root. """ import logging as python_logging _logger = python_logging.getLogger('lightning:pbt:lab') python_logging.basicConfig(leve...
1.65625
2
mass_spectrum/setup.py
kpriya97/MassSpec_Data_Extraction
0
50946
<filename>mass_spectrum/setup.py #!/usr/bin/env python """Setup script.""" from setuptools import setup, find_packages requirements = ["pyopenms", "flask", "requests", "click", "werkzeug", "pandas", "numpy" ...
1.484375
1
directory_scan/dsaiologger/logger.py
i-g-chernyakov/directory-scan
0
50947
# -*- coding: utf-8 -*- """ Patch for aiologger.logger.Logger aiologger (https://github.com/B2W-BIT/aiologger) implements 'async/await' syntax for logging. But there is a problem with aiologger working in Windows. The stdout and stderr streams in aiologger are connected as pipes. But in Windows it doesn't work. In ...
2.15625
2
Linkedin/linkedin-become-a-programmer-foundations/2.programming-foundations-beyond-the-fundamentals/Ch07/07_07/plant.py
mohammedelzanaty/myRoad2BeFullStack
2
50948
<reponame>mohammedelzanaty/myRoad2BeFullStack def plant_recommendation(care): if care == 'low': print('aloe') elif care == 'medium': print('pothos') elif care == 'high': print('orchid') plant_recommendation('low') plant_recommendation('medium') plant_recommendation('high')
2.734375
3
p3/listeners.py
ethancarlsson/epcon
40
50949
<filename>p3/listeners.py<gh_stars>10-100 import logging from django.conf import settings from django.urls import reverse from django.db.models.signals import post_save from assopy.models import ticket_for_user, user_created from assopy import dataaccess as cd from conference.listeners import fare_tickets from confer...
2.171875
2
inbm-lib/tests/unit/inbm_vision_lib/test_ota_parser.py
ahameedx/intel-inb-manageability
5
50950
import os from unittest import TestCase from inbm_vision_lib.xml_handler import XmlHandler, XmlException from inbm_vision_lib.ota_parser import ParseException, get_children, parse_pota MISSING_HEADER_XML = '<?xml version="1.0" encoding="utf-8"?> <manifest><type>ota</type>' \ '<ota><type><fota name="sample"><target...
2.1875
2
praw_memories/prawdebug.py
elnuno/praw_memories
1
50951
"""Debugging facilities for PRAW-based projects.""" import datetime import json import logging import time import praw import prawcore
1.164063
1
examples/diamond.py
mcptr/step-machine
0
50952
from machine import Machine, Plot, Colors import numpy as np class MyPlot(Plot): width = 65 steps = width // 2 copies = 1 char = "." spacing = 0 default_color = Colors.BLUE def __call__(self, plane, loop, step, *args, **kwargs): char = Colors.white("@") if loop % 2 == 0 else Color...
2.984375
3
research/cgroups.py
chuongmep/rhino.inside-revit
166
50953
"""Group Revit built-in categories logically and output the data in json The built-in categories are provided in text files under DATA_DIR Usage: python3 ./cgroups.py group and output categories python3 ./cgroups.py <catname> group and output <catname> category only """ # pylint: disable=bad-c...
2.953125
3
kosimpletax/y2018/formula.py
ho9science/korea_simplified_tax
1
50954
<reponame>ho9science/korea_simplified_tax<filename>kosimpletax/y2018/formula.py MANWON = 10000 CHONWON = 1000 def median_income_section(pay): str_pay = str(int(pay/10000)) median = 0 if pay < 1060*CHONWON: median = 0 elif pay < 1500*CHONWON: if int(int(str_pay)/5) == 0: median = float(str_pay+"25") else:...
3.46875
3
glimslib/simulation/config.py
danielabler/glimslib
0
50955
from glimslib.config import * output_dir_simulation_tmp = os.path.join(output_dir_simulation, 'sim_tmp') output_dir_plot_tmp = os.path.join(output_dir_simulation, 'plot_tmp')
1.367188
1
mangadex_py/cli/argparse.py
Sydiepus/mangadex-py
3
50956
<reponame>Sydiepus/mangadex-py from argparse import ArgumentParser from mangadex_py.meta import version from .general_args import _gen_args from .downloading_args import _download_args from .required_args import _required_args from .auth_args import _auth_args def initialize_args() -> ArgumentParser : args_parser...
2.375
2
dagger/runtime/local/types.py
raztud/dagger
9
50957
"""Data types used for local invocations.""" from typing import Any, Generic, Iterable, Iterator, Mapping, NamedTuple, TypeVar, Union from dagger.serializer import Serializer T = TypeVar("T") class OutputFile(NamedTuple): """Represents a file in the local file system that holds the serialized value for a node ...
2.5625
3
permoize/core.py
idmit/permoize
0
50958
# -*- coding: utf-8 -*- from functools import wraps from inspect import getargspec, getmodule from diskcache import Cache def qualified_name(x): return '{}.{}'.format(getmodule(x).__name__, x.__name__) def permoize(cache_dir, explicit=False): def decorator(fn): arg_spec = getargspec(fn) nb...
2.5
2
eslearn/machine_learning/classfication/lc_elasticNetCV.py
dongmengshi/easylearn
0
50959
<reponame>dongmengshi/easylearn<filename>eslearn/machine_learning/classfication/lc_elasticNetCV.py # -*- coding: utf-8 -*- """ Created on Tue Dec 18 19:23:42 2018 ElasticNetCV Minimizes the objective function: 1 / (2 * n_samples) * ||y_train - Xw||^2_2 + alpha * l1_ratio * ||w||_1 + 0.5 * alpha * (1 - l1_ra...
2.796875
3
src/scene.py
caiofattori/PyPFSDesign
0
50960
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QGraphicsProxyWidget from PyQt5.QtWidgets import QTableWidgetItem, QGraphicsSceneMouseEvent from PyQt5.QtCore import Qt, pyqtSignal, QRect, QPointF from PyQt5.QtGui import QMouseEvent, QTransform, QKeyEvent, QPainter from element import PFSActivity, PFSDistribu...
2.21875
2
hydroserver/hydroserver_core/core_database_models/__init__.py
kjlippold/his_hydroserver
1
50961
<filename>hydroserver/hydroserver_core/core_database_models/__init__.py from hydroserver_core.core_database_models import odm2_sqlite
1.015625
1
website/utils/db_fields/file_fields.py
SebastiaanZ/minigigscyclingteam
0
50962
import hashlib import io import sys from typing import Optional from PIL import Image, ImageOps from django.core import checks from django.core.files.uploadedfile import InMemoryUploadedFile from django.db.models import ImageField class ResizedHashNameImageField(ImageField): """A custom ImageField class that wil...
2.703125
3
kickstarter/generic/loggers.py
kpsaurus/Flask-Kickstarter
0
50963
""" ------------------------ Loggers module The module consists Logger class that can be used by various modules in various scenarios for logging purpose. ------------------------ """ import logging from datetime import datetime from flask import current_app import os class Logger: """ Custom logger class ...
3.15625
3
examples/guac.py
conix-center/ARENA-py
4
50964
<reponame>conix-center/ARENA-py<gh_stars>1-10 # guac.py # # plays <NAME> # clicked boxes alternate red and blue # boxes fall if no winner # boxes launch upon win # avocado "<NAME>" reacts accordingly import time from arena import * def end_program_callback(scene: Scene): global sceneParent scene.delete_obje...
2.84375
3
system_test/utils/timeutils.py
OpenPOWER-BigData/HDP--kafka
0
50965
import logging import time logger = logging.getLogger("namedLogger") def sleep(secs): logger.info("Sleeping for %d seconds.", secs) time.sleep(secs)
2.953125
3
Dataset/Leetcode/test/136/516.py
kkcookies99/UAST
0
50966
<gh_stars>0 class Solution: def singleNumber(self, nums: List[int]) -> int: a = itertools.accumulate(nums,lambda t,x:t^x) return list(a)[-1]
2.75
3
scrapers/upForGrabsScraper.py
SamuelHoward/open-source-platform
0
50967
<gh_stars>0 # This file is used to retrieve data about open source projects from up for grabs # Import Modules import requests from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver import FirefoxOptions import time # Function for 'scraping' up for grabs for open source projects, return...
3.046875
3
org/apache/helix/ZNRecordAssembler.py
davzhang/helix-python-binding
3
50968
# package org.apache.helix #from org.apache.helix import * #from java.util import List from org.apache.helix.ZNRecord import ZNRecord class ZNRecordAssembler: def assemble(self, records): """ Returns ZNRecord Parameters: records: List<ZNRecord> """ # ZNRecord...
2.5
2
settings.py
BedrockDigger/chrome-dino-pyremake
2
50969
class Settings(): def __init__(self): self.screen_width = 1024 # screen Width self.screen_height = 512 # screen height self.bg_color = (255, 255, 255) # overall background color self.init_speed = 30 # speed factor of dino self.dhmax = 23 self.alt_freq...
2.09375
2
scripts/undistort_h36m.py
yihui-he2020/epipolar-transformers
360
50970
if __name__ == '__main__' and __package__ is None: import sys from os import path sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) )) import os import torch from utils.model_serialization import strip_prefix_if_present from utils import zipreader import argparse from tqdm import tqdm i...
2.296875
2
Python/34 Calendar Module.py
hnwarid/HackerRankExercises
0
50971
<gh_stars>0 # Enter your code here. Read input from STDIN. Print output to STDOUT import calendar mm, dd, yyyy = map(int, input().split()) # weekday = calendar.weekday(yyyy, mm, dd) # day_name = calendar.day_name[weekday] # print(day_name.upper()) print(calendar.day_name[calendar.weekday(yyyy, mm, dd)].upper())
3.734375
4
mirrormanager2/lib/pid.py
Devyani-Divs/mirrormanager2
1
50972
# -*- coding: utf-8 -*- # # Copyright © 2014 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions # of the GNU General Public License v.2, or (at your option) any later # version. This program is distributed in t...
2.03125
2
song_match/cube_mat.py
gbroques/cozmo-song-match
8
50973
<reponame>gbroques/cozmo-song-match from typing import Dict from typing import List from cozmo.objects import LightCubeIDs, LightCube class CubeMat: """Class to convert cube IDs to mat positions and vise versa. Each cube has an ID of 1, 2, or 3 associated with it. Consider the following cubes with IDs ...
3.265625
3
LeetCode/942 DI String Match.py
gesuwen/Algorithms
0
50974
# Maths # Given a string S that only contains "I" (increase) or "D" (decrease), let N = S.length. # # Return any permutation A of [0, 1, ..., N] such that for all i = 0, ..., N-1: # # If S[i] == "I", then A[i] < A[i+1] # If S[i] == "D", then A[i] > A[i+1] # # # Example 1: # # Input: "IDID" # Output: [0,4,1,3,2] # Exam...
3.359375
3
minigest/docfisc/admin/fattura_riepilogo_iva.py
ctrlmaniac/minigest
0
50975
<filename>minigest/docfisc/admin/fattura_riepilogo_iva.py from django.contrib import admin from ..models import FatturaRiepilogoIVA class FatturaRiepilogoIVAAdmin(admin.StackedInline): model = FatturaRiepilogoIVA extra = 0
1.226563
1
core/user/urls.py
henrryyanez/test2
0
50976
<filename>core/user/urls.py from django.urls import path from core.user.views import * app_name = 'user' urlpatterns = [ # user path('list/', UserListView.as_view(), name='user_list'), path('add/', UserCreateView.as_view(), name='user_create'), path('update/<int:pk>/', UserUpdateView.as_view(), name='...
1.96875
2
2021/day10.py
spod/aoc
0
50977
#! /usr/bin/env python import os.path test_input = [ "[({(<(())[]>[[{[]{<()<>>", "[(()[<>])]({[<{<<[]>>(", "{([(<{}[<>[]}>{[]{[(<()>", "(((({<>}<{<{<>}{[]{[]{}", "[[<[([]))<([[{}[[()]]]", "[{[{({}]{}}([{[{{{}}([]", "{<[[]]>}<{[{[{[]{()[[[]", "[<(<(<(<{}))><([]([]()", "<{([([[(<>()){...
3.140625
3
compute_times.py
mmcauliffe/memcauliffe-blog-scripts
0
50978
import os import shutil import wave from collections import defaultdict from statistics import mean #directories = [r'D:\Data\aligner_comp\organized'] directories = ['/media/share/datasets/aligner_benchmarks/AlignerTestData/1_English_13000files', '/data/mmcauliffe/data/LibriSpeech/clean'] for d in dir...
2.453125
2
user_import/migrations/0002_foreign_relationships.py
everyvoter/everyvoter
5
50979
<gh_stars>1-10 # -*- coding: utf-8 -*- # Generated by Django 1.11.12 on 2018-04-30 16:35 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('accounts',...
1.578125
2
slick_dnn/module.py
kaszperro/deepy
85
50980
<reponame>kaszperro/deepy<gh_stars>10-100 from abc import ABC, abstractmethod from collections import OrderedDict import numpy as np from slick_dnn import variable from slick_dnn.autograd.tensor_modifications import Img2Col from slick_dnn.variable import Variable class Module(ABC): def __init__(self)...
2.390625
2
bioimageit_framework/framework/__init__.py
bioimageit/bioimageit_framework
0
50981
<filename>bioimageit_framework/framework/__init__.py from .exceptions import CommandArgsError from .framework import (BiAction, BiContainer, BiActuator, BiComponent, BiConnectome) from .observer import (BiGuiObserver) __all__ = ['CommandArgsError', 'BiObject'...
1.320313
1
flask_restful_swagger/resources/static_files.py
flask-restful-swagger/flask-restful-swagger
21
50982
# -*- coding: utf-8 -*- import mimetypes import os from flask import abort, send_file from flask_restful import Resource from flask_restful_swagger import root_path from flask_restful_swagger.registry import get_current_registry from flask_restful_swagger.utils import render_page __author__ = 'sobolevn' class Sta...
1.90625
2
ch02_netprog/exercise/2-5tsTserv.py
Nickhool/core-python
1
50983
__Author__ = "noduez" from socket import * from time import ctime import os import re HOST = "" PORT = 21567 BUFSIZ = 1024 ADDR = (HOST, PORT) tcpSerSock = socket(AF_INET, SOCK_STREAM) tcpSerSock.bind(ADDR) tcpSerSock.listen(5) responsedic = {'date': ctime(), 'os': os.name, 'ls': str(os.listdir(os.curdir))} while T...
2.6875
3
tflite2onnx/op/rsqrt.py
shilpan97/tflite2onnx
87
50984
import logging import tflite import numpy as np from tflite2onnx import mapping from tflite2onnx.op.common import Operator from tflite2onnx.op.binary import PowerWrapper logger = logging.getLogger('tflite2onnx') class Rsqrt(Operator): # use square root as input operator and propagate output to power TypeMap...
2.421875
2
Exercicio13.py
felipellima83/wiki.python.org.br-EstruturaSequencial
0
50985
#<NAME> #Linguagem: Python #Exercício 13 do site: https://wiki.python.org.br/EstruturaSequencial #Entra com a altura altura = float(input("Qual sua altura? ")) #Realiza os cálculos pesoIdealHomem = (72.7*altura)-58 pesoIdealMulher = (62.1*altura)-44.7 #Imprime o resultado print("Seu peso ideal caso você seja homem é...
4.375
4
docs/_config/cakephpbranch.py
asgraf/crud
0
50986
import os from sphinx.util.osutil import SEP """ CakePHP Git branch extension. A simple sphinx extension for adding the GitHub branch name of the docs' version. """ def setup(app): app.connect('html-page-context', append_template_ctx) app.add_config_value('branch', '', True) return app def append_templa...
1.742188
2
resources/database/user.py
AdriBloober/DiscordSearchBot
7
50987
<reponame>AdriBloober/DiscordSearchBot<gh_stars>1-10 from sqlalchemy import Column, Text, and_, Integer from .. import Session, db class User(db): __tablename__ = "banned_users" ban_id = Column(Integer, primary_key=True) user_id = Column(Text, nullable=False) guild_id = Column(Text, nullable=True) ...
2.625
3
annodb/lib/Cytoband.py
always-waiting/Django-Xromate
0
50988
#encoding: utf-8 """ 注释数据库的cytoband表 """ import mongoengine as mongoe from annodb.apps import AnnodbConfig, dumpstring import re class Cytoband(mongoe.Document): """ collection name: cytoband """ meta = { 'db_alias': AnnodbConfig.alias, } description = mongoe.StringField() name = ...
2.453125
2
src/batch_crop.py
mamo3gr/batch_face_cropper
0
50989
from argparse import ArgumentParser from logging import INFO, basicConfig, getLogger from pathlib import Path from typing import Union import cv2 from face_region_extractor import ( FaceDetectionError, FaceNotFoundError, FaceRegionExtractor, ) basicConfig(level=INFO) logger = getLogger(__name__) def ba...
2.640625
3
bigquery_schema_generator/anonymize.py
ZiggerZZ/bigquery-schema-generator
170
50990
#!/usr/bin/env python3 # # Copyright 2018 <NAME> # # 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...
2.390625
2
ems/datasets/case/case_set.py
EMSTrack/Algorithms
1
50991
<filename>ems/datasets/case/case_set.py # Interface for a "set" of cases class CaseSet: def __init__(self, time): self.time = time def __len__(self): raise NotImplementedError() def iterator(self): raise NotImplementedError() def get_time(self): return self.time ...
2.515625
3
mqtt_subscribe.py
naman/SmarTopi
0
50992
<filename>mqtt_subscribe.py import paho.mqtt.client as paho import os import socket import ssl from s3_get_file import s3_get_file # Done as a part of our IOT project by # <NAME>, Srishti and Hemanth def on_connect(client, userdata, flags, rc): print("Connection returned result: " + str(rc) ) client.subscrib...
2.6875
3
src/utils.py
teddykoker/image-gpt
196
50993
<filename>src/utils.py import torch def squared_euclidean_distance(a, b): b = torch.transpose(b, 0, 1) a2 = torch.sum(torch.square(a), dim=1, keepdims=True) b2 = torch.sum(torch.square(b), dim=0, keepdims=True) ab = torch.matmul(a, b) d = a2 - 2 * ab + b2 return d def quantize(x, centroids):...
2.96875
3
ael/compiler.py
rtoal/ael
1
50994
"""Compiler This module exports a single function complile(source_code_string, output_type) The second argument tells the compiler what to produce. It must be one of: tokens the token sequence ast the abstract syntax tree analyzed the semantically analyzed representation optimized ...
2.828125
3
app/forms.py
alexmacniven/mega-flask-blog
0
50995
# WTF uses a class to represent a traditional form. # The class LoginForm describes the fields of our form. Note; we're # paying no attention to the appearance of the form just yet. from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, BooleanField, SubmitField # DataRequired ensures that a us...
3.0625
3
03_wave/main.py
ShotaDeguchi/PINN_TF2
0
50996
""" ******************************************************************************** main file to execute ******************************************************************************** """ import time import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from pinn import PINN from config_gpu im...
1.773438
2
thingflow/base.py
kesking82/thingflow-python
38
50997
<filename>thingflow/base.py<gh_stars>10-100 # Copyright 2016,2017 by MPI-SWS and Data-Ken Research. # Licensed under the Apache 2.0 License. """ Base functionality for ThingFlow. All the core abstractions are defined here. Everything else is just subclassing or using these abstractions. The key abstractions are: * T...
2.796875
3
project/inception_v3_version2.py
agdenadel/CSCI2470-Final-Project
0
50998
import os, sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import skimage.io from skimage.transform import resize from imgaug import augmenters as iaa from random import randint import PIL from PIL import Image import cv2 from sklearn.utils import class_weight, shuffle import keras import wa...
2.53125
3
transforms.py
Rars-project/mousepy
3
50999
from torchvision.transforms import * import numbers import random from PIL import Image class GroupToTensor(object): def __init__(self): pass def __call__(self, img_group): return [ToTensor()(img) for img in img_group] class GroupCenterCrop(object): def __init__(self, size): self.size = size def __call__(s...
2.609375
3