max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
insights/parsers/tests/test_octavia.py | lhuett/insights-core | 121 | 1649435 | import doctest
import insights.parsers.octavia as octavia_module
from insights.parsers.octavia import OctaviaConf, VALID_KEYS
from insights.tests import context_wrap
CONF_FILE = """
[DEFAULT]
# Print debugging output (set logging level to DEBUG instead of default WARNING level).
debug = False
# Plugin options are hot... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/InstInfo.py | antopen/alipay-sdk-python-all | 213 | 1649460 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class InstInfo(object):
def __init__(self):
self._inst_id = None
self._isv_inst_no = None
@property
def inst_id(self):
return se... | 0 | 0 | 0 | 0 | 0 | 0 |
vit/formatter/description_truncated_count.py | kinifwyne/vit | 179 | 1649462 | <gh_stars>100-1000
from vit.formatter.description_count import DescriptionCount
class DescriptionTruncatedCount(DescriptionCount):
def format(self, description, task):
if not description:
return self.empty()
truncated_description = self.format_description_truncated(description)
... | 0 | 0 | 0 | 0 | 0 | 0 |
dictdefaultvalue.py | serhii73/PyTricks | 3,271 | 1649474 | """
When update value in a dict based on the old value, we usually check whether
the key is in the dict. But with `dict.setdefault`, `dict.get` and
`collections.defaultdict` the code can be shorter and cleaner.
Before:
>>> d = {}
>>> if 'a' not in d: # update a list
... d['a'] = []
...
>>> d['... | 0 | 0 | 0 | 0 | 0 | 0 |
utx/tag.py | yakhao/interface | 152 | 1649507 | #! /usr/bin/env python
# -*- coding: UTF-8 -*-
"""
测试用例标签类
"""
from enum import Enum, unique
class NewTag:
def __init__(self, desc: str=""):
self.desc = desc
@unique
class Tag(Enum):
SMOKE = NewTag("冒烟") # 冒烟测试标记,可以重命名,不要删除
ALL = NewTag("完整") # 完整测试标记,可以重命名,不要删除
# 以下开始为扩展标签,自行调整
V1_0... | 1 | 0 | 0 | 0 | 1 | 0 |
src/enamlnative/core/remotehooks.py | codelv/enaml-native | 237 | 1649526 | <filename>src/enamlnative/core/remotehooks.py
"""
Copyright (c) 2017, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on Dec 11, 2017
@author jrm
"""
import os
import sys
import logging
def init():
sys.modules['nativehoo... | 0 | 0 | 0 | 0 | 0 | 0 |
python/SHIELD_DRT_ACCESS/SHIELD_DRT_ACCESS_test.py | docebo/aws-config-rules | 1,295 | 1649555 | <filename>python/SHIELD_DRT_ACCESS/SHIELD_DRT_ACCESS_test.py<gh_stars>1000+
import sys
import unittest
try:
from unittest.mock import MagicMock
except ImportError:
from mock import MagicMock
import botocore
##############
# Parameters #
##############
# Define the default resource to report to Config Rules
DE... | 0 | 0 | 0 | 0 | 0 | 0 |
Competitions/Skillenza/Focuthon/Square Check.py | cnm06/Competitive-Programming | 994 | 1649574 | <filename>Competitions/Skillenza/Focuthon/Square Check.py
R = raw_input
def q(a, b, c, d):
return (a-c) ** 2 + (b-d) ** 2
def r(a):
b = q(a[0], a[1], a[2], a[3])
c = q(a[0], a[1], a[4], a[5])
d = q(a[0], a[1], a[6], a[7])
if b == c and 2*b == d:
e = q(a[2], a[3], a[6], a[7])
return (e == q(a[4], a[5], a[6], a[... | 0 | 0 | 0 | 0 | 0 | 0 |
torchdyn/datasets/static_datasets.py | iisabeller/torchdyn | 825 | 1649577 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | 30 | 9 | 0 | 0 | 39 | 0 |
src/tests/api/test_auth.py | fabm3n/pretix | 1,248 | 1649681 | <filename>src/tests/api/test_auth.py
#
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Pu... | 0 | 0 | 0 | 0 | 0 | 0 |
pyparrot/examples/demoAnafiVisionGUI.py | vsraghavhk/gesture-based-control | 253 | 1649700 | from pyparrot.Anafi import Anafi
from pyparrot.DroneVisionGUI import DroneVisionGUI
from pyparrot.Model import Model
import cv2
WRITE_IMAGES = False
class UserVision:
def __init__(self, vision):
self.index: int = 0
self.vision = vision
def save_pictures(self, args):
img = self.visio... | 0 | 0 | 0 | 1 | 1 | 0 |
python/ncnn/model_zoo/rfcn.py | fzyzcjy/ncnn | 14,886 | 1649716 | <filename>python/ncnn/model_zoo/rfcn.py<gh_stars>1000+
# Tencent is pleased to support the open source community by making ncnn available.
#
# Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
# in co... | 0 | 0 | 0 | 0 | 0 | 0 |
src/pretix/base/migrations/0108_auto_20190201_1527.py | fabm3n/pretix | 1,248 | 1649787 | # Generated by Django 2.1.5 on 2019-02-01 15:27
import django.db.models.deletion
from django.db import migrations, models
import pretix.base.models.fields
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('pretixbase', '0107_auto_20190129_1337'),
]
operations: lis... | 0 | 0 | 2 | 0 | 2 | 0 |
nalaf/utils/hdfs.py | ashish-narwal/nalaf | 103 | 1649821 | <filename>nalaf/utils/hdfs.py
from hdfs import InsecureClient, Client
from typing import Callable
import os
def maybe_get_hdfs_client(hdfs_url: str, hdfs_user: str) -> Client:
if hdfs_url is None:
return None
else:
assert hdfs_user is not None
return InsecureClient(hdfs_url, user=hdfs... | 0 | 0 | 0 | 0 | 0 | 0 |
webs/douban/tasks/get_main_movies_full_data.py | billvsme/videoSpider | 216 | 1649827 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import requests
import multiprocessing
import models
from gevent.pool import Pool
from sqlalchemy.exc import IntegrityError, InvalidRequestError
from helpers import random_str
from webs.douban import parsers
from config import sqla
from . import get_main_movies_base_data
do... | 0 | 0 | 0 | 0 | 0 | 0 |
lighthouse/scripts/find_xdg.py | RizkiePratama/dotfiles | 762 | 1649856 | <gh_stars>100-1000
#!/usr/bin/python2.7
import re
import subprocess
import sys
def get_xdg_cmd(cmd):
try:
import xdg.BaseDirectory
import xdg.DesktopEntry
import xdg.IconTheme
except ImportError as e:
print(e)
return
def find_desktop_entry(cmd):
search_nam... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/data/config/e.py | jinliwei1997/mmcv | 3,748 | 1649898 | <gh_stars>1000+
_base_ = './base.py'
item3 = {'a': 1}
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/etl_test/data4_test1.py | topdown618/aliyun-log-python-sdk | 130 | 1649958 |
from aliyun.log.etl_core import *
TRANSFORM_EVENT_lookup = [
( NO_EMPTY('csv_field'), ('csv_field', CSV("f_v1,f_v2,f_v3")) ),
( NO_EMPTY('dsv_field'), ('dsv_field', CSV("f_d1,f_d2,f_d3", sep='#', quote='|')) ),
( ANY, ([("f1", "c1"), ("f2", "c2")], LOOKUP('./data4_lookup_csv1.txt', ["d1", "d2"]) ) ),
... | 0 | 1 | 0 | 0 | 1 | 0 |
src/python/tests/utils.py | annihilatethee/seedsync | 255 | 1649985 | # Copyright 2017, <NAME>, All rights reserved.
import os
class TestUtils:
@staticmethod
def chmod_from_to(from_path: str, to_path: str, mode: int):
"""
Chmod from_path and all its parents up to and including to_path
:param from_path:
:param to_path:
:param mode:
... | 3 | 0 | 0 | 0 | 3 | 0 |
lib/django-0.96/django/utils/termcolors.py | MiCHiLU/google_appengine_sdk | 790 | 1649999 | <gh_stars>100-1000
"""
termcolors.py
"""
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
background = dict([(color_names[x], '4%s' % x) for x in range(8)])
del color_names
RESET = '0'
opt_dict = {'bold': '1', 'und... | 0 | 0 | 0 | 0 | 0 | 0 |
algorithms/Python/UnionFind/union_find.py | herrphon/Algorithms_Example | 315 | 1650013 | #https://stackoverflow.com/questions/20154368/union-find-implementation-using-python
def union_find(lis) -> object:
lis = map(set, lis)
unions = []
for item in lis:
temp = []
for s in unions:
if s.isdisjoint(item):
temp.append(s)
else:
... | 0 | 1 | 0 | 0 | 1 | 0 |
testData/mock/pydanticv0/version.py | alek-sun/pydantic-pycharm-plugin | 238 | 1650018 | class StrictVersion:
def __init__(self, version):
self.version = version
__all__ = ['VERSION']
VERSION = StrictVersion('0.32')
| 0 | 0 | 0 | 0 | 0 | 0 |
jupyterlab_spellchecker/handlers.py | datalayer-externals/jupyterlab-spell-checker | 106 | 1650043 | from jupyter_server.base.handlers import APIHandler
from jupyter_server.utils import url_path_join
import tornado
from tornado.web import StaticFileHandler
from .dictionaries import discover_dictionaries, dictionaries_to_url
from ._version import __version__
class LanguageManagerHandler(APIHandler):
lang_dicti... | 0 | 0 | 1 | 0 | 1 | 0 |
commands/test.py | chunqian/Requester | 318 | 1650052 | from __future__ import annotations
import sublime
import sublime_plugin
import re
import datetime
from time import time
from urllib import parse
from collections import namedtuple
from ..deps.jsonschema import validate, ValidationError
from ..core import RequestCommandMixin
from ..core.parsers import parse_tests
fro... | 2 | 8 | 0 | 0 | 10 | 0 |
boto3_type_annotations_with_docs/boto3_type_annotations/fms/paginator.py | cowboygneox/boto3_type_annotations | 119 | 1650054 | <reponame>cowboygneox/boto3_type_annotations<filename>boto3_type_annotations_with_docs/boto3_type_annotations/fms/paginator.py
from typing import Dict
from botocore.paginate import Paginator
class ListComplianceStatus(Paginator):
def paginate(self, PolicyId: str, PaginationConfig: Dict = None) -> Dict:
""... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/media_engagement_preload/media_engagement_preload_pb2.py | zealoussnow/chromium | 14,668 | 1650087 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: media_engagement_preload.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_data... | 0 | 0 | 0 | 0 | 0 | 0 |
src/aria2p/cli/__init__.py | jamesdarke/gwader | 309 | 1650092 | <filename>src/aria2p/cli/__init__.py
"""The CLI submodule."""
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/AsyncProgressBar/progress_bar.py | MarkoShiva/quart | 1,085 | 1650121 | <filename>examples/AsyncProgressBar/progress_bar.py<gh_stars>1000+
import asyncio
import random
import aioredis
import redis
from quart import Quart, request, url_for, jsonify
app = Quart(__name__)
sr = redis.StrictRedis(host='localhost', port=6379)
sr.execute_command('FLUSHDB')
async def some_work():
global ar... | 0 | 0 | 0 | 0 | 0 | 0 |
tasks.py | azmeuk/pytest-parallel | 219 | 1650129 | <gh_stars>100-1000
from invoke import task
from codecs import open
from os import path
import shutil
import re
with open(path.join('pytest_parallel', '__init__.py'), encoding='utf-8') as f:
version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)
@task
def test(c):
c.run('tox')
@task
def lint(c):... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_utils/test_helpers.py | vforgione/plenario | 109 | 1650163 | <filename>tests/test_utils/test_helpers.py
import unittest
class TestHelpers(unittest.TestCase):
def test_slugify(self):
from plenario.utils.helpers import slugify
self.assertEqual(slugify("A-Awef-Basdf-123"), "a_awef_basdf_123")
| 0 | 0 | 0 | 0 | 0 | 0 |
src/tests/component_model_extensions/CyclicComponentModel.py | vishalbelsare/crosscat | 207 | 1650194 | from __future__ import annotations
import crosscat.cython_code.CyclicComponentModel as ccm
import math
import random
import numpy
import six
from scipy.stats import vonmises
from crosscat.utils.general_utils import logmeanexp
import pdb
pi = math.pi
next_seed = lambda rng: rng.randrange(2147483647)
default_hyperp... | 12 | 13 | 2 | 0 | 27 | 0 |
tasks/pylon/xp.py | vladcorneci/golden-gate | 262 | 1650226 | <filename>tasks/pylon/xp.py
# Copyright 2017-2020 Fitbit, Inc
# SPDX-License-Identifier: Apache-2.0
"""Tasks for building GoldenGate for Pylon"""
import os
import sys
from invoke import task
from .. import cmake
@task
def build(ctx, profile="pylon/pylon", board=None):
'''Build Golden Gate XP libs for the Pylon ... | 0 | 0 | 0 | 0 | 0 | 0 |
2018-volgactf-quals/You-Shall-Not-Pass/ysnp.py | integeruser/on-pwning | 104 | 1650253 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import z3
chars = [z3.Int('c%d' % i) for i in range(50)]
solver = z3.Solver()
for c in chars:
solver.add(z3.And(c >= 0x0, c <= 0xff))
solver.add(chars[0] == ord('V'))
solver.add(chars[1] == ord('o'))
solver.add(chars[2] == ord('l'))
solver.add(chars[3] == ord('g'))
... | 0 | 0 | 0 | 0 | 0 | 0 |
Hackerrank/Practice/Python/6.itertools/53.Iterables and Iterators.py | kushagra1212/Competitive-Programming | 994 | 1650262 | <reponame>kushagra1212/Competitive-Programming
# Enter your code here. Read input from STDIN. Print output to STDOUT
from itertools import*
N = int(input())
elements=input().split()
K=int(input())
count, total = 0, 0
for i in combinations(elements, K):
count += 'a' in i
total += 1
print (count / to... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/core/test_local_service.py | svenaoki/zenml | 565 | 1650279 | # Copyright (c) ZenML GmbH 2021. 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:
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | 21 | 21 | 0 | 0 | 42 | 0 |
payshare/purchases/migrations/0019_userprofile_paypal_me_username.py | cb109/payshare | 184 | 1650342 | # Generated by Django 2.2.5 on 2019-09-04 19:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('purchases', '0018_auto_20190904_2146'),
]
operations: list[object] = [
migrations.AddField(
... | 0 | 0 | 2 | 0 | 2 | 0 |
libs/fuel/fuel/converters/ilsvrc2010.py | dendisuhubdy/attention-lvcsr | 295 | 1650358 | from __future__ import annotations
from __future__ import division
from collections import OrderedDict
from functools import partial
import gzip
import io
import os
import logging
import os.path
import h5py
import numpy
from picklable_itertools.extras import equizip
from progressbar import ProgressBar
from PIL import ... | 4 | 8 | 0 | 0 | 12 | 0 |
kafka_influxdb/encoder/collectd_graphite_encoder.py | gldnspud/kafka-influxdb | 224 | 1650362 | <filename>kafka_influxdb/encoder/collectd_graphite_encoder.py
import logging
from kafka_influxdb.encoder.escape_functions import influxdb_tag_escaper
try:
# Test for mypy support (requires Python 3)
from typing import Text
except ImportError:
pass
class Encoder(object):
"""
An encoder for the Col... | 0 | 0 | 0 | 0 | 0 | 0 |
ikalog/scenes/game/kill.py | fetus-hina/IkaLog | 285 | 1650369 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 <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/LI... | 1 | 2 | 0 | 0 | 3 | 0 |
apps/manage/views.py | SuperLeilia/loonflow | 1,541 | 1650372 | from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
@login_required
def index(request) -> object:
"""
总览
:param request:
:return:
"""
return HttpResponse("This is loonflow's api server, please view frontend page, reference: http://loonflow.readthedocs... | 0 | 1 | 0 | 0 | 1 | 0 |
ivy/functional/__init__.py | saurbhc/ivy | 681 | 1650426 | from . import ivy
from .ivy import *
| 0 | 0 | 0 | 0 | 0 | 0 |
uq360/metrics/__init__.py | Sclare87/UQ360 | 148 | 1650443 | from .classification_metrics import expected_calibration_error, area_under_risk_rejection_rate_curve, \
compute_classification_metrics, entropy_based_uncertainty_decomposition, multiclass_brier_score
from .regression_metrics import picp, mpiw, compute_regression_metrics, plot_uncertainty_distribution, \
plot_un... | 0 | 0 | 0 | 0 | 0 | 0 |
Examples/AppKit/Grady/MyBezierGradientView.py | Khan/pyobjc-framework-Cocoa | 132 | 1650466 | <reponame>Khan/pyobjc-framework-Cocoa
from MyBaseGradientView import *
class MyBezierGradientView (MyBaseGradientView):
def init(self):
self = super(MyBaseGradientView, self).init()
if self is None:
return None
self.myOffsetPt = NSMakePoint(0.0, 0.0)
return self
de... | 0 | 0 | 0 | 0 | 0 | 0 |
python/userConfig.py | opteroncx/MoePhoto | 192 | 1650499 | <reponame>opteroncx/MoePhoto
import json
from os.path import exists, join
from defaultConfig import defaultConfig
VERSION = '4.6'
configPath = '.user/config.json'
manifestPath = 'manifest.json'
def compareVersion(a, b):
for v0, v1 in zip(a.split('.'), b.split('.')):
n0 = int(v0)
n1 = int(v1)
i... | 0 | 0 | 0 | 0 | 0 | 0 |
labelprop/crw.py | Nitin-Mane/dense-ulearn-vos | 157 | 1650544 | <gh_stars>100-1000
"""
Inference routines from Jabri et al., (2020)
Credit: https://github.com/ajabri/videowalk.git
License: MIT
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import time
class CRW(object):
"""Propagation algorithm"""
def __init__(self, cfg):
self.n_context = ... | 0 | 0 | 0 | 0 | 0 | 0 |
galaxy/api/v2/tests/test_task_serializers.py | bmclaughlin/galaxy | 904 | 1650580 | # (c) 2012-2019, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/compiler/opcode_cinder.py | mananpal1997/cinder | 1,886 | 1650601 | <reponame>mananpal1997/cinder
from .opcodebase import Opcode
from .opcodes import opcode as base_opcode
opcode: Opcode = base_opcode.copy()
opcode.def_op("LOAD_METHOD_SUPER", 198)
opcode.hasconst.add(198)
opcode.def_op("LOAD_ATTR_SUPER", 199)
opcode.hasconst.add(199)
opcode.stack_effects["LOAD_METHOD_SUPER"] = -1
opc... | 0 | 0 | 0 | 0 | 0 | 0 |
skgstat/interfaces/variogram_estimator.py | rhugonnet/scikit-gstat | 141 | 1650607 | <filename>skgstat/interfaces/variogram_estimator.py
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.utils.validation import check_X_y
class VariogramEstimator(BaseEstimator):
def __init__(self,
estimator='matheron',
model='spherical',
dist_... | 0 | 0 | 0 | 0 | 0 | 0 |
posthog/migrations/0092_rename_projects_to_default.py | dorucioclea/posthog | 7,409 | 1650614 | <filename>posthog/migrations/0092_rename_projects_to_default.py
from django.db import migrations
def forwards_func(apps, schema_editor):
Team = apps.get_model("posthog", "Team")
Team.objects.filter(organization__isnull=False).exclude(name__iexact="Hogflix Demo App").update(
name=Team._meta.get_field("... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_viridis.py | hgroll/tikzplotlib | 646 | 1650631 | def plot() -> object:
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
x, y = np.meshgrid(np.linspace(0, 1), np.linspace(0, 1))
z = x**2 - y**2
fig = plt.figure()
plt.pcolormesh(x, y, z, cmap=cm.viridis, shading="gouraud")
# plt.colorbar()
return fig
... | 0 | 1 | 0 | 0 | 1 | 0 |
v2/python/get_all_accounts.py | sekon11/googleads-adsense-examples | 120 | 1650702 | <gh_stars>100-1000
#!/usr/bin/python
#
# Copyright 2021 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 a... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/test/test_multigrmpy.py | vb-wayne/paragraph | 111 | 1650717 | #!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2016-2019 Illumina, 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/LIC... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/tensorboard-service/app/api/tests/test_main.py | nparkstar/nauta | 390 | 1650724 | #
# Copyright (c) 2019 Intel Corporation
#
# 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... | 14 | 0 | 0 | 0 | 14 | 0 |
language_model/model_word_ada/lm.py | XuezheMax/apollo | 166 | 1650752 | <reponame>XuezheMax/apollo<filename>language_model/model_word_ada/lm.py
import torch.nn as nn
class LM(nn.Module):
def __init__(self, w_num, w_dim, rnn_unit, num_layers, hidden_dim, dropout, cutoffs):
super(LM, self).__init__()
self.w_num = w_num
self.w_dim = w_dim
self.word_embe... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/draw_plot.py | hiroponnn/chainer-faster-rcnn | 331 | 1650763 | <reponame>hiroponnn/chainer-faster-rcnn
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import glob
import json
import os
from collections import defaultdict
import numpy as np
if True:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import seaborn as sns
if __... | 0 | 0 | 0 | 0 | 0 | 0 |
renzongxian/0006/0006.py | saurabh896/python-1 | 3,976 | 1650776 | # Source:https://github.com/Show-Me-the-Code/show-me-the-code
# Author:renzongxian
# Date:2014-12-08
# Python 3.4
"""
第 0006 题:你有一个目录,放了你一个月的日记,都是 txt,为了避免分词的问题,假设内容都是英文,请统计出你认为每篇日记最重要的词。
"""
import os
import sys
import re
def important_word(target_file):
file_object = open(target_file, 'r')
file_content ... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_sensei.py | robertmaynard/hpc-container-maker | 340 | 1650778 | # Copyright (c) 2019, NVIDIA CORPORATION. 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 appli... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/base/urls/wparameter.py | youssriaboelseod/pyerp | 115 | 1650816 | <reponame>youssriaboelseod/pyerp<gh_stars>100-1000
"""The store routes
"""
# Django Library
from django.urls import path
# Localfolder Library
from ..views.wparameter import (
WParameterCreateView, WParameterDeleteView, WParameterDetailView,
WParameterListView, WParameterUpdateView)
app_name = 'PyWParameter'
... | 0 | 0 | 0 | 0 | 0 | 0 |
prototypes/dml_iv/dml_iv.py | khwilson/EconML | 1,846 | 1650911 | <gh_stars>1000+
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Double ML IV for Heterogeneous Treatment Effects.
An Double/Orthogonal machine learning approach to estimation of heterogeneous
treatment effect with an endogenous treatment and an instrument. It
im... | 0 | 0 | 0 | 0 | 0 | 0 |
py2.5/processing/finalize.py | geofft/multiprocess | 356 | 1650916 | <reponame>geofft/multiprocess
#
# Module supporting finaliztion using weakrefs
#
# processing/finalize.py
#
# Copyright (c) 2006-2008, <NAME> --- see COPYING.txt
#
import weakref
import itertools
from processing.logger import subDebug
__all__ = ['Finalize', '_runFinalizers']
_registry = {}
_counte... | 0 | 0 | 0 | 0 | 0 | 0 |
fastapi_cloudauth/firebase.py | discdiver/fastapi-cloudauth | 198 | 1650923 | from calendar import timegm
from datetime import datetime
from typing import Any, Dict
from fastapi import HTTPException
from pydantic import BaseModel, Field
from starlette import status
from .base import UserInfoAuth
from .messages import NOT_VERIFIED
from .verification import JWKS, ExtraVerifier
class FirebaseCl... | 6 | 1 | 2 | 0 | 9 | 0 |
Chapter_4/ch04_ex5.py | pauldevos/Mastering-Object-Oriented-Python-Second-Edition | 108 | 1650936 | #!/usr/bin/env python3.7
"""
Mastering Object-Oriented Python 2e
Code Examples for Mastering Object-Oriented Python 2nd Edition
Chapter 4. Example 5.
"""
from dataclasses import dataclass
from enum import Enum
from typing import Iterator, cast, Iterable, Optional
@dataclass
class RTD:
rate: Optional[float]
... | 0 | 5 | 9 | 0 | 14 | 0 |
modin/data_management/functions/binary_function.py | atomicai/modin | 7,258 | 1650952 | <filename>modin/data_management/functions/binary_function.py<gh_stars>1000+
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file t... | 0 | 0 | 0 | 0 | 0 | 0 |
src/redisboard/templatetags/byte_filters.py | simonsfoundation/django-redisboard | 135 | 1650969 | from django import template
try:
from urllib.parse import quote
except ImportError:
from urllib import quote
register = template.Library()
@register.filter
def url_encode(value) -> object:
return quote(value)
@register.filter
def try_decode(value) -> object:
if isinstance(value, bytes):
tr... | 0 | 2 | 0 | 0 | 2 | 0 |
iot_link/os/novaos/scripts/python/libsesa.py | LAOMENGA/LiteOS_Lab | 128 | 1650980 | <filename>iot_link/os/novaos/scripts/python/libsesa.py
#
# Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
#
# LiteOS NOVA is licensed under the Mulan PSL v1.
# You can use this software according to the terms and conditions of the Mulan PSL v1.
# You may obtain a copy of Mulan PSL v1 at:
#
# htt... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/transport_nsw/__init__.py | domwillcode/home-assistant | 30,023 | 1650986 | """Tests for the transport_nsw component."""
| 0 | 0 | 0 | 0 | 0 | 0 |
optimizer/__init__.py | iamreallyi9/cd | 1,205 | 1650994 | #!/usr/bin/env python3
from torch.optim.optimizer import Optimizer
from torch.optim import Adam
OPTIMIZER_MAP = {
"Adam": Adam,
}
OPTIMIZER_NAMES = OPTIMIZER_MAP.keys()
OPTIMIZER_CLASSES = OPTIMIZER_MAP.values()
def create(optimizer_name: str, *args, **kwargs) -> Optimizer:
return OPTIMIZER_MAP[optimizer... | 1 | 1 | 0 | 0 | 2 | 0 |
contributed_modules/mysql/mysqldb_/study_mysqldb.py | 2581676612/python | 112 | 1651027 | <filename>contributed_modules/mysql/mysqldb_/study_mysqldb.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17-3-27 下午4:29
# @Author : Tom.Lee
# @Description : mysql 操作
# @File : study_mysql.py
# @Product : PyCharm
import MySQLdb
import logging
from contextlib import clos... | 0 | 0 | 0 | 0 | 0 | 0 |
backends/c-ipu/config.py | xysmlx/antares | 132 | 1651046 | <reponame>xysmlx/antares
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import json
import hashlib
import numpy as np
import copy
from .auto_shard import update_ast
def get_execution_parallism():
return 1
def search_space(compute_graph):
ast_seq, input_dict, output_dict = com... | 0 | 0 | 0 | 0 | 0 | 0 |
video.py | zjw88282740/xunleiaccount | 191 | 1651056 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'wei'
import urllib2
from bs4 import BeautifulSoup
def getVIP(webSite):
url = "http://www.vipfenxiang.com/"+webSite+"/"
html = urllib2.urlopen(url).read()
soup = BeautifulSoup(html, 'html.parser')
tag_article = soup.find_all('article')[0].find_all('a')[0]... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/runners/lib/utils.py | CyberFlameGO/tilck | 1,059 | 1651071 | # SPDX-License-Identifier: BSD-2-Clause
from __future__ import annotations
import re
import os
import sys
import fcntl
import base64
import zlib
import subprocess
from enum import Enum
from .stdio import msg_print, raw_print, direct_print
# Constants
TEST_TYPES = ['selftest', 'shellcmd', 'interactive']
TEST_TYPES_PR... | 1 | 7 | 17 | 0 | 25 | 0 |
Decision Tree/DT_Classify/AnFany_DT_Iris.py | Jojoxiao/Machine-Learning-for-Beginner-by-Python3 | 397 | 1651078 | <filename>Decision Tree/DT_Classify/AnFany_DT_Iris.py
# -*- coding:utf-8 -*-
# &Author AnFany
import AnFany_DT_Classify as model
import Irisdata_DT_Anfany as dtda
# 最终的函数
from pylab import mpl
mpl.rcParams['font.sans-serif'] = ['FangSong'] # 显示中文
mpl.rcParams['axes.unicode_minus'] = False # 显示负号
import m... | 0 | 0 | 0 | 0 | 0 | 0 |
x86/ascii/mixedcase/i32/build_config.py | mitthu/alpha3 | 137 | 1651108 | build_config = {
"projects": {
u'x86\\ascii\\mixedcase\\i32': {
"files": {
u'dwx_IMUL_30_XOR_dwy.bin': {
"sources": [u'dwx_IMUL_30_XOR_dwy.asm']
},
u'dwx_IMUL_by.bin': {
"sources": [u'dwx_IMUL_by.asm']
}
}
}
}
}
| 0 | 0 | 0 | 0 | 0 | 0 |
crafters/nlp/SpellChecker/pyngramspell/train.py | sidphbot/jina-hub | 106 | 1651114 | <filename>crafters/nlp/SpellChecker/pyngramspell/train.py
import os
from pathlib import Path
from pyngramspell import PyNgramSpell
cur_dir = os.path.dirname(os.path.abspath(__file__))
def get_evaluation(n_test=100):
lines = open(os.path.join(cur_dir, 'evaluation.txt')).readlines()
data = []
import nltk... | 0 | 0 | 0 | 0 | 0 | 0 |
bench/gen.py | iver56/julius | 256 | 1651153 | from __future__ import annotations
import subprocess as sp
import torch as th
def run_bench(name, *args, device: str="cpu") -> object | str:
args = list(args)
args += ["-d", device]
if device == "cuda" and not th.cuda.is_available():
return "Not available /!\\"
return sp.check_output(["python3... | 1 | 1 | 0 | 0 | 2 | 0 |
migrations/versions/1f8165cd3c06_.py | paked/WPC-fix | 200 | 1651155 | """empty message
Revision ID: 1f8165cd3c06
Revises: 56da2beefa69
Create Date: 2015-02-22 16:04:09.297033
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '56da2beefa69'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please ... | 0 | 0 | 0 | 0 | 0 | 0 |
ml/spark/model.py | Chabane/bigdata-spark-kafka-complete-app | 178 | 1651163 | from __future__ import print_function
import tweepy
import os
from pyspark.sql import *
from pyspark.sql.types import *
from pyspark.sql.functions import col
from pyspark.ml import Pipeline, PipelineModel
from pyspark.ml.classification import LogisticRegression
from pyspark.ml.feature import HashingTF, Tokenizer, St... | 0 | 0 | 0 | 0 | 0 | 0 |
cpp2py_test/close_power_of_2_test.py | fevorl/BM3D_py | 157 | 1651183 | <filename>cpp2py_test/close_power_of_2_test.py
import numpy as np
def my_closest_power_of_2(M, max):
M = np.where(max < M, max, M)
while max > 1:
M = np.where((max // 2 < M) * (M < max), max // 2, M)
max //= 2
return M
def closest_power_of_2(n):
r = 1
while r * 2 <= n:
r ... | 0 | 0 | 0 | 0 | 0 | 0 |
testproject/common/forms.py | samuelblattner/django-cassandra-engine | 334 | 1651189 | from django.forms import ModelForm
from common.models import CassandraFamilyMember
class CassandraFamilyMemberForm(ModelForm):
class Meta:
model = CassandraFamilyMember
exclude: tuple[str] = ('created_on',)
| 0 | 0 | 1 | 0 | 1 | 0 |
luz_asm_sim/tests_full/run_test_interactive.py | eliben/luz-cpu | 135 | 1651209 | # Run a single full test in interactive command-line mode.
# This is useful for debugging full tests.
#
# <NAME> (C) 2008-2010
import os, sys
import optparse
from testrun_utils import link_asmfiles
from lib.commonlib.portability import printme
from lib.simlib.luzsim import LuzSim
from lib.simlib.interactive_cli import... | 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractLionMasksReallyProfessionalTranslations.py | fake-name/ReadableWebProxy | 193 | 1651210 | from __future__ import annotations
def extractLionMasksReallyProfessionalTranslations(item) -> bool | object | None:
"""
Lion Mask's Really Professional Translations
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
re... | 0 | 1 | 0 | 0 | 1 | 0 |
mimc_stark/test_multi_merkle.py | kevaundray/research | 1,351 | 1651213 | <reponame>kevaundray/research
from merkle_tree import merkelize, mk_multi_branch, verify_multi_branch
def test_multi_merkle_tree():
tree = merkelize(list(range(16)))
for i in range(65536):
indices = [j for j in range(16) if (i>>j)%2 == 1]
branch = mk_multi_branch(tree, indices)
assert v... | 0 | 0 | 0 | 0 | 0 | 0 |
Specifications/sync-script/replace_links.py | yjt98765/qsharp-language | 126 | 1651239 | #!/bin/env python
# -*- coding: utf-8 -*-
##
# replace_links.py: replaces the relevant links with uid cross references.
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
##
"""
Replaces GitHub links with uid cross references for the files specified
in a uid-map.csv file. Th... | 2 | 1 | 0 | 0 | 3 | 0 |
desktop/core/ext-py/nose-1.3.7/unit_tests/test_skip_plugin.py | kokosing/hue | 5,079 | 1651271 | import unittest
from nose.config import Config
from nose.plugins.skip import Skip, SkipTest
from nose.result import TextTestResult
from StringIO import StringIO
from nose.result import _TextTestResult
from optparse import OptionParser
try:
# 2.7+
from unittest.runner import _WritelnDecorator
except ImportError:... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/printenv.py | mrshu/stash | 1,822 | 1651272 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""List current environment variables and values.
"""
from __future__ import division, print_function, unicode_literals
import argparse
import os
import sys
def main(args):
p = argparse.ArgumentParser(description=__doc__)
p.add_argument("variables", action="stor... | 0 | 0 | 0 | 0 | 0 | 0 |
angr/procedures/java_lang/string.py | Kyle-Kyle/angr | 6,132 | 1651368 | <gh_stars>1000+
import logging
import claripy
from ..java import JavaSimProcedure
from ...engines.soot.expressions import SimSootExpr_NewArray
from ...engines.soot.values import SimSootValue_ArrayRef, SimSootValue_StringRef
log = logging.getLogger(name=__name__)
class StringConcat(JavaSimProcedure):
__provide... | 0 | 0 | 0 | 0 | 0 | 0 |
HunterAdminApi/test/common/test_http_util.py | tt9133github/hunter | 322 | 1651379 | <filename>HunterAdminApi/test/common/test_http_util.py
#!/ usr/bin/env
# coding=utf-8
"""
author: b5mali4
Copyright (c) 2018
"""
import unittest
from common.http_util import get_host_port, get_parent_route, remove_http, get_top_domain
class HttpUtilTestCase(unittest.TestCase):
def testRemoveHttp(self):
""... | 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/ex_am.py | hajime9652/observations | 199 | 1651400 | # -*- 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 ex_am(path) -> tuple[object, object]:
"""Example Data of Antille and ... | 0 | 1 | 0 | 0 | 1 | 0 |
src/whoosh/util/times.py | matchup-ir/whooshy | 319 | 1651435 | <filename>src/whoosh/util/times.py
# Copyright 2010 <NAME>. 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 of source code must retain the above copyright notice,
# t... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/order_management/order/src/demo_data.py | hipacloud/zero | 304 | 1651451 | <filename>examples/order_management/order/src/demo_data.py
import asyncio
from src.store import Base, create_order, engine
async def create_demo_data():
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.drop_all)
await conn.run_sync(Base.metadata.create_all)
await crea... | 0 | 0 | 0 | 0 | 0 | 0 |
beta_rec/utils/constants.py | mengzaiqiao/TVBR | 126 | 1651524 | <reponame>mengzaiqiao/TVBR
DEFAULT_USER_COL = "col_user"
DEFAULT_ITEM_COL = "col_item"
DEFAULT_RATING_COL = "col_rating"
DEFAULT_LABEL_COL = "col_label"
DEFAULT_ORDER_COL = "col_order"
DEFAULT_FLAG_COL = "col_flag"
DEFAULT_TIMESTAMP_COL = "col_timestamp"
DEFAULT_PREDICTION_COL = "col_prediction"
DEFAULT_K = 10
DEFAULT... | 0 | 0 | 0 | 0 | 0 | 0 |
optimus/engines/dask_cudf/io/save.py | ironmussa/Optimus | 1,045 | 1651534 | <filename>optimus/engines/dask_cudf/io/save.py
from optimus.engines.base.io.save import BaseSave, DEFAULT_MODE
from optimus.helpers.logger import logger
from optimus.helpers.types import *
from optimus.engines.base.io.save import BaseSave
class Save(BaseSave):
def __init__(self, root: 'DataFrameType'):
s... | 0 | 0 | 0 | 0 | 0 | 0 |
supriya/sclang.py | butayama/supriya | 191 | 1651556 | from __future__ import annotations
import os
import pathlib
import platform
import uqbar.io
import supriya
def find(sclang_path: object | None=None) -> object:
"""Find the ``sclang`` executable.
The following paths, if defined, will be searched (prioritised as ordered):
1. The absolute path ``sclang_pa... | 1 | 1 | 0 | 0 | 2 | 0 |
Lib/test/test_weakref_jy.py | jimmyyu2004/jython | 332 | 1651566 | from __future__ import annotations
"""Misc weakref tests
Made for Jython.
"""
import unittest
import weakref
from test import support
from test_weakref import extra_collect
class ReferencesTestCase(unittest.TestCase):
def test___eq__(self) -> bool | object:
class Foo(object):
def __eq__(self,... | 1 | 5 | 0 | 0 | 6 | 0 |
det3d/models/bbox_heads/mg_head_v4_release.py | reinforcementdriving/CIA-SSD | 382 | 1651589 | <filename>det3d/models/bbox_heads/mg_head_v4_release.py
import logging
from collections import defaultdict
from enum import Enum
import matplotlib.pyplot as plt
import os
import pickle
import numpy as np
import torch
from det3d.core.bbox import box_torch_ops
from det3d.models.builder import build_loss
from det3d.models... | 0 | 0 | 0 | 0 | 0 | 0 |
language/mentionmemory/tasks/relation_classifier_task_test.py | greck2908/language | 1,199 | 1651600 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 | 3 | 3 | 0 | 8 | 0 |
test/test_static_variables.py | leeyangjie/unit | 2,633 | 1651613 | import os
from pathlib import Path
import pytest
from unit.applications.proto import TestApplicationProto
class TestStaticVariables(TestApplicationProto):
prerequisites: dict[object,object] = {}
@pytest.fixture(autouse=True)
def setup_method_fixture(self, temp_dir):
os.makedirs(temp_dir + '/asse... | 0 | 1 | 1 | 0 | 2 | 0 |
ninja/types.py | kmlee78/django-ninja | 2,809 | 1651663 | <gh_stars>1000+
from typing import Any, Callable, Dict, TypeVar
__all__ = ["DictStrAny", "TCallable"]
DictStrAny = Dict[str, Any]
TCallable = TypeVar("TCallable", bound=Callable[..., Any])
# unfortunately this doesn't work yet, see
# https://github.com/python/mypy/issues/3924
# Decorator = Callable[[TCallable], TC... | 0 | 0 | 0 | 0 | 0 | 0 |
model_GLU.py | astricks/Voice-Conversion-GAN | 104 | 1651711 | import torch.nn as nn
import torch
import numpy as np
class GLU(nn.Module):
def __init__(self):
super(GLU, self).__init__()
# Custom Implementation because the Voice Conversion Cycle GAN
# paper assumes GLU won't reduce the dimension of tensor by 2.
def forward(self, input) -> object:... | 0 | 8 | 0 | 0 | 8 | 0 |
corehq/apps/accounting/migrations/0048_friendly_writeoff.py | dimagilg/commcare-hq | 471 | 1651727 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-04-28 20:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounting', '0047_invoice_communication'),
]
operations = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.