max_stars_repo_path
stringlengths
4
245
max_stars_repo_name
stringlengths
7
115
max_stars_count
int64
101
368k
id
stringlengths
2
8
content
stringlengths
6
1.03M
prediction/tools/model_warmup/model_warmup.py
gogasca/ai-platform-samples-1
418
12787035
<gh_stars>100-1000 # # Copyright 2020 Google LLC # # 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 a...
tests/test_visitors/test_tokenize/test_primitives/test_string_tokens/test_unnecessary_raw_strings.py
cdhiraj40/wemake-python-styleguide
1,931
12787039
<filename>tests/test_visitors/test_tokenize/test_primitives/test_string_tokens/test_unnecessary_raw_strings.py import pytest from wemake_python_styleguide.violations.consistency import ( RawStringNotNeededViolation, ) from wemake_python_styleguide.visitors.tokenize.primitives import ( WrongStringTokenVisitor, ...
leetcode/188.best-time-to-buy-and-sell-stock-iv.py
geemaple/algorithm
177
12787040
<filename>leetcode/188.best-time-to-buy-and-sell-stock-iv.py class Solution(object): def maxProfit(self, k, prices): """ :type k: int :type prices: List[int] :rtype: int """ if prices is None or len(prices) == 0 or k == 0: return 0 res = 0 ...
pyclustering/cluster/rock.py
JosephChataignon/pyclustering
1,013
12787041
"""! @brief Cluster analysis algorithm: ROCK @details Implementation based on paper @cite inproceedings::rock::1. @authors <NAME> (<EMAIL>) @date 2014-2020 @copyright BSD-3-Clause """ from pyclustering.cluster.encoder import type_encoding from pyclustering.utils import euclidean_distance from pyc...
examples/how_to/start_parameterized_build.py
pingod/python-jenkins_api
556
12787053
""" Start a Parameterized Build """ from __future__ import print_function from jenkinsapi.jenkins import Jenkins jenkins = Jenkins('http://localhost:8080') params = {'VERSION': '1.2.3', 'PYTHON_VER': '2.7'} # This will start the job in non-blocking manner jenkins.build_job('foo', params) # This will start the job...
recipes/Python/546543_simple_way_create_change_your_registry/recipe-546543.py
tdiprima/code
2,023
12787063
#IN THE NAME OF ALLAH #Nike Name: Pcrlth0n #(C) 2008 #a simple way to create and change your registry on windows import win32api def new_key(): reg1 = open('C:\\reg1.reg', 'w') reg1.write("""REGEDIT4\n[HKEY_CURRENT_USER\\Example""") reg1.close() win32api.WinExec('reg import C:\\reg1.reg', 0) def new_s...
main.py
pzmarzly/ancs4linux
120
12787072
<filename>main.py #!/usr/bin/env python3 # https://developer.apple.com/library/archive/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Introduction/Introduction.html import sys import signal import argparse import time from Hci import Hci from Handler import DefaultHandler parser = ar...
algorithms/larrys-array.py
gajubadge11/HackerRank-1
340
12787103
#!/bin/python3 import sys def rotate(A, pos): A[pos], A[pos+1], A[pos+2] = A[pos+1], A[pos+2], A[pos] def larrysArray(A): for _ in range(len(A)): for ind in range(1, len(A) - 1): a, b, c = A[ind-1], A[ind], A[ind+1] #print("ind = {} A = {} B = {} C = {}".format(ind, a, b, c)) ...
manila/scheduler/weighers/host_affinity.py
kpawar89/manila
159
12787109
# Copyright 2019 NetApp, Inc. # 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 ...
optimum/onnxruntime/preprocessors/passes/fully_connected.py
techthiyanes/optimum
414
12787112
<reponame>techthiyanes/optimum # Copyright 2022 The HuggingFace Team. 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-...
spockbot/plugins/core/auth.py
SpockBotMC/SpockBot
171
12787113
""" Provides authorization functions for Mojang's login and session servers """ import hashlib import json # This is for python2 compatibility try: import urllib.request as request from urllib.error import URLError except ImportError: import urllib2 as request from urllib2 import URLError import loggin...
tests/unit/metrics_tests/test_object_keypoint_similarity.py
Joeper214/blueoil
248
12787130
<filename>tests/unit/metrics_tests/test_object_keypoint_similarity.py<gh_stars>100-1000 # -*- coding: utf-8 -*- # Copyright 2018 The Blueoil 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 obta...
Chapter06/src/features.py
jvstinian/Python-Reinforcement-Learning-Projects
114
12787136
import numpy as np from config import GOPARAMETERS def stone_features(board_state): # 16 planes, where every other plane represents the stones of a particular color # which means we track the stones of the last 8 moves. features = np.zeros([16, GOPARAMETERS.N, GOPARAMETERS.N], dtype=np.uint8) num_del...
educative/binarysearch/findhighestnumber.py
monishshah18/python-cp-cheatsheet
140
12787151
<filename>educative/binarysearch/findhighestnumber.py<gh_stars>100-1000 def find_highest_number(A): if len(A) < 3: return None def condition(value) -> bool: leftNeighbor = value - 1 rightNeighbor = value + 1 # TODO: Add conditions for leftmost and rightmost values i...
cocrawler/webserver.py
joye1503/cocrawler
166
12787202
<filename>cocrawler/webserver.py import logging import asyncio from aiohttp import web from . import config LOGGER = logging.getLogger(__name__) def make_app(): loop = asyncio.get_event_loop() # TODO switch this to socket.getaddrinfo() -- see https://docs.python.org/3/library/socket.html serverip = conf...
office365/sharepoint/sites/usage_info.py
theodoriss/Office365-REST-Python-Client
544
12787206
<reponame>theodoriss/Office365-REST-Python-Client from office365.runtime.client_value import ClientValue class UsageInfo(ClientValue): """ Provides fields used to access information regarding site collection usage. """ def __init__(self, bandwidth=None, discussion_storage=None, visits=None): "...
python/paddle_serving_client/metric/auc.py
loveululu/Serving
789
12787208
<filename>python/paddle_serving_client/metric/auc.py # Copyright (c) 2020 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.apach...
pinball/workflow/job.py
DotModus/pinball
1,143
12787280
<reponame>DotModus/pinball # Copyright 2015, Pinterest, Inc. # # 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 applicab...
oletools/thirdparty/xglob/__init__.py
maniVix/oletools
2,059
12787289
<gh_stars>1000+ from .xglob import *
code/src/plan2scene/crop_select/util.py
madhawav/plan2scene
305
12787325
<gh_stars>100-1000 from plan2scene.common.image_description import ImageDescription, ImageSource from plan2scene.common.residence import Room, House from plan2scene.config_manager import ConfigManager from plan2scene.texture_gen.predictor import TextureGenPredictor from plan2scene.texture_gen.utils.io import load_conf_...
nnet/separate.py
on1262/conv-tasnet
149
12787371
<gh_stars>100-1000 #!/usr/bin/env python # wujian@2018 import os import argparse import torch as th import numpy as np from conv_tas_net import ConvTasNet from libs.utils import load_json, get_logger from libs.audio import WaveReader, write_wav logger = get_logger(__name__) class NnetComputer(object): def _...
pycaw/api/mmdeviceapi/depend/structures.py
Jan-Zeiseweis/pycaw
234
12787386
<gh_stars>100-1000 from ctypes import Structure, Union from ctypes.wintypes import ( DWORD, LONG, LPWSTR, ULARGE_INTEGER, VARIANT_BOOL, WORD) from comtypes import GUID from comtypes.automation import VARTYPE, VT_BOOL, VT_CLSID, VT_LPWSTR, VT_UI4 from future.utils import python_2_unicode_compatible class PROPVARI...
pymagnitude/third_party/allennlp/modules/token_embedders/token_characters_encoder.py
tpeng/magnitude
1,520
12787403
<filename>pymagnitude/third_party/allennlp/modules/token_embedders/token_characters_encoder.py from __future__ import absolute_import import torch from allennlp.common import Params from allennlp.data.vocabulary import Vocabulary from allennlp.modules.token_embedders.embedding import Embedding from allennlp.modules.s...
tests/Unit/PointwiseFunctions/GeneralRelativity/IndexManipulation.py
nilsvu/spectre
117
12787409
<reponame>nilsvu/spectre # Distributed under the MIT License. # See LICENSE.txt for details. import numpy as np def raise_or_lower_first_index(tensor, metric): return np.einsum("ij,ikl", metric, tensor) def trace_last_indices(tensor, metric): return np.einsum("ij,kij", metric, tensor)
utils_nlp/eval/question_answering.py
Anita1017/nlp-recipes
4,407
12787421
""" Official evaluation script for SQuAD version 2.0. Modified by XLNet authors to update `find_best_threshold` scripts for SQuAD V2.0 """ import collections import json import re import string def get_raw_scores(qa_ids, actuals, preds): """ Computes exact match and F1 scores without applying any una...
scripts/issues/issue15.py
Jhsmit/awesome-panel
179
12787427
<reponame>Jhsmit/awesome-panel import panel as pn text = r""" ```math f(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi ``` """ app = pn.Column(pn.pane.Markdown(text)) app.servable()
Configuration/DataProcessing/python/Impl/__init__.py
Purva-Chaudhari/cmssw
852
12787473
<reponame>Purva-Chaudhari/cmssw #!/usr/bin/env python3 """ _Impl_ Scenario Implementations """ __all__ = []
backend/ecs_tasks/delete_files/s3.py
guvenbz/amazon-s3-find-and-forget
165
12787475
import logging from functools import lru_cache from urllib.parse import urlencode, quote_plus from boto_utils import fetch_job_manifest, paginate from botocore.exceptions import ClientError from utils import remove_none, retry_wrapper logger = logging.getLogger(__name__) def save(s3, client, buf, bucket, key, meta...
REST/python/Environments/create-environments.py
gdesai1234/OctopusDeploy-Api
199
12787508
<filename>REST/python/Environments/create-environments.py import json import requests from urllib.parse import quote octopus_server_uri = 'https://your.octopus.app/api' octopus_api_key = 'API-YOURAPIKEY' headers = {'X-Octopus-ApiKey': octopus_api_key} def get_octopus_resource(uri): response = requests.get(uri, he...
src/mlspace/scripts/__init__.py
abhishekkrthakur/mlspace
283
12787553
from .base import script as base_script from .install_docker import script as install_docker from .install_nvidia_docker import script as install_nvidia_docker from .install_nvidia_drivers import script as install_nvidia_drivers
lib/pipefunc.py
kei-iketani/plex
153
12787573
<reponame>kei-iketani/plex<gh_stars>100-1000 #********************************************************************* # content = common functions # version = 0.1.0 # date = 2019-12-01 # # license = MIT <https://github.com/alexanderrichtertd> # author = <NAME> <<EMAIL>> #************************************...
tests/broken_pickle.py
Kyle-Kyle/angr
6,132
12787583
<reponame>Kyle-Kyle/angr<gh_stars>1000+ import pickle import angr import nose def test_pickle_state(): b = angr.Project("/home/angr/angr/angr/tests/blob/x86_64/fauxware") p = b.path_generator.entry_point() p.state.inspect.make_breakpoint('mem_write') nose.tools.assert_true('inspector' in p.state.plugin...
platypush/message/event/music/snapcast.py
RichardChiang/platypush
228
12787609
from platypush.message.event import Event class SnapcastEvent(Event): """ Base class for Snapcast events """ def __init__(self, host='localhost', *args, **kwargs): super().__init__(host=host, *args, **kwargs) class ClientConnectedEvent(SnapcastEvent): """ Event fired upon client connection ...
serieswatcher/sqlobject/tests/test_transactions.py
lightcode/SeriesWatcher
303
12787621
from sqlobject import * from sqlobject.tests.dbtest import * ######################################## ## Transaction test ######################################## class TestSOTrans(SQLObject): #_cacheValues = False class sqlmeta: defaultOrder = 'name' name = StringCol(length=10, alternateID=True, ...
preprocess.py
akoksal/Turkish-Word2Vec
175
12787650
<filename>preprocess.py from __future__ import print_function import os.path import sys from gensim.corpora import WikiCorpus import xml.etree.ElementTree as etree import warnings import logging import string from gensim import utils def tokenize_tr(content,token_min_len=2,token_max_len=50,lower=True): i...
tests/unit/conftest.py
ckornacker/aws-gate
369
12787672
<reponame>ckornacker/aws-gate import os import boto3 import placebo import pytest @pytest.fixture(name="session") def placebo_session(request): session_kwargs = {"region_name": os.environ.get("AWS_DEFAULT_REGION", "eu-west-1")} profile_name = os.environ.get("PLACEBO_PROFILE", None) if profile_name: ...
authlib/deprecate.py
YPCrumble/authlib
3,172
12787685
import warnings class AuthlibDeprecationWarning(DeprecationWarning): pass warnings.simplefilter('always', AuthlibDeprecationWarning) def deprecate(message, version=None, link_uid=None, link_file=None): if version: message += '\nIt will be compatible before version {}.'.format(version) if link_...
changes/backends/jenkins/generic_builder.py
vault-the/changes
443
12787701
<reponame>vault-the/changes<gh_stars>100-1000 from __future__ import absolute_import from flask import current_app from changes.config import db from changes.models.snapshot import SnapshotImage from changes.models.command import FutureCommand from changes.utils.http import build_internal_uri from changes.buildsteps....
arguments.py
mjlbach/Object-Goal-Navigation
106
12787721
import argparse import torch def get_args(): parser = argparse.ArgumentParser( description='Goal-Oriented-Semantic-Exploration') # General Arguments parser.add_argument('--seed', type=int, default=1, help='random seed (default: 1)') parser.add_argument('--auto_gpu_conf...
test/IECoreMaya/FnSceneShapeTest.py
bradleyhenke/cortex
386
12787752
########################################################################## # # Copyright (c) 2013, Image Engine Design 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: # # * Redistribu...
moya/testprojects/expose/site/py/exposed.py
moyaproject/moya
129
12787759
from __future__ import unicode_literals from moya.expose import View class TestView(View): name = "hello" def get(self, context): return "Hello, World"
rnnt/args.py
lahiruts/Online-Speech-Recognition
201
12787765
<reponame>lahiruts/Online-Speech-Recognition<gh_stars>100-1000 from absl import flags FLAGS = flags.FLAGS flags.DEFINE_string('name', 'rnn-t-v5', help='session name') flags.DEFINE_enum('mode', 'train', ['train', 'resume', 'eval'], help='mode') flags.DEFINE_integer('resume_step', None, help='model step') # dataset flag...
tools/todos.py
mrjrty/rpaframework
518
12787809
<gh_stars>100-1000 #!/usr/bin/env python3 import argparse import json import os import re import sys from collections import defaultdict from contextlib import contextmanager from io import StringIO from pathlib import Path from pylint.lint import Run TODO_PATTERN = re.compile(r"(todo|fixme|xxx)[\:\.]?\s*(.+)", re.I...
configs/deepsvg/defaults_fonts.py
naoto0804/deepsvg
573
12787852
from .default_icons import * class Config(Config): def __init__(self, num_gpus=1): super().__init__(num_gpus=num_gpus) # Dataset self.data_dir = "./dataset/fonts_tensor/" self.meta_filepath = "./dataset/fonts_meta.csv"
dbcArchives/2021/000_6-sds-3-x-dl/055_DLbyABr_04-ConvolutionalNetworks.py
r-e-x-a-g-o-n/scalable-data-science
138
12787866
<filename>dbcArchives/2021/000_6-sds-3-x-dl/055_DLbyABr_04-ConvolutionalNetworks.py<gh_stars>100-1000 # Databricks notebook source # MAGIC %md # MAGIC ScaDaMaLe Course [site](https://lamastex.github.io/scalable-data-science/sds/3/x/) and [book](https://lamastex.github.io/ScaDaMaLe/index.html) # MAGIC # MAGIC This is a...
_integration/python-pymysql/test.py
jfrabaute/go-mysql-server
114
12787892
# Copyright 2020-2021 Dolthub, Inc. # # 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...
tests/test___main__.py
oterrier/openapi-python-client
172
12787900
def test_main(mocker): app = mocker.patch("openapi_python_client.cli.app") # noinspection PyUnresolvedReferences from openapi_python_client import __main__ app.assert_called_once()
platypush/plugins/tcp.py
RichardChiang/platypush
228
12787910
import base64 import json import socket from typing import Optional, Union from platypush.plugins import Plugin, action class TcpPlugin(Plugin): """ Plugin for raw TCP communications. """ def __init__(self, **kwargs): super().__init__(**kwargs) self._sockets = {} def _connect(s...
mbuild/lib/bulk_materials/__init__.py
daico007/mbuild
101
12787915
"""mBuild bulk materials library.""" from mbuild.lib.bulk_materials.amorphous_silica_bulk import AmorphousSilicaBulk
recipes/Python/577236_ur1ca_commandline_client/recipe-577236.py
tdiprima/code
2,023
12787927
#!/usr/bin/env python """ur1.py -- command-line ur1.ca client. ur1.ca is the URL shortening services provided by status.net. This script makes it possible to access the service from the command line. This is done by scraping the returned page and look for the shortened URL. USAGE: ur1.py LONGURL RETURN STATUS: ...
petridish/app/directory.py
Bhaskers-Blu-Org2/petridishnn
121
12787943
<reponame>Bhaskers-Blu-Org2/petridishnn # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import glob import re from petridish.philly.container import is_philly from petridish.app.multi_proc import has_stopped """ Dir structures """ def _updir(d, n=1): for _ in range(n): ...
recipes/Python/576587_Sort_sections_keys_ini/recipe-576587.py
tdiprima/code
2,023
12787986
#!/usr/bin/python # -*- coding: cp1250 -*- __version__ = '$Id: sort_ini.py 543 2008-12-19 13:44:59Z mn $' # author: <NAME> import sys USAGE = 'USAGE:\n\tsort_ini.py file.ini' def sort_ini(fname): """sort .ini file: sorts sections and in each section sorts keys""" f = file(fname) lines = f.readlines() f.close() ...
tests/gdb/complete.py
cohortfsllc/cohort-cocl2-sandbox
2,151
12787993
# -*- python -*- # Copyright (c) 2014 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import gdb_test class CompleteTest(gdb_test.GdbTest): def test_complete(self): # Test that continue causes the debugged pr...
src/connectors/airwatch_devices.py
sfc-gh-kmaurya/SnowAlert
144
12787996
<gh_stars>100-1000 """Airwatch Collect Device information using API Key, Host, and CMSURL Authentication """ from runners.helpers import log from runners.helpers import db from runners.helpers.dbconfig import ROLE as SA_ROLE from datetime import datetime import requests from urllib.error import HTTPError from .utils...
glazier/lib/logs_test.py
ItsMattL/glazier
1,233
12788000
# Copyright 2016 Google Inc. 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 applicable law or ag...
sysidentpy/polynomial_basis/tests/test_simulation.py
neylsoncrepalde/sysidentpy
107
12788010
from numpy.testing._private.utils import assert_allclose from sysidentpy.polynomial_basis import PolynomialNarmax from sysidentpy.utils.generate_data import get_miso_data, get_siso_data import numpy as np from numpy.testing import assert_almost_equal, assert_array_equal from numpy.testing import assert_raises from sysi...
office365/planner/tasks/check_list_items.py
theodoriss/Office365-REST-Python-Client
544
12788084
from office365.planner.tasks.check_list_item import PlannerChecklistItem from office365.runtime.client_value_collection import ClientValueCollection class PlannerChecklistItems(ClientValueCollection): """The plannerChecklistItemCollection resource represents the collection of checklist items on a task. It is ...
cellphonedb/src/tests/cellphone_flask_test_case.py
chapuzzo/cellphonedb
278
12788099
import os import random import string import time from flask_testing import TestCase from cellphonedb.src.app.cellphonedb_app import cellphonedb_app from cellphonedb.src.local_launchers.local_collector_launcher import LocalCollectorLauncher from cellphonedb.utils import utils class CellphoneFlaskTestCase(TestCase):...
454 4Sum II.py
krishna13052001/LeetCode
872
12788157
#!/usr/bin/python3 """ Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero. To make problem a bit easier, all A, B, C, D have same length of N where 0 ≤ N ≤ 500. All integers are in the range of -2^28 to 2^28 - 1 and the result is gu...
21爬虫入门/day01/note.py
HaoZhang95/PythonAndMachineLearning
937
12788244
""" 爬虫的用途:12306抢票,短信轰炸,数据获取 分类:通用爬虫:是搜索引擎抓取系统的重要部分,主要是把互联网上的页面下载到本地作为一个镜像备份 聚焦爬虫:对特定需求进行数据获取,会对页面的内容进行筛选,保证只抓取和需求相关的网页信息 Http:端口号80 Https: 端口号443 使用第三方的requests进行请求:支持python2和3,在urllib中2和3的语法有些不一样 """ import requests kw = {'wd': '长城'} # headers伪装成一个浏览器进行的请求 # 不加这个的话,网页会识别出请求来自一个python而不是...
apps/modules/theme_setting/process/nav_setting.py
Bension/osroom
579
12788260
<gh_stars>100-1000 #!/usr/bin/env python # -*-coding:utf-8-*- # @Time : 2019/12/2 14:43 # @Author : <NAME> from bson import ObjectId from flask import request, g from flask_babel import gettext from apps.app import mdbs, cache from apps.core.flask.reqparse import arg_verify from apps.utils.format.obj_format im...
explainaboard/tasks/re/eval_spec.py
Shadowlized/ExplainaBoard
255
12788263
# -*- coding: utf-8 -*- import explainaboard.error_analysis as ea import numpy import os def get_aspect_value(sample_list, dict_aspect_func): dict_span2aspect_val = {} dict_span2aspect_val_pred = {} for aspect, fun in dict_aspect_func.items(): dict_span2aspect_val[aspect] = {} dict_span2a...
examples/wsecho.py
VladimirKuzmin/werkzeug
4,200
12788332
<reponame>VladimirKuzmin/werkzeug """Shows how you can implement a simple WebSocket echo server using the wsproto library. """ from werkzeug.exceptions import InternalServerError from werkzeug.serving import run_simple from werkzeug.wrappers import Request from werkzeug.wrappers import Response from wsproto import Conn...
desktop/core/ext-py/future-0.16.0/docs/futureext.py
kokosing/hue
908
12788361
# -*- coding: utf-8 -*- """ Python-Future Documentation Extensions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support for automatically documenting filters and tests. Based on the Jinja2 documentation extensions. :copyright: Copyright 2008 by <NAME>. :license: BSD. """ import collections import o...
src/__init__.py
cynth-s/Information_retrieval
191
12788374
<reponame>cynth-s/Information_retrieval __author__ = '<NAME>' __all__ = ['invdx', 'parse', 'query', 'rank']
attic/concurrency/flags/getthreadpool.py
matteoshen/example-code
5,651
12788391
<reponame>matteoshen/example-code from concurrent import futures import sys import requests import countryflags as cf import time from getsequential import fetch DEFAULT_NUM_THREADS = 100 GLOBAL_TIMEOUT = 300 # seconds times = {} def main(source, num_threads): pool = futures.ThreadPoolExecutor(num_threads) ...
deep_qa/testing/test_case.py
richarajpal/deep_qa
459
12788397
# pylint: disable=invalid-name,protected-access from copy import deepcopy from unittest import TestCase import codecs import gzip import logging import os import shutil from keras import backend as K import numpy from numpy.testing import assert_allclose from deep_qa.common.checks import log_keras_version_info from d...
cpmoptimize/recompiler.py
borzunov/cpmoptimize
121
12788400
<reponame>borzunov/cpmoptimize<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import byteplay from matcode import * class RecompilationError(Exception): def __init__(self, message, state): self.message = "Can't optimize loop: %s" % message if state.lineno is not None: ...
readability/text/syllables.py
rbamos/py-readability-metrics
198
12788478
import re def count(word): """ Simple syllable counting """ word = word if type(word) is str else str(word) word = word.lower() if len(word) <= 3: return 1 word = re.sub('(?:[^laeiouy]es|[^laeiouy]e)$', '', word) # removed ed| word = re.sub('^y', '', word) matches = re....
recc/emulators/python/linux-emulator-example.py
oscourse-tsinghua/OS2018spring-projects-g02
249
12788485
<gh_stars>100-1000 # Copyright 2016 <NAME> Inc. # # 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 ...
train/labeler.py
lvaughn/nnsplit
248
12788502
from typing import List from fractions import Fraction from abc import ABC, abstractmethod import spacy import string import random import pandas as pd import numpy as np import diskcache import sys from somajo import SoMaJo from spacy.lang.tr import Turkish from spacy.lang.sv import Swedish from spacy.lang.uk import U...
scripts/analysis/scheduling_duration_cdf.py
Container-Projects/firmament
287
12788515
#!/usr/bin/python import sys, re from datetime import datetime import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt if len(sys.argv) < 2: print "usage: scheduling_duration_cdf.py <log file 0> <label 0> " \ "<log file 1> <label 1> ..." sys.exit(1) durations = {} for i in range(1, len(sy...
tests/test_fds.py
CyberFlameGO/fds
322
12788527
<reponame>CyberFlameGO/fds import unittest from unittest.mock import patch import pytest import re from fds.version import __version__ from fds.services.fds_service import FdsService from fds.run import HooksRunner BOOLS = [True, False] # NOTE unittest.mock:_Call backport def patch_unittest_mock_call_cls(): im...
venv/Lib/site-packages/pdfminer/pslexer.py
richung99/digitizePlots
202
12788528
import re import ply.lex as lex states = ( ('instring', 'exclusive'), ) tokens = ( 'COMMENT', 'HEXSTRING', 'INT', 'FLOAT', 'LITERAL', 'KEYWORD', 'STRING', 'OPERATOR' ) delimiter = r'\(\)\<\>\[\]\{\}\/\%\s' delimiter_end = r'(?=[%s]|$)' % delimiter def t_COMMENT(t): # r'^%!.+\n' r'%.*\n' pass RE...
algs4/merge.py
dumpmemory/algs4-py
230
12788536
""" Sorts a sequence of strings from standard input using merge sort. % more tiny.txt S O R T E X A M P L E % python merge.py < tiny.txt A E E L M O P R S T X [ one string per line ] % more words3.txt bed bug dad yes zoo ... all bad yet % python merge.py < words3.txt all bad bed bug dad ....
observations/r/capm.py
hajime9652/observations
199
12788542
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv import numpy as np import os import sys from observations.util import maybe_download_and_extract def capm(path): """Stock Market Data monthly observations from 1960–01...
Dynamic Programming/741. Cherry Pickup.py
beckswu/Leetcode
138
12788554
""" 741. Cherry Pickup """ class Solution: def cherryPickup(self, grid): """ :type grid: List[List[int]] :rtype: int """ n = len(grid) if grid[0][0] == -1 or grid[n-1][n-1] == -1: return 0 dp = [[-1,]*n for _ in range(n)] # 很重要, """ 因为比如[[1,-1,...
torchnlp/samplers/noisy_sorted_sampler.py
MPetrochuk/PyTorch-NLP
2,125
12788560
<reponame>MPetrochuk/PyTorch-NLP import random from torch.utils.data.sampler import Sampler from torchnlp.utils import identity def _uniform_noise(_): return random.uniform(-1, 1) class NoisySortedSampler(Sampler): """ Samples elements sequentially with noise. **Background** ``NoisySortedSam...
care/facility/migrations/0190_auto_20201001_1134.py
gigincg/care
189
12788591
<filename>care/facility/migrations/0190_auto_20201001_1134.py<gh_stars>100-1000 # Generated by Django 2.2.11 on 2020-10-01 06:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('facility', '0189_auto_20200929_1258'), ] operations = [ mig...
nuplan/planning/metrics/evaluation_metrics/common/ego_lat_jerk.py
motional/nuplan-devkit
128
12788592
<gh_stars>100-1000 from typing import List from nuplan.planning.metrics.evaluation_metrics.base.within_bound_metric_base import WithinBoundMetricBase from nuplan.planning.metrics.metric_result import MetricStatistics from nuplan.planning.metrics.utils.state_extractors import extract_ego_jerk from nuplan.planning.scena...
scale/job/messages/failed_jobs.py
kaydoh/scale
121
12788596
<filename>scale/job/messages/failed_jobs.py """Defines a command message that sets FAILED status for job models""" from __future__ import unicode_literals import logging from collections import namedtuple from django.db import transaction from error.models import get_error from job.models import Job from messaging.m...
carball/json_parser/actor/team.py
unitedroguegg/carball
119
12788613
<reponame>unitedroguegg/carball from .ball import * class TeamHandler(BaseActorHandler): @classmethod def can_handle(cls, actor: dict) -> bool: return actor['ClassName'] == 'TAGame.Team_Soccar_TA' def update(self, actor: dict, frame_number: int, time: float, delta: float) -> None: self.p...
build_fake_image__build_exe/__injected_code.py
DazEB2/SimplePyScripts
117
12788651
<reponame>DazEB2/SimplePyScripts import os.path from pathlib import Path file_name = Path(os.path.expanduser("~/Desktop")).resolve() / "README_YOU_WERE_HACKED.txt" file_name.touch(exist_ok=True)
CalibTracker/SiStripCommon/python/ShallowGainCalibration_cfi.py
ckamtsikis/cmssw
852
12788655
<reponame>ckamtsikis/cmssw<filename>CalibTracker/SiStripCommon/python/ShallowGainCalibration_cfi.py import FWCore.ParameterSet.Config as cms shallowGainCalibration = cms.EDProducer("ShallowGainCalibration", Tracks=cms.InputTag("generalTracks",""), ...
docs/source/conf.py
steven-lang/SPFlow
199
12788662
# -- Path setup -------------------------------------------------------------- import os import sys sys.path.insert(0, os.path.abspath("../../src")) import sphinx_gallery # -- Project information ----------------------------------------------------- project = "SPFlow" copyright = "2020, <NAME>, <NAME>, <NAME>, <NAME>...
lib-opencc-android/src/main/jni/OpenCC/binding.gyp
huxiaomao/android-opencc
5,895
12788682
{ "includes": [ "node/global.gypi", "node/configs.gypi", "node/dicts.gypi", "node/node_opencc.gypi", ] }
adadelta.py
morpheusthewhite/twitter-sent-dnn
314
12788688
<gh_stars>100-1000 """ Adadelta algorithm implementation """ import numpy as np import theano import theano.tensor as T def build_adadelta_updates(params, param_shapes, param_grads, rho=0.95, epsilon=0.001): # AdaDelta parameter update # E[g^2] # initialized to zero egs = [ theano.shared( ...
qtrader/simulation/tests/__init__.py
aaron8tang/qtrader
381
12788691
<reponame>aaron8tang/qtrader from qtrader.simulation.tests.arbitrage import Arbitrage from qtrader.simulation.tests.moments import Moments
tests/unittests/analysis/test_lpi.py
obilaniu/orion
177
12788742
<filename>tests/unittests/analysis/test_lpi.py # -*- coding: utf-8 -*- """Tests :func:`orion.analysis.lpi`""" import copy import numpy import pandas as pd import pytest from orion.analysis.base import to_numpy, train_regressor from orion.analysis.lpi_utils import compute_variances, lpi, make_grid from orion.core.io.s...
esda/tests/test_local_geary_mv.py
jeffcsauer/esda
145
12788744
import unittest import libpysal from libpysal.common import pandas, RTOL, ATOL from esda.geary_local_mv import Geary_Local_MV import numpy as np PANDAS_EXTINCT = pandas is None class Geary_Local_MV_Tester(unittest.TestCase): def setUp(self): np.random.seed(100) self.w = libpysal.io.open(libpysal.e...
pybaseball/cache/file_utils.py
reddigari/pybaseball
650
12788749
import json import os import pathlib from typing import Any, Dict, List, Union, cast JSONData = Union[List[Any], Dict[str, Any]] # Splitting this out for testing with no side effects def mkdir(directory: str) -> None: return pathlib.Path(directory).mkdir(parents=True, exist_ok=True) # Splitting this out for te...
grr/server/grr_response_server/check_lib/__init__.py
khanhgithead/grr
4,238
12788826
<reponame>khanhgithead/grr #!/usr/bin/env python """This is the check capabilities used to post-process host data.""" # pylint: disable=g-import-not-at-top,unused-import from grr_response_server.check_lib import checks from grr_response_server.check_lib import hints from grr_response_server.check_lib import triggers
tests/micropython/opt_level.py
sebi5361/micropython
181
12788851
<reponame>sebi5361/micropython import micropython as micropython # check we can get and set the level micropython.opt_level(0) print(micropython.opt_level()) micropython.opt_level(1) print(micropython.opt_level()) # check that the optimisation levels actually differ micropython.opt_level(0) exec('print(__debug__)') m...
vergeml/sources/mnist.py
ss18/vergeml
324
12788866
<gh_stars>100-1000 from vergeml.img import INPUT_PATTERNS, open_image, fixext, ImageType from vergeml.io import source, SourcePlugin, Sample from vergeml.data import Labels from vergeml.utils import VergeMLError from vergeml.sources.labeled_image import LabeledImageSource import random import numpy as np from PIL impor...
pycket/prims/hash.py
namin/pycket
129
12788878
#! /usr/bin/env python # -*- coding: utf-8 -*- import sys from pycket import impersonators as imp from pycket import values, values_string from pycket.hash.base import W_HashTable, W_ImmutableHashTable, w_missing from pycket.hash.simple import ( W_EqvMutableHashTable, W_EqMutableHashTa...
linAlgVis.py
testinggg-art/Linear_Algebra_With_Python
1,719
12788895
<filename>linAlgVis.py import matplotlib.pyplot as plt import numpy as np import numpy def linearCombo(a, b, c): '''This function is for visualizing linear combination of standard basis in 3D. Function syntax: linearCombo(a, b, c), where a, b, c are the scalar multiplier, also the elements of the vec...
mmdet/det_core/utils/mAP_utils.py
Karybdis/mmdetection-mini
834
12788937
import numpy as np from multiprocessing import Pool from ..bbox import bbox_overlaps # https://zhuanlan.zhihu.com/p/34655990 def calc_PR_curve(pred, label): pos = label[label == 1] # 正样本 threshold = np.sort(pred)[::-1] # pred是每个样本的正例预测概率值,逆序 label = label[pred.argsort()[::-1]] precision = [] rec...
deepscm/experiments/medical/ukbb/sem_vi/conditional_sem.py
mobarakol/deepscm
183
12788960
import torch import pyro from pyro.nn import pyro_method from pyro.distributions import Normal, Bernoulli, TransformedDistribution from pyro.distributions.conditional import ConditionalTransformedDistribution from deepscm.distributions.transforms.affine import ConditionalAffineTransform from pyro.nn import DenseNN fr...
keras_maskrcnn/utils/overlap.py
akashdeepjassal/keras-maskrcnn
432
12788972
<filename>keras_maskrcnn/utils/overlap.py """ Copyright 2017-2018 Fizyr (https://fizyr.com) 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 re...
Python/43. MultiplyStrings.py
nizD/LeetCode-Solutions
263
12788976
""" Leetcode's Medium challege #43 - Multiply Strings (Solution) <https://leetcode.com/problems/multiply-strings/> Description: Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. EXAMPLE: Input: num1 = "2", num2 = "3" Output: "6...