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
exp/DFRdatasets/simulate.py
zzzace2000/dropout-feature-rankin
6
2700
<filename>exp/DFRdatasets/simulate.py import argparse import argparse import os import numpy as np import torch from dataloaders.LoaderBase import LoaderBase import exp.feature.feature_utils as feature_utils def run_with_identifier(unit, corr_val, datasize, rank_names, loader, show_ols=True): loader.clear_cache...
2.15625
2
gym_pcgrl/envs/reps/wide_3D_rep.py
JiangZehua/gym-pcgrl
0
2701
from gym_pcgrl.envs.reps.representation3D import Representation3D from PIL import Image from gym import spaces import numpy as np from gym_pcgrl.envs.probs.minecraft.mc_render import reps_3D_render """ The wide representation where the agent can pick the tile position and tile value at each update. """ class Wide3DRep...
2.828125
3
ucsmsdk/mometa/adaptor/AdaptorMenloQStats.py
thinkitdata/ucsmsdk
0
2702
<filename>ucsmsdk/mometa/adaptor/AdaptorMenloQStats.py """This module contains the general information for AdaptorMenloQStats ManagedObject.""" from ...ucsmo import ManagedObject from ...ucscoremeta import MoPropertyMeta, MoMeta from ...ucsmeta import VersionMeta class AdaptorMenloQStatsConsts: MENLO_QUEUE_COMPO...
2.09375
2
python/old_password_test.py
XelaRellum/old_password
0
2703
<filename>python/old_password_test.py<gh_stars>0 import unittest import pytest from old_password import old_password import csv import re @pytest.mark.parametrize("password,expected_hash", [ (None, None), ("", ""), ("a", "<PASSWORD>"), ("abc", "<PASSWORD>"), ("ä", "<PASSWORD>"), ]) def test_old_p...
3.1875
3
src/RS_model/train_mlp.py
CindyChen1995/MKR
0
2704
# -*- coding: utf-8 -*- """ ------------------------------------------------- Description : Author : cmy date: 2020/1/2 ------------------------------------------------- """ import datetime import heapq import numpy as np import tensorflow as tf import time from metrics import ndcg_at_k from tr...
1.929688
2
pylipid.py
glass-w/PyLipID
0
2705
<filename>pylipid.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 28 19:28:17 2019 @author: <NAME> """ import mdtraj as md import numpy as np import pandas as pd import argparse import sys from collections import defaultdict import pickle import os import matplotlib matplotlib.use('Agg') impo...
1.71875
2
main.py
yaakiyu/rt-bot
0
2706
<reponame>yaakiyu/rt-bot # RT by Rext from asyncio import run from discord import Intents, Status, Game, AllowedMentions from core.bot import RT from data import SECRET try: from uvloop import install except ModuleNotFoundError: ... else: install() intents = Intents.default() intents.message_content = True intent...
2.171875
2
hiplot/fetchers_demo.py
dmitryvinn/hiplot
1
2707
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import uuid import random import math import time import typing as t from . import experiment as hip # Demos from the README. If one of those ...
2.109375
2
app/endpoints/common/dtos/ingredient.py
brauls/ingredients-service
0
2708
<reponame>brauls/ingredients-service """Ingredient dto. """ class Ingredient(): """Class to represent an ingredient. """ def __init__(self, name, availability_per_month): self.name = name self.availability_per_month = availability_per_month def __repr__(self): return """{} is t...
2.6875
3
barcode.py
kallangerard/grocery-barcode-scanner
0
2709
import logging import groceries.api as groceries import barcodescanner.scan as barcode def main(): grocy = groceries.GrocyAPIClient() while True: scanner = barcode.Scan() line = scanner.PollScanner() if line != None: response = grocy.consume_barcode(line) loggin...
2.4375
2
setup.py
mr-sk/easy-icm-runner
0
2710
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="easy-icm-runner", version="1.0.6", author="<NAME>", author_email="<EMAIL>", description="A wrapper for IBM ICMs Scheduler API Calls", long_description=long_description, long_descri...
1.21875
1
test_molecule.py
zee93/molecule_parser
0
2711
<reponame>zee93/molecule_parser import unittest from molecule import onize_formula, update_equation_with_multiplier, flaten_formula, parse_molecule class MoleculeParserTestCases(unittest.TestCase): def test_onizing_formulas(self): self.assertEqual(onize_formula('H'), 'H1') self.assertEqual(onize_...
2.75
3
config.py
lyth031/ptb_lm
0
2712
<reponame>lyth031/ptb_lm<gh_stars>0 # -*- coding: utf-8 -*- class Config(object): def __init__(self): self.init_scale = 0.1 self.learning_rate = 1.0 self.max_grad_norm = 5 self.num_layers = 2 self.slice_size = 30 self.hidden_size = 200 self.max_epoch = 13 ...
1.632813
2
binding.gyp
HupuInc/node-mysql-listener
2
2713
<gh_stars>1-10 { 'targets': [ { # have to specify 'liblib' here since gyp will remove the first one :\ 'target_name': 'mysql_bindings', 'sources': [ 'src/mysql_bindings.cc', 'src/mysql_bindings_connection.cc', 'src/mysql_bindings_result.cc', 'src/mysql_bindings_st...
1.007813
1
pymel/__init__.py
GlenWalker/pymel
0
2714
# copyright <NAME> <EMAIL> # created at luma pictures www.luma-pictures.com """ ******************************* PyMEL ******************************* PyMEL makes python scripting in Maya work the way it should. Maya's command module is a direct translation of MEL commands into python functions. The re...
2.109375
2
setup.py
rlbellaire/ActT
2
2715
from setuptools import find_packages, setup setup(name='ActT', version='0.6', description='Active Testing', url='', author='', author_email='none', license='BSD', packages=find_packages(), install_requires=[ 'numpy', 'pandas', 'matplotlib','scipy','scikit-learn',...
1.054688
1
Fusion/deltat.py
coylen/pySG
264
2716
# deltat.py time difference calculation for sensor fusion # Released under the MIT License (MIT) # Copyright (c) 2018 <NAME> # Provides TimeDiff function and DeltaT class. # The following notes cover special cases. Where the device performing fusion # is linked to the IMU and is running MicroPython no special treatmen...
3.015625
3
colour/models/rgb/datasets/sony.py
wenh06/colour
1
2717
# -*- coding: utf-8 -*- """ Sony Colourspaces ================= Defines the *Sony* colourspaces: - :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT`. - :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT3`. - :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT3_CINE`. - :attr:`colour.models.RGB_COLOURSPACE_VENICE_S_GAMUT3`. - ...
1.453125
1
network.py
QiaoZhongzheng/EWC-sample-PMNIST
0
2718
# -*- coding: UTF-8 -*- '''================================================= @Project -> File :EWC -> network @IDE :PyCharm @Author :<NAME> @Date :2021/6/23 20:28 @Desc : ==================================================''' from tensorflow.keras import Model from tensorflow.keras.layers import Dense, Conv2D,L...
3.140625
3
src/quanguru/classes/exceptions.py
Qfabiolous/QuanGuru
0
2719
<reponame>Qfabiolous/QuanGuru<gh_stars>0 # TODO turn prints into actual error raise, they are print for testing def qSystemInitErrors(init): def newFunction(obj, **kwargs): init(obj, **kwargs) if obj._genericQSys__dimension is None: className = obj.__class__.__name__ print(c...
2.34375
2
reagent/gym/tests/test_gym.py
alexnikulkov/ReAgent
0
2720
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import logging import os import pprint import unittest import numpy as np # pyre-fixme[21]: Could not find module `pytest`. import pytest import torch from parameterized import parameterized from reagent.core.types import R...
1.71875
2
src/deep_dialog/usersims/usersim.py
CommissarSilver/TC-Bot
1
2721
<reponame>CommissarSilver/TC-Bot<gh_stars>1-10 """ Created on June 7, 2016 a rule-based user simulator @author: xiul, t-zalipt """ import random class UserSimulator: """ Parent class for all user sims to inherit from """ def __init__(self, movie_dict=None, act_set=None, slot_set=None, star...
2.53125
3
kendall_w/__init__.py
ugolbck/KendallW
4
2722
<gh_stars>1-10 from .kendall_w import compute_w __version__ = (1, 0, 0)
1.109375
1
admin.py
nielsrolf/django-error-logs
0
2723
from django.contrib import admin from .models import * # Register your models here. admin.site.register(ErrorGroup) admin.site.register(Error)
1.359375
1
mcpython/common/block/ISlab.py
mcpython4-coding/core
2
2724
<filename>mcpython/common/block/ISlab.py """ mcpython - a minecraft clone written in python licenced under the MIT-licence (https://github.com/mcpython4-coding/core) Contributors: uuk, xkcdjerry (inactive) Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence Original ...
2.234375
2
CourseOutlineBackend/courseoutline/serializers.py
stancsz/web-development-project-ensf-607
0
2725
from rest_framework import serializers from .models import * class CoordinatorSerializer(serializers.ModelSerializer): # ModelID = serializers.CharField(max_length=100, required=True) CourseID = serializers.CharField(max_length=100, required=True) FName = serializers.CharField(max_length=100, required=Fa...
2.3125
2
tools/math_tools.py
oliverscheer/python-pytest-ci
0
2726
<filename>tools/math_tools.py """ some math tools """ class MathTools: """ some math tools """ def add(a, b): """ add two values """ return a + b def sub(a, b): """ subtract two values """
2
2
hackerrank/Algorithms/Correctness and the Loop Invariant/solution.py
ATrain951/01.python-com_Qproject
4
2727
def insertion_sort(l): for i in range(1, len(l)): j = i - 1 key = l[i] while (j >= 0) and (l[j] > key): l[j + 1] = l[j] j -= 1 l[j + 1] = key m = int(input().strip()) ar = [int(i) for i in input().strip().split()] insertion_sort(ar) print(" ".join(map(str, a...
3.671875
4
cvp_rest_api_examples/cvpLabelAdd.py
kakkotetsu/CVP-Scripts
8
2728
<gh_stars>1-10 #!/usrb/bin/env python # Copyright (c) 2019, Arista Networks, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # - Redistributions of source code must retain the above copyri...
1.53125
2
frontends/pytorch/python/torch_mlir_torchscript_e2e_test_configs/torchscript.py
raikonenfnu/mlir-npcomp
0
2729
<reponame>raikonenfnu/mlir-npcomp<filename>frontends/pytorch/python/torch_mlir_torchscript_e2e_test_configs/torchscript.py # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-except...
2.15625
2
app/balltracking/pubnubpython/pnconfiguration.py
gdmgent-1718-wot/interactive-wall
0
2730
<reponame>gdmgent-1718-wot/interactive-wall from .enums import PNHeartbeatNotificationOptions, PNReconnectionPolicy from . import utils class PNConfiguration(object): DEFAULT_PRESENCE_TIMEOUT = 300 DEFAULT_HEARTBEAT_INTERVAL = 280 def __init__(self): # TODO: add validation self.uuid = Non...
2.0625
2
tests/scripts/thread-cert/thread_cert.py
lmaciejonczyk/openthread
0
2731
<filename>tests/scripts/thread-cert/thread_cert.py #!/usr/bin/env python3 # # Copyright (c) 2019, The OpenThread Authors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions ...
1.476563
1
FaceMaskDetection with webcam.py
Anurag-Varma/facemask-detection
1
2732
import cv2 import numpy as np from keras.models import model_from_json from keras.preprocessing.image import img_to_array #load model model = model_from_json(open("fer.json", "r").read()) #change the path accoring to files #load weights model.load_weights('fer.h5') #change the path accor...
2.484375
2
language/Basics/stringformatting.py
Binary-bug/Python
0
2733
<reponame>Binary-bug/Python<filename>language/Basics/stringformatting.py<gh_stars>0 age = 24 print("My age is " + str(age) + " years ") # the above procedure is tedious since we dont really want to include str for every number we encounter #Method1 Replacement Fields print("My age is {0} years ".format(age)) # {0}...
3.875
4
toggl.py
ulrikpedersen/toggl-gnome-applet
0
2734
#!/usr/bin/env python import logging from datetime import datetime logging.basicConfig(level=logging.WARNING) import os import urllib2, base64, json import dateutil.parser def from_ISO8601( str_iso8601 ): return dateutil.parser.parse(str_iso8601) def to_ISO8601( timestamp ): return timestamp.isoformat() de...
2.453125
2
gs_divergence/symmetrized_geodesical_skew_divergence.py
ISMHinoLab/geodesical_skew_divergence
7
2735
from typing import Optional import torch from gs_divergence import gs_div def symmetrized_gs_div( input: torch.Tensor, target: torch.Tensor, alpha: float = -1, lmd: float = 0.5, reduction: Optional[str] = 'sum', ) -> torch.Tensor: lhs = gs_div(input, target, alpha=alpha, lmd=lmd, reduction=re...
2.515625
3
train.py
kushaliitm/deep-learning
0
2736
<gh_stars>0 import argparse import helper as hp import torch import os import json parser = argparse.ArgumentParser(description = 'train.py') parser.add_argument('--data-dir', nargs = '*', action = "store", default = "./flowers/", help = "folder path for data") parser.add_argument('--save-dir', action = "store", requ...
2.40625
2
Euler0001.py
rbarillec/project_euler
0
2737
def Euler0001(): max = 1000 sum = 0 for i in range(1, max): if i%3 == 0 or i%5 == 0: sum += i print(sum) Euler0001()
3.65625
4
models/blip.py
lmathia2/BLIP
0
2738
''' * Copyright (c) 2022, salesforce.com, inc. * All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause * By <NAME> ''' import warnings warnings.filterwarnings("ignore") from models.vit import Visi...
1.9375
2
venv/Lib/site-packages/pandas/tests/reshape/merge/test_multi.py
OliviaNabbosa89/Disaster_Responses
0
2739
<gh_stars>0 import numpy as np from numpy.random import randn import pytest import pandas as pd from pandas import DataFrame, Index, MultiIndex, Series import pandas._testing as tm from pandas.core.reshape.concat import concat from pandas.core.reshape.merge import merge @pytest.fixture def left(): "...
2.390625
2
test/api/test_histories.py
mmiladi/galaxy
1
2740
<filename>test/api/test_histories.py # -*- coding: utf-8 -*- from requests import ( get, post, put ) from base import api # noqa: I100 from base.populators import ( # noqa: I100 DatasetCollectionPopulator, DatasetPopulator, wait_on ) class HistoriesApiTestCase(api.ApiTestCase): def set...
2.46875
2
Algorithms_easy/0461. Hamming Distance.py
VinceW0/Leetcode_Python_solutions
4
2741
""" 0461. Hamming Distance The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. Note: 0 ≤ x, y < 231. Example: Input: x = 1, y = 4 Output: 2 Explanation: 1 (0 0 0 1) 4 (0 1 0 0) ↑ ...
4.125
4
AllProjects/Projects/Spider/DownloadImage.py
CoderXAndZ/PycharmProjects
3
2742
#! /usr/local/bin/python3 # -*- coding: UTF-8 -*- # 抓取 妹子图 并存储 import urllib.request import os import random def open_url(url): request = urllib.request.Request(url) request.add_header('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0') ...
2.90625
3
utility/extractor_batch.py
BA-HanseML/NF_Prj_MIMII_Dataset
10
2743
<reponame>BA-HanseML/NF_Prj_MIMII_Dataset<filename>utility/extractor_batch.py print('load extractor_batch') # Utility to run multiple feature extraction # diagrams over many files with multiple threats import pandas as pd import os import sys import glob from tqdm.auto import tqdm from queue import Queue ...
2.1875
2
multitenancy/context_processors.py
cmalek/django-site-multitenancy
0
2744
from .models import Tenant def tenant(request): """ Return context variables required by apps that use django-site-multitenancy. If there is no 'tenant' attribute in the request, extract one from the request. """ if hasattr(request, 'tenant'): tenant = request.tenant else: ten...
2.34375
2
hello/forms.py
odhiambocuttice/mypersonalapp
0
2745
<filename>hello/forms.py from django import forms from .models import Project class ProjectForm(forms.ModelForm): class Meta: model = Project fields = ["title", "describe", "technology"]
1.9375
2
pset_classes/class_basics/solutions/p1.py
mottaquikarim/pydev-psets
5
2746
<reponame>mottaquikarim/pydev-psets """ Person class """ # Create a Person class with the following properties # 1. name # 2. age # 3. social security number class Person: def __init__(self, name, age, social_number): self.name = name self.age = age self.social = social_number p1 = Pers...
3.015625
3
python/paddle/fluid/contrib/slim/tests/test_imperative_out_scale.py
huangxu96/Paddle
0
2747
# copyright (c) 2018 paddlepaddle 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 app...
1.5625
2
grr/server/hunts/results.py
nickamon/grr
0
2748
<gh_stars>0 #!/usr/bin/env python """Classes to store and manage hunt results. """ from grr.lib import rdfvalue from grr.lib import registry from grr.lib.rdfvalues import structs as rdf_structs from grr_response_proto import jobs_pb2 from grr.server import access_control from grr.server import aff4 from grr.server imp...
2.265625
2
src/simple_sharepoint/site.py
NodeJSmith/py-simple-rest-sharepoint
0
2749
""" Module for higher level SharePoint REST api actions - utilize methods in the api.py module """ class Site(): def __init__(self, sp): self.sp = sp @property def info(self): endpoint = "_api/site" value = self.sp.get(endpoint).json() return value @property def w...
2.53125
3
pypeit/tests/test_metadata.py
rcooke-ast/PYPIT
0
2750
import os import glob import shutil import yaml from IPython import embed import pytest import numpy as np from pypeit.par.util import parse_pypeit_file from pypeit.pypeitsetup import PypeItSetup from pypeit.tests.tstutils import dev_suite_required, data_path from pypeit.metadata import PypeItMetaData from pypeit.s...
1.875
2
tortoise/query_utils.py
DDevine/tortoise-orm
1
2751
<gh_stars>1-10 from copy import copy from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, cast from pypika import Table from pypika.terms import Criterion from tortoise.exceptions import FieldError, OperationalError from tortoise.fields.relational import BackwardFKRelation, ManyToManyFieldInstanc...
2.0625
2
L3_numpy_pandas_2D/B_NumPy_Axis.py
angelmtenor/IDAFC
0
2752
<reponame>angelmtenor/IDAFC<gh_stars>0 import numpy as np # Change False to True for this block of code to see what it does # NumPy axis argument if True: a = np.array([ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]) print(a.sum()) print(a.sum(axis=0)) print(a.sum(axis=1)) # Subway r...
3.90625
4
Protein-ligand-binding/TopBio/Feature/LigandFeature.py
WeilabMSU/TopologyNet
1
2753
import numpy as np import pickle import os def GenerateFeature_alpha(ligand_name, working_dir): Cut = 12.0 LIGELE = ['C','N','O','S','CN','CO','CS','NO','NS','OS','CCl','CBr','CP','CF','CNO','CNS','COS','NOS','CNOS','CNOSPFClBrI','H','CH','NH','OH','SH','CNH','COH','CSH','NOH','NSH','OSH','CNOH','CNSH','COSH'...
2.328125
2
emailthreads/util.py
emersion/python-emailthreads
34
2754
<filename>emailthreads/util.py import re import sys from email.message import EmailMessage def get_message_by_id(msgs, msg_id): # TODO: handle weird brackets stuff for msg in msgs: if msg["message-id"] == msg_id: return msg return None def strip_prefix(s, prefix): if s.startswith(prefix): s = s[len(prefix)...
2.921875
3
trainval.py
JanAlexanderPersonal/covid19_weak_supervision
0
2755
<gh_stars>0 from haven import haven_chk as hc from haven import haven_results as hr from haven import haven_utils as hu import torch import torchvision import tqdm import pandas as pd import pprint import itertools import os import pylab as plt import exp_configs import time import numpy as np from src import models f...
2.03125
2
languages/pt-br.py
unimauro/eden
1
2756
<filename>languages/pt-br.py # coding: utf8 { '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" é uma expressão opcional como "field1=\'newvalue\'". Não é possível atualizar ou excluir os resultados de uma junção', '# of International Staff'...
2.265625
2
pyxq/app/__init__.py
goodchinas/pyxq
4
2757
<reponame>goodchinas/pyxq<filename>pyxq/app/__init__.py from .. import ba, cb, actor from ..service import account class A0(ba.App): center: cb.CallBackManager a: account.Account def __init__(self, stg: actor.GateWay): a = account.Account() center = cb.CallBackManager() stg.init(a...
2.3125
2
python-files/Analysis/plot_rber_curve.py
AdrianLundell/ldpc-investigation-master-thesis
1
2758
#%% #Calculate_capacity
0.980469
1
2_b_builtins_dynamic_recall.py
traff/python_completion_benchmark
1
2759
<reponame>traff/python_completion_benchmark import builtins builtins.foo = 'bar' foo # foo
1.382813
1
gva/data/validator/__init__.py
gva-jhabte/gva-data
0
2760
<reponame>gva-jhabte/gva-data """ Schema Validation Tests a dictionary against a schema to test for conformity. Schema definition is similar to - but not the same as - avro schemas Supported Types: - string - a character sequence - format - numeric - a number - min: - max ...
2.84375
3
fuzzers/ECP5/050-pio_routing/fuzzer.py
umarcor/prjtrellis
256
2761
<reponame>umarcor/prjtrellis from fuzzconfig import FuzzConfig import interconnect import nets import pytrellis import re jobs = [ { "pos": [(47, 0), (48, 0), (49, 0)], "cfg": FuzzConfig(job="PIOROUTEL", family="ECP5", device="LFE5U-45F", ncl="pioroute.ncl", tiles=["MIB_R4...
1.710938
2
convnet3d/backend/tensorflow_backend.py
yecharlie/convnet3d
6
2762
import tensorflow as tf def _is_tensor(x): """Returns `True` if `x` is a symbolic tensor-like object. From http://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/image_ops_impl.py Args: x: A python object to check. Returns: `True` if `x` is a `tf.Tensor` or `tf.Va...
3.234375
3
extensions/everywhere.py
cobrab11/black1-bot
3
2763
<gh_stars>1-10 # BS mark.1-55 # /* coding: utf-8 */ # BlackSmith plugin # everywhere_plugin.py # Coded by: WitcherGeralt (<EMAIL>) # http://witcher-team.ucoz.ru/ def handler_everywhere(type, source, body): if body: args = body.split() if len(args) >= 2: mtype = args[0].strip().lower() if mtype == u'чат'...
2.015625
2
0100.same_tree/solution.py
WZMJ/Algorithms
5
2764
from utils import TreeNode class Solution: def is_same_tree(self, p: TreeNode, q: TreeNode) -> bool: if p is None and q is None: return True if not p or not q: return False return p.val == q.val and self.is_same_tree(p.left, q.left) and self.is_same_tree(p.right, q....
3.609375
4
tests/test_azure.py
The-Academic-Observatory/mag-archiver
0
2765
<filename>tests/test_azure.py # Copyright 2020 Curtin University # # 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 applic...
2.5
2
tensorflow/contrib/framework/python/framework/tensor_util_test.py
uve/tensorflow
0
2766
# Copyright 2016 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...
2.0625
2
tpv/modals/sugerencias.py
vallemrv/tpvB3
3
2767
<reponame>vallemrv/tpvB3 # @Author: <NAME> <valle> # @Date: 10-May-2017 # @Email: <EMAIL> # @Last modified by: valle # @Last modified time: 23-Feb-2018 # @License: Apache license vesion 2.0 from kivy.uix.modalview import ModalView from kivy.uix.button import Button from kivy.properties import ObjectProperty, Str...
2.359375
2
templates/integration/__init__.py
p7g/dd-trace-py
308
2768
""" The foo integration instruments the bar and baz features of the foo library. Enabling ~~~~~~~~ The foo integration is enabled automatically when using :ref:`ddtrace-run <ddtracerun>` or :ref:`patch_all() <patch_all>`. Or use :ref:`patch() <patch>` to manually enable the integration:: from ddtrace import pa...
1.828125
2
libs/linux/wpa_cli.py
hpagseddy/ZPUI
0
2769
<filename>libs/linux/wpa_cli.py from subprocess import check_output, CalledProcessError from ast import literal_eval from time import sleep from helpers import setup_logger logger = setup_logger(__name__, "warning") current_interface = None #wpa_cli related functions and objects def wpa_cli_command(*command): r...
2.53125
3
demos/ServerSideBrowser.py
eukreign/python-v8
2
2770
#!/usr/bin/env python from __future__ import with_statement import sys, traceback, os, os.path import xml.dom.minidom import logging class Task(object): @staticmethod def waitAll(tasks): pass class FetchFile(Task): def __init__(self, url): self.url = url def _...
2.53125
3
pypeira/io/fits.py
WielderOfMjoelnir/pypeira
0
2771
<gh_stars>0 from __future__ import division import fitsio """ A FITS file is comprised of segments called Header/Data Units (HDUs), where the first HDU is called the 'Primary HDU', or 'Primary Array'. The primary data array can contain a 1-999 dimensional array of 1, 2 or 4 byte integers or 4 or 8 byte floating point...
3.0625
3
system/lib/update_musl.py
RyanCargan/emscripten
6,541
2772
#!/usr/bin/env python3 # Copyright 2021 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """Simple script for updating musl from extern...
1.6875
2
src/scout_apm/instruments/pymongo.py
xiamx/scout_apm_python
0
2773
from __future__ import absolute_import, division, print_function, unicode_literals import logging # Used in the exec() call below. from scout_apm.core.monkey import monkeypatch_method, unpatch_method # noqa: F401 from scout_apm.core.tracked_request import TrackedRequest # noqa: F401 logger = logging.getLogger(__na...
1.960938
2
measures/tests/factories.py
uktrade/tamato
14
2774
<reponame>uktrade/tamato<gh_stars>10-100 import random from typing import Optional import factory from common.tests import factories from measures.sheet_importers import MeasureSheetRow class MeasureSheetRowFactory(factory.Factory): """ A factory that produces a row that might be read from a sheet of measur...
2.75
3
autoscalingsim/scaling/policiesbuilder/metric/correlator/correlator.py
Remit/autoscaling-simulator
6
2775
from abc import ABC, abstractmethod import collections import pandas as pd from autoscalingsim.utils.error_check import ErrorChecker class Correlator(ABC): _Registry = {} @abstractmethod def _compute_correlation(self, metrics_vals_1 : pd.Series, metrics_vals_2 : pd.Series, lag : int): pass ...
2.640625
3
tools/test_net.py
by-liu/SegLossBia
18
2776
<reponame>by-liu/SegLossBia import sys import logging from seglossbias.utils import mkdir, setup_logging from seglossbias.engine import default_argument_parser, load_config, DefaultTester logger = logging.getLogger(__name__) def setup(args): cfg = load_config(args) mkdir(cfg.OUTPUT_DIR) setup_logging(ou...
2.1875
2
sarpy/io/nitf/tres/unclass/ENGRDA.py
anielsen001/sarpy
0
2777
<reponame>anielsen001/sarpy<filename>sarpy/io/nitf/tres/unclass/ENGRDA.py # -*- coding: utf-8 -*- from ..tre_elements import TREExtension, TREElement __classification__ = "UNCLASSIFIED" __author__ = "<NAME>" class RECORD(TREElement): def __init__(self, value): super(RECORD, self).__init__() sel...
2.1875
2
jp_doodle/quantity_forest.py
lingruiluo/jp_doodle
43
2778
<filename>jp_doodle/quantity_forest.py from jp_doodle import doodle_files qf_js = doodle_files.vendor_path("js/quantity_forest.js") from jp_doodle import dual_canvas import jp_proxy_widget import os from subprocess import check_output import pprint if bytes != str: unicode = str def directory_usage(directory, eps...
2.4375
2
LeetCode-All-Solution/Python3/LC-0035-Search-Insert-Position.py
YuweiYin/Algorithm_YuweiYin
0
2779
#!/usr/bin/env python # -*- coding:utf-8 -*- """================================================================= @Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3 @File : LC-0035-Search-Insert-Position.py @Author : [YuweiYin](https://github.com/YuweiYin) @Date : 2022-01-01 ============================...
4.03125
4
coding202-parsing-json/get-ap-json-1.py
firodj/ciscodevnet-coding-skills-sample-code
0
2780
import requests url = 'https://192.168.3.11/api/contextaware/v1/maps/info/DevNetCampus/DevNetBuilding/DevNetZone' headers = {'Authorization': 'Basic bGVhcm5pbmc6bGVhcm5pbmc=='} response = requests.get(url, headers=headers, verify=False) responseString = response.text print(responseString)
2.1875
2
lldb/test/API/lang/swift/optimized_code/bound_generic_enum/TestSwiftOptimizedBoundGenericEnum.py
LaudateCorpus1/llvm-project
605
2781
<gh_stars>100-1000 import lldb from lldbsuite.test.decorators import * import lldbsuite.test.lldbtest as lldbtest import lldbsuite.test.lldbutil as lldbutil import os import unittest2 class TestSwiftOptimizedBoundGenericEnum(lldbtest.TestBase): mydir = lldbtest.TestBase.compute_mydir(__file__) @swiftTest ...
2.171875
2
kervi/kervi/plugin/routing/kervi_io/__init__.py
wentzlau/kervi
0
2782
<gh_stars>0 #Copyright 2017 <NAME>. #Distributed under the MIT License. See LICENSE in root of project. def init_plugin(config, manager): from kervi.plugin.routing.kervi_io.mq_router import KerviIORouterPlugin return KerviIORouterPlugin(config, manager) def plugin_type(): return "routing"
1.695313
2
bc_gym_planning_env/envs/base/action.py
ghostFaceKillah/bc-gym-planning-env
2
2783
""" Code for wrapping the motion primitive action in an object. """ from __future__ import division from __future__ import absolute_import import attr import numpy as np from bc_gym_planning_env.utilities.serialize import Serializable @attr.s(cmp=False) class Action(Serializable): """ Object representing an 'ac...
3.140625
3
histogram.py
ccfelius/queueing
1
2784
import matplotlib.pyplot as plt import pandas as pd import math import numpy as np from scipy import stats import seaborn as sns data = pd.read_csv("data/500-4.txt", sep="\t") # example1 = data[data["SIM_TIME"] == 500] simulations = 500 simtimes = [5, 50, 150, 500, 1000] # for i in [1, 2, 4]: # data = pd.read_c...
2.734375
3
python/1931.py
zheedong/BaekJoon
0
2785
<filename>python/1931.py n = int(input()) conf_set = [] for _ in range(n): conf_set.append(tuple(map(int, input().split()))) conf_set.sort(key=lambda x : (x[1], x[0])) # 끝나는 시간을 기준으로 정렬 # 시작과 종료가 같은 경우를 포함하기 위해선, 시작 시간도 오름차순으로 정렬해 줘야 한다 solution_list = [conf_set[0]] # Greedy Algorithm for conf in conf_set[1:]:...
3.21875
3
social_webpy/app.py
python-social-auth/social-app-webpy
2
2786
<gh_stars>1-10 import web from social_core.actions import do_auth, do_complete, do_disconnect from .utils import psa, load_strategy, load_strategy urls = ( r'/login/(?P<backend>[^/]+)/?', 'auth', r'/complete/(?P<backend>[^/]+)/?', 'complete', r'/disconnect/(?P<backend>[^/]+)/?', 'disconnect', r'/dis...
2.171875
2
stellar/config.py
gomyar/stellar
0
2787
import os import logging import yaml from schema import Use, Schema, SchemaError, Optional class InvalidConfig(Exception): pass class MissingConfig(Exception): pass default_config = { 'logging': 30, 'migrate_from_0_3_2': True } schema = Schema({ 'stellar_url': Use(str), 'url': Use(str), ...
2.453125
2
egs2/mr_openslr64/asr1/local/data_prep.py
texpomru13/espnet
1
2788
#!/usr/bin/env python3 # Copyright 2021 <NAME> University (<NAME>) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import argparse import os import random if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("-d", help="downloads directory", type=str, default="downl...
2.4375
2
movement_validation/features/feature_processing_options.py
eulerkaku/movement_validation
0
2789
# -*- coding: utf-8 -*- """ This module will hold a class that will be referenced when processing features. I'd like to move things from "config" into here ... - @JimHokanson """ from __future__ import division from .. import utils #Can't do this, would be circular #from .worm_features import WormFeatures class...
2.5625
3
xos/ec2_observer/steps/__init__.py
wathsalav/xos
0
2790
<filename>xos/ec2_observer/steps/__init__.py #from .sync_external_routes import SyncExternalRoutes #from .sync_network_slivers import SyncNetworkSlivers #from .sync_networks import SyncNetworks #from .sync_network_deployments import SyncNetworkDeployments #from .sync_site_privileges import SyncSitePrivilege #from .sync...
1.054688
1
src/napari_geojson/_tests/test_writer.py
NHPatterson/napari-geojson
0
2791
import geojson import pytest from napari_geojson import write_shapes ellipse = [[[0, 0], [0, 5], [5, 5], [5, 0]], "ellipse", "Polygon"] line = [[[0, 0], [5, 5]], "line", "LineString"] polygon = [[[0, 0], [5, 5], [0, 10]], "polygon", "Polygon"] polyline = [[[0, 0], [5, 5], [0, 10]], "path", "LineString"] rectangle = [...
2.5
2
algorithms/521. Longest Uncommon Subsequence I.py
woozway/py3-leetcode
1
2792
<gh_stars>1-10 class Solution: def findLUSlength(self, a: str, b: str) -> int: return -1 if a == b else max(len(a), len(b))
2.96875
3
pgmpy/models/ClusterGraph.py
echoyi/pgmpy
0
2793
#!/usr/bin/env python3 from collections import defaultdict import numpy as np from pgmpy.base import UndirectedGraph from pgmpy.factors import factor_product class ClusterGraph(UndirectedGraph): r""" Base class for representing Cluster Graph. Cluster graph is an undirected graph which is associated wi...
3.359375
3
plugins/commands_window/plugin.py
stonewell/eim
0
2794
from PySide6.QtWidgets import QListWidgetItem from yapsy.IPlugin import IPlugin class Plugin(IPlugin): def __init__(self): IPlugin.__init__(self) def activate(self): IPlugin.activate(self) return def deactivate(self): IPlugin.deactivate(self) def set_current_window(self, ...
2.359375
2
custom_components/helpers.py
zroger49/broadlink_custom_component
0
2795
"""Helpers for the Broadlink remote.""" from base64 import b64decode from homeassistant.helpers import config_validation as cv def decode_packet(value): """Decode a data packet given for a Broadlink remote.""" value = cv.string(value) extra = len(value) % 4 if extra > 0: value = value + ("=" ...
2.890625
3
problems/139.Word_Break/AC_dp_n2.py
subramp-prep/leetcode
0
2796
<filename>problems/139.Word_Break/AC_dp_n2.py<gh_stars>0 #!/usr/bin/python # -*- coding: utf-8 -*- # Author: illuz <<EMAIL>uzen[at]gmail.com> # File: AC_dp_n2.py # Create Date: 2015-04-21 10:21:18 # Usage: AC_dp_n2.py # Descripton: class Solution: # @param s, a string # @param dict, a set...
3.53125
4
examples/pybullet/gym/pybullet_envs/bullet/kukaCamGymEnv.py
motionfigures/bullet3
51
2797
import os, inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(os.path.dirname(currentdir)) os.sys.path.insert(0,parentdir) import math import gym from gym import spaces from gym.utils import seeding import numpy as np import time import pybullet...
1.890625
2
hi-ml-histopathology/src/histopathology/preprocessing/tiling.py
kumar-pratik/hi-ml
402
2798
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
2.9375
3
miniapp/miniapp/hartreefock/hf.py
savcardamone/tyche-
0
2799
from math import pi from numpy import array, ndarray, divide, sqrt, argsort, sort, diag, trace from numpy.linalg import eig, norm class HartreeFock(): zeta = array([38.474970, 5.782948, 1.242567, 0.298073]) num_aos = len(zeta) num_mos = 0 energy_tolerance = 0.0001; density_tolerance = 0.001 ...
2.46875
2