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 |
|---|---|---|---|---|
DIYgod/0006/a.py | saurabh896/python-1 | 3,976 | 12784965 | <gh_stars>1000+
f = open('a.txt', 'rb')
lines = f.readlines()
for line in lines:
pass
f.close()
f = open('a.txt', 'rb')
for line in f:
pass
f.close()
f = open('a.txt', 'rb')
while true:
line = f.readline()
if not line:
break
pass
f.close()
|
harvester/server/expiring_queue.py | Nisthar/CaptchaHarvester | 545 | 12784971 | <reponame>Nisthar/CaptchaHarvester
from queue import Empty, Queue, SimpleQueue
from threading import Timer
from typing import Any
class ExpiringQueue(Queue):
def __init__(self, timeout: int, maxsize=0):
super().__init__(maxsize)
self.timeout = timeout
self.timers: 'SimpleQueue[Timer]' = Si... |
ctc_fast/swbd-utils/score_frag_utts.py | SrikarSiddarth/stanford-ctc | 268 | 12784986 | <filename>ctc_fast/swbd-utils/score_frag_utts.py<gh_stars>100-1000
'''
Look at error rates only scoring utterances that contain frags
'''
FRAG_FILE = '/deep/u/zxie/ctc_clm_transcripts/frags.txt'
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('hyp')
pa... |
samples/python/40.timex-resolution/ambiguity.py | Aliacf21/BotBuilder-Samples | 1,998 | 12784998 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from recognizers_date_time import recognize_datetime, Culture
class Ambiguity:
"""
TIMEX expressions are designed to represent ambiguous rather than definite dates. For
example: "Monday" could be any Monday ever... |
tests/test_gosubdag_relationships.py | flying-sheep/goatools | 477 | 12785033 | #!/usr/bin/env python
"""Plot both the standard 'is_a' field and the optional 'part_of' relationship."""
from __future__ import print_function
__copyright__ = "Copyright (C) 2016-2018, <NAME>, <NAME>, All rights reserved."
import os
import sys
import timeit
import datetime
from goatools.base import download_go_basic... |
flash/video/classification/input_transform.py | Actis92/lightning-flash | 1,457 | 12785058 | # Copyright The PyTorch Lightning team.
#
# 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 i... |
tensorflow_graphics/datasets/features/camera_feature_test.py | Liang813/graphics | 2,759 | 12785120 | # Copyright 2020 The TensorFlow 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
__scraping__/investing.com - request, BS/main.py | whitmans-max/python-examples | 140 | 12785164 |
# date: 2020.09.11
# author: Bartłomiej "furas" Burek (https://blog.furas.pl)
# https://stackoverflow.com/questions/63840415/how-to-scrape-website-tables-where-the-value-can-be-different-as-we-chose-but-th
import requests
from bs4 import BeautifulSoup
import csv
url = 'https://id.investing.com/instruments/Historical... |
lte/gateway/python/integ_tests/s1aptests/test_send_error_ind_for_dl_nas_with_auth_req.py | Aitend/magma | 849 | 12785175 | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
gerapy/pipelines/mongodb.py | hantmac/Gerapy | 2,888 | 12785176 | <filename>gerapy/pipelines/mongodb.py<gh_stars>1000+
import pymongo
from twisted.internet.threads import deferToThread
class MongoDBPipeline(object):
def __init__(self, mongodb_uri, mongodb_database):
self.mongodb_uri = mongodb_uri
self.mongodb_database = mongodb_database
@classmethod
... |
examples/pybullet/examples/frictionCone.py | stolk/bullet3 | 158 | 12785184 | import pybullet as p
import time
import math
p.connect(p.GUI)
useMaximalCoordinates = False
p.setGravity(0, 0, -10)
plane = p.loadURDF("plane.urdf", [0, 0, -1], useMaximalCoordinates=useMaximalCoordinates)
p.setRealTimeSimulation(0)
velocity = 1
num = 40
p.configureDebugVisualizer(p.COV_ENABLE_GUI, 0)
p.configureDe... |
tools/third_party/pywebsocket3/example/cgi-bin/hi.py | meyerweb/wpt | 2,479 | 12785192 | <gh_stars>1000+
#!/usr/bin/env python
print('Content-Type: text/plain')
print('')
print('Hi from hi.py')
|
scripts/visualize/match.py | facebookresearch/banmo | 201 | 12785246 | # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
# TODO: pass ft_cse to use fine-tuned feature
# TODO: pass fine_steps -1 to use fine samples
from absl import flags, app
import sys
sys.path.insert(0,'')
sys.path.insert(0,'third_party')
import numpy as np
from matplotlib import pyplot as plt
impor... |
extras/api/urls.py | maznu/peering-manager | 127 | 12785248 | from peering_manager.api import OrderedDefaultRouter
from . import views
router = OrderedDefaultRouter()
router.APIRootView = views.ExtrasRootView
router.register("ix-api", views.IXAPIViewSet)
router.register("job-results", views.JobResultViewSet)
router.register("webhooks", views.WebhookViewSet)
app_name = "extras... |
pyinfra/facts/yum.py | blarghmatey/pyinfra | 1,532 | 12785286 | from pyinfra.api import FactBase
from .util import make_cat_files_command
from .util.packaging import parse_yum_repositories
class YumRepositories(FactBase):
'''
Returns a list of installed yum repositories:
.. code:: python
[
{
'name': 'CentOS-$releasever - Apps',
... |
codegeneration/code_manip/file_utils.py | sacceus/BabylonCpp | 277 | 12785308 | <gh_stars>100-1000
import os
import os.path
import codecs
from typing import *
from bab_types import *
def files_with_extension(folder: Folder, extension: Extension) -> List[FileFullPath]:
r = []
ext_len = len(extension)
if not os.path.isdir(folder):
print("ouch")
for root, _, files in os.walk... |
doc/examples/skeleton_behaviour.py | andrewbest-tri/py_trees | 201 | 12785316 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import py_trees
import random
class Foo(py_trees.behaviour.Behaviour):
def __init__(self, name):
"""
Minimal one-time initialisation. A good rule of thumb is
to only include the initialisation relevant for being able
to insert this be... |
dfirtrack_artifacts/admin.py | cclauss/dfirtrack | 273 | 12785349 | from django.contrib import admin
from dfirtrack_artifacts.models import (
Artifact,
Artifactpriority,
Artifactstatus,
Artifacttype,
)
# Register your models here.
admin.site.register(Artifact)
admin.site.register(Artifactpriority)
admin.site.register(Artifactstatus)
admin.site.register(Artifacttype)
|
packages/python/pyfora/Connection.py | ufora/ufora | 571 | 12785350 | <reponame>ufora/ufora<gh_stars>100-1000
# Copyright 2015 Ufora 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 r... |
contrib/report_builders/json_report_builder.py | berndonline/flan | 3,711 | 12785384 | import json
from typing import Any, Dict, List
from contrib.descriptions import VulnDescriptionProvider
from contrib.internal_types import ScanResult
from contrib.report_builders import ReportBuilder
class JsonReportBuilder(ReportBuilder):
def __init__(self, description_provider: VulnDescriptionProvider):
... |
ros_compatibility/src/ros_compatibility/exceptions.py | SebastianHuch/ros-bridge | 314 | 12785404 | #!/usr/bin/env python
#
# Copyright (c) 2021 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
from ros_compatibility.core import get_ros_version
ROS_VERSION = get_ros_version()
if ROS_VERSION == 1:
import rospy
class... |
tests/unit/cartography/intel/gsuite/test_api.py | sckevmit/cartography | 2,322 | 12785440 | from unittest import mock
from unittest.mock import patch
from cartography.intel.gsuite import api
def test_get_all_users():
client = mock.MagicMock()
raw_request_1 = mock.MagicMock()
raw_request_2 = mock.MagicMock()
user1 = {'primaryEmail': '<EMAIL>'}
user2 = {'primaryEmail': '<EMAIL>'}
use... |
mseg_semantic/utils/normalization_utils.py | weblucas/mseg-semantic | 391 | 12785453 | <reponame>weblucas/mseg-semantic<gh_stars>100-1000
#!/usr/bin/python3
import numpy as np
import torch
from typing import Optional, Tuple
def get_imagenet_mean_std() -> Tuple[Tuple[float,float,float], Tuple[float,float,float]]:
""" See use here in Pytorch ImageNet script:
https://github.com/pytorch/exam... |
algorithms/dynamic_programming/longest_consecutive_subsequence.py | ruler30cm/python-ds | 1,723 | 12785464 | <filename>algorithms/dynamic_programming/longest_consecutive_subsequence.py
"""
Given an array of integers, find the length of the longest sub-sequence
such that elements in the subsequence are consecutive integers, the
consecutive numbers can be in any order.
The idea is to store all the elements in a set first. Th... |
tracardi/service/wf/domain/error_debug_info.py | bytepl/tracardi | 153 | 12785473 | <filename>tracardi/service/wf/domain/error_debug_info.py
from pydantic import BaseModel
class ErrorDebugInfo(BaseModel):
msg: str
line: int
file: str
|
tests/test_context.py | agronholm/asphalt | 226 | 12785537 | <reponame>agronholm/asphalt<filename>tests/test_context.py<gh_stars>100-1000
from __future__ import annotations
import asyncio
import sys
from collections.abc import Callable
from concurrent.futures import Executor, ThreadPoolExecutor
from inspect import isawaitable
from itertools import count
from threading import Th... |
video_from_lv.py | pengzhou93/dancenet | 499 | 12785539 | import tensorflow as tf
import numpy as np
from model import decoder,vae
import cv2
vae.load_weights("vae_cnn.h5")
lv = np.load("lv.npy")
fourcc = cv2.VideoWriter_fourcc(*'XVID')
video = cv2.VideoWriter("output.avi", fourcc, 30.0, (208, 120))
for i in range(1000):
data = lv[i].reshape(1,128)
img = decoder.pre... |
alipay/aop/api/domain/MedicalHospitalDeptInfo.py | snowxmas/alipay-sdk-python-all | 213 | 12785558 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MedicalHospitalDeptInfo(object):
def __init__(self):
self._code = None
self._location = None
self._name = None
self._parent_name = None
self._partner_code ... |
idaes/power_generation/costing/power_plant_costing.py | carldlaird/idaes-pse | 112 | 12785559 | <gh_stars>100-1000
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-20... |
src/masonite/commands/__init__.py | cercos/masonite | 1,816 | 12785561 | <reponame>cercos/masonite<filename>src/masonite/commands/__init__.py
from .CommandCapsule import CommandCapsule
from .AuthCommand import AuthCommand
from .TinkerCommand import TinkerCommand
from .KeyCommand import KeyCommand
from .ServeCommand import ServeCommand
from .QueueWorkCommand import QueueWorkCommand
from .Que... |
calvinextras/calvinsys/web/pushbullet/Pushbullet.py | gabrielcercel/calvin-base | 334 | 12785574 | <reponame>gabrielcercel/calvin-base<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Ericsson AB
#
# 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/l... |
home.admin/BlitzTUI/blitztui/ui/qcode.py | PatrickScheich/raspiblitz | 1,908 | 12785590 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'designer/qcode.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_DialogShowQrCode(object):
def setupUi(self, DialogShowQrCode... |
recipes/Python/473781_mthreadpy_version_2/recipe-473781.py | tdiprima/code | 2,023 | 12785601 | <reponame>tdiprima/code
# #include <windows.h>
import thread
# #include <math.h>
import math
# #include <stdio.h>
import sys
# #include <stdlib.h>
import time
# static int runFlag = TRUE;
runFlag = True
# void main(int argc, char *argv[]) {
def main(argc, argv):
global runFlag
# unsigned int runTime
# PYT... |
atest/testdata/keywords/PositionalOnly.py | bhirsz/robotframework | 7,073 | 12785671 | def one_argument(arg, /):
return arg.upper()
def three_arguments(a, b, c, /):
return '-'.join([a, b, c])
def with_normal(posonly, /, normal):
return posonly + '-' + normal
def defaults(required, optional='default', /):
return required + '-' + optional
def types(first: int, second: float, /):
... |
rx/internal/basic.py | mmpio/RxPY | 4,342 | 12785672 | from typing import Any
from datetime import datetime
# Defaults
def noop(*args, **kw):
"""No operation. Returns nothing"""
pass
def identity(x: Any) -> Any:
"""Returns argument x"""
return x
def default_now() -> datetime:
return datetime.utcnow()
def default_comparer(x: Any, y: Any) -> bool:... |
src/transformer_deploy/backends/pytorch_utils.py | dumpmemory/transformer-deploy | 698 | 12785687 | <filename>src/transformer_deploy/backends/pytorch_utils.py
# Copyright 2022, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
runtime/stdlib/jitlog.py | cheery/lever | 136 | 12785693 | <gh_stars>100-1000
# There is a convenient PYPYLOG=jit-log-opt:logfile
# to enable jit logging from outside.
# But I like having the option to
# enable it from the inside.
from rpython.rtyper.lltypesystem import rffi, lltype, llmemory
from rpython.rlib.rjitlog import rjitlog
from rpython.rlib import jit
from space impo... |
packages/core/minos-microservice-common/minos/common/datetime.py | sorasful/minos-python | 247 | 12785700 | from datetime import (
datetime,
timezone,
)
def current_datetime() -> datetime:
"""Get current datetime in `UTC`.
:return: A ``datetime`` instance.
"""
return datetime.now(tz=timezone.utc)
NULL_DATETIME = datetime.max.replace(tzinfo=timezone.utc)
|
wpca/tests/test_utils.py | radicamc/wpca | 123 | 12785717 | from itertools import chain, combinations
import numpy as np
from numpy.testing import assert_allclose
from wpca.tests.tools import assert_allclose_upto_sign
from wpca.utils import orthonormalize, random_orthonormal, weighted_mean
def test_orthonormalize():
rand = np.random.RandomState(42)
X = rand.randn(3,... |
xc/xc7/tests/serdes/generate_tests.py | bl0x/symbiflow-arch-defs | 183 | 12785746 | #!/usr/bin/env python3
"""
Creates the header file for the OSERDES test with the correct configuration
of the DATA_WIDTH and DATA_RATE
"""
import argparse
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
'--input', required=True, help="Input top file to be gener... |
src/bitmessageqt/bitmessage_icons_rc.py | coffeedogs/PyBitmessage | 1,583 | 12785761 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Sa 21. Sep 13:45:58 2013
# by: The Resource Compiler for PyQt (Qt v4.8.4)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x03\x66\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x... |
mmaction/models/localizers/utils/__init__.py | HypnosXC/mmaction2 | 648 | 12785789 | from .post_processing import post_processing
__all__ = ['post_processing']
|
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py | Polidea/SiriusObfuscator | 427 | 12785793 | <reponame>Polidea/SiriusObfuscator
"""
Describe the purpose of the test class here.
"""
from __future__ import print_function
import os
import time
import re
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
class RenameThisSampleTestTestCase(TestBase):
mydir = TestB... |
keras/downstream_tasks/config.py | joeranbosma/ModelsGenesis | 574 | 12785813 | import os
import shutil
import csv
import random
class bms_config:
arch = 'Vnet'
# data
data = '/mnt/dataset/shared/zongwei/BraTS'
csv = "data/bms"
deltr = 30
input_rows = 64
input_cols = 64
input_deps = 32
crop_rows = 100
crop_cols = 100
crop_deps = 50
# mode... |
genomepy/annotation/__init__.py | vanheeringen-lab/genomepy | 146 | 12785816 | <reponame>vanheeringen-lab/genomepy<gh_stars>100-1000
"""Annotation class, modules & related functions"""
import os
import re
from pathlib import Path
from typing import Iterable, Optional, Union
import numpy as np
import pandas as pd
from loguru import logger
from genomepy.annotation.mygene import map_genes as _map_... |
mango-python/bdgenomics/mango/test/notebook_test.py | heuermh/mango | 120 | 12785846 | <reponame>heuermh/mango
#
# Licensed to Big Data Genomics (BDG) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The BDG licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); ... |
exercises/ja/exc_03_16_02.py | Jette16/spacy-course | 2,085 | 12785876 | <filename>exercises/ja/exc_03_16_02.py
import spacy
nlp = spacy.load("ja_core_news_sm")
text = (
"チックフィレイはジョージア州カレッジパークに本社を置く、"
"チキンサンドを専門とするアメリカのファストフードレストランチェーンです。"
)
# parserを無効化
with ____.____(____):
# テキストを処理する
doc = ____
# docの固有表現を表示
print(____)
|
lexos/managers/file_manager.py | WheatonCS/Lexos | 107 | 12785878 | <gh_stars>100-1000
import io
import os
import shutil
import zipfile
from os import makedirs
from os.path import join as pathjoin
from typing import List, Tuple, Dict
import numpy as np
import pandas as pd
from flask import request, send_file
import lexos.helpers.constants as constants
import lexos.helpers.general_fun... |
Python3/547.py | rakhi2001/ecom7 | 854 | 12785886 | __________________________________________________________________________________________________
sample 192 ms submission
class Solution:
def findCircleNum(self, M: List[List[int]]) -> int:
seen = set()
def visit_all_friends(i: int):
for friend_idx,is_friend in enumerate(M[i]):
... |
lambeq/text2diagram/spiders_reader.py | CQCL/lambeq | 131 | 12785935 | # Copyright 2021, 2022 Cambridge Quantum Computing Ltd.
#
# 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 la... |
RecoJets/JetAnalyzers/test/DijetRatioPlotExample_cfg.py | ckamtsikis/cmssw | 852 | 12785992 | <gh_stars>100-1000
# PYTHON configuration file.
# Description: Example of dijet ratio plot
# with corrected and uncorrected jets
# Author: <NAME>
# Date: 22 - November - 2009
import FWCore.ParameterSet.Config as cms
process = cms.Process("Ana")
process.load("FWCore.MessageService.MessageLogger_cfi")
... |
test/swift_project_test.py | Dan2552/SourceKittenSubl | 163 | 12786018 | from src import swift_project
from helpers import path_helper
import unittest
class TestSourceKitten(unittest.TestCase):
# Test with a simple project directory
# (i.e. without xcodeproj)
def test_source_files_simple_project(self):
project_directory = path_helper.monkey_example_directory()
... |
lib/exaproxy/icap/parser.py | oriolarcas/exaproxy | 124 | 12786041 | <reponame>oriolarcas/exaproxy
#!/usr/bin/env python
# encoding: utf-8
from .request import ICAPRequestFactory
from .response import ICAPResponseFactory
from .header import ICAPResponseHeaderFactory
class ICAPParser (object):
ICAPResponseHeaderFactory = ICAPResponseHeaderFactory
ICAPRequestFactory = ICAPRequestFactor... |
applications/camera_calibration/scripts/derive_jacobians.py | lingbo-yu/camera_calibration | 474 | 12786043 | import math
import sys
import time
from sympy import *
from sympy.solvers.solveset import nonlinsolve
from optimizer_builder import *
# ### Math functions ###
# Simple model for the fractional-part function used for bilinear interpolation
# which leaves the function un-evaluated. Ignores the discontinuities when
#... |
benchmarks/pydy_pendulum.py | Midnighter/symengine.py | 133 | 12786053 | <gh_stars>100-1000
import os
import time
import sys
sys.path = ["../sympy", "../pydy", "../symengine.py"] + sys.path
import sympy
import symengine
import pydy
from sympy.physics.mechanics.models import n_link_pendulum_on_cart
print(sympy.__file__)
print(symengine.__file__)
print(pydy.__file__)
if (len(sys.argv) > 1)... |
fssim_rqt_plugins/rqt_fssim_track_editor/src/rqt_fssim_track_editor/cone_editor.py | AhmedOsamaAgha/fssim | 200 | 12786063 | # AMZ-Driverless
# Copyright (c) 2018 Authors:
# - <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, ... |
concepts/numberRangeDouble.py | sixtysecondrevit/dynamoPython | 114 | 12786070 | <gh_stars>100-1000
"""
PYTHON RANGE: DOUBLE APPROACH
"""
__author__ = '<NAME> - <EMAIL>'
__twitter__ = '@solamour'
__version__ = '1.0.0'
# DEFINITION:
# Custom definition to build a function similar to our DesignScript
# float range
def floatRange( start, end, step ):
for number in xrange( end ):
yield... |
vilya/models/elastic/searcher.py | mubashshirjamal/code | 1,582 | 12786115 | <filename>vilya/models/elastic/searcher.py
# -*- coding: utf-8 -*-
from vilya.libs.search import code_client
class SearchEngine(object):
c = code_client
if not c.head():
c.put('')
@classmethod
def check_result(cls, result):
if result and not result.get('error'):
return T... |
supersqlite/third_party/_apsw/tools/docmissing.py | plasticity-admin/supersqlite | 1,520 | 12786148 | <reponame>plasticity-admin/supersqlite<filename>supersqlite/third_party/_apsw/tools/docmissing.py
# python
#
# See the accompanying LICENSE file.
#
# Find things that haven't been documented and should be or have been
# but don't exist.
import glob, sys
import apsw
retval=0
classes={}
for filename in glob.glob("do... |
exercises/es/test_03_14_03.py | Jette16/spacy-course | 2,085 | 12786194 | <reponame>Jette16/spacy-course
def test():
assert (
"patterns = list(nlp.pipe(people))" in __solution__
), "¿Estás usando nlp.pipe envuelto en una lista?"
__msg__.good(
"¡Buen trabajo! Ahora continuemos con un ejemplo práctico que usa nlp.pipe "
"para procesar documentos con metadat... |
py/jpy/ci/appveyor/dump-dlls.py | devinrsmith/deephaven-core | 210 | 12786219 | import psutil, os
p = psutil.Process(os.getpid())
for dll in p.memory_maps():
print(dll.path)
|
challenges/4.C.Absolute_Value/lesson_tests.py | pradeepsaiu/python-coding-challenges | 141 | 12786231 | import unittest
from main import *
class AbsoluteValueTests(unittest.TestCase):
def test_main(self):
self.assertIsInstance(absolute_value, int)
self.assertEqual(absolute_value, 42)
|
randopt/samplers.py | seba-1511/randopt | 115 | 12786260 | <gh_stars>100-1000
#!/usr/bin/env python
import random
import math
from . import RANDOPT_RNG
"""
Here we implement the sampling strategies.
"""
class Sampler(object):
"""
Base class for all samplers.
Note: This class should not be directly instanciated.
"""
def __init__(self, *args, **kwargs... |
sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models.py | rsdoherty/azure-sdk-for-python | 2,728 | 12786272 | <filename>sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/models/_models.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root ... |
qaforum/utils.py | UREDDY616/IIITVforum | 117 | 12786308 | <gh_stars>100-1000
import pytz
from datetime import datetime
from django.utils import timezone
from math import log
# uses a version of reddit score algorithm
# https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-work-ef111e33d0d9#.aef67efq1
def question_score(question):
creation_date = question.p... |
examples/graph_prediction/general_gnn.py | JonaBecher/spektral | 2,145 | 12786322 | """
This example implements the model from the paper
> [Design Space for Graph Neural Networks](https://arxiv.org/abs/2011.08843)<br>
> <NAME>, <NAME>, <NAME>
using the PROTEINS dataset.
The configuration at the top of the file is the best one identified in the
paper, and should work well for many different ... |
Chapter01/19_iterator_example.py | add54/ADMIN_SYS_PYTHON | 116 | 12786329 | <filename>Chapter01/19_iterator_example.py<gh_stars>100-1000
numbers = [10, 20, 30, 40]
numbers_iter = iter(numbers)
print(next(numbers_iter))
print(next(numbers_iter))
print(numbers_iter.__next__())
print(numbers_iter.__next__())
next(numbers_iter)
|
src/app/conf/static.py | denkasyanov/education-backend | 151 | 12786362 | <filename>src/app/conf/static.py
import os.path
from app.conf.boilerplate import BASE_DIR
from app.conf.environ import env
STATIC_URL = env('STATIC_URL', default='/static/')
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
tests/environment/test_custom_environment_provider.py | TheCodingLand/pyctuator | 118 | 12786367 | <gh_stars>100-1000
from typing import Dict
from pyctuator.environment.custom_environment_provider import CustomEnvironmentProvider
from pyctuator.environment.environment_provider import PropertyValue
def test_custom_environment_provider() -> None:
def produce_env() -> Dict:
return {
"a": "s1"... |
akshare/economic/macro_china_hk.py | J-Z-Z/akshare | 721 | 12786375 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2021/12/6 15:21
Desc: 中国-香港-宏观指标
https://data.eastmoney.com/cjsj/foreign_8_0.html
"""
import pandas as pd
import requests
from akshare.utils import demjson
def macro_china_hk_cpi() -> pd.DataFrame:
"""
东方财富-经济数据一览-中国香港-消费者物价指数
https://data.eastmoney.... |
chainercv/functions/ps_roi_max_align_2d.py | beam2d/chainercv | 1,600 | 12786392 | # Modified work:
# -----------------------------------------------------------------------------
# Copyright (c) 2019 Preferred Infrastructure, Inc.
# Copyright (c) 2019 Preferred Networks, Inc.
# -----------------------------------------------------------------------------
# Original work:
# -------------------------... |
draw_bar.py | IndexFziQ/nn4nlp-concepts | 440 | 12786471 | # import libraries
import matplotlib
matplotlib.use('Agg')
import pandas as pd
import matplotlib.pyplot as plt
import argparse
from collections import defaultdict
#%matplotlib inline
# set font
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = 'Helvetica'
# set the style of the axes and the... |
test/nose_test.py | fakeNetflix/uber-repo-doubles | 150 | 12786510 | <gh_stars>100-1000
import unittest
from nose.plugins import PluginTester
from doubles.nose import NoseIntegration
from doubles.instance_double import InstanceDouble
from doubles.targets.expectation_target import expect
def test_nose_plugin():
class TestNosePlugin(PluginTester, unittest.TestCase):
activa... |
python/ql/test/experimental/query-tests/Security/CWE-117/LogInjectionGood.py | madhurimamandal/codeql | 4,036 | 12786544 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Desc :Log Injection
"""
from flask import Flask
from flask import request
import logging
logging.basicConfig(level=logging.DEBUG)
app = Flask(__name__)
@app.route('/good1')
def good1():
name = request.args.get('name')
name = name.replace('\r\n','').replace... |
ckanext/example_theme/v14_more_custom_css/plugin.py | okfde/ckankrzn | 2,805 | 12786621 | <gh_stars>1000+
../v13_custom_css/plugin.py |
pybinding/greens.py | lise1020/pybinding | 159 | 12786624 | """Green's function computation and related methods
Deprecated: use the chebyshev module instead
"""
import warnings
from . import chebyshev
from .support.deprecated import LoudDeprecationWarning
__all__ = ['Greens', 'kpm', 'kpm_cuda']
Greens = chebyshev.KPM
def kpm(*args, **kwargs):
warnings.warn("Use pb.kpm(... |
src/debugpy/_vendored/pydevd/tests_python/resources/_debugger_case_source_mapping_and_reference.py | r3m0t/debugpy | 695 | 12786625 | def full_function():
# Note that this function is not called, it's there just to make the mapping explicit.
a = 1 # map to cEll1, line 2
b = 2 # map to cEll1, line 3
c = 3 # map to cEll2, line 2
d = 4 # map to cEll2, line 3
def create_code():
cell1_code = compile(''' # line 1
a = 1 # lin... |
wrappers/tensorflow/example5 - denoise.py | NobuoTsukamoto/librealsense | 6,457 | 12786662 | <reponame>NobuoTsukamoto/librealsense
import pyrealsense2 as rs
import numpy as np
import cv2
from tensorflow import keras
import time, sys
# Configure depth and color streams
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 848, 480, rs.format.z16, 30)
config.enable_stream(rs.stream... |
test/test_jump.py | mind-owner/Cyberbrain | 2,440 | 12786673 | from cyberbrain import Binding, InitialValue, Symbol
def test_jump(tracer, check_golden_file):
a = []
b = "b"
c = "c"
tracer.start()
if a: # POP_JUMP_IF_FALSE
pass # JUMP_FORWARD
else:
x = 1
if not a: # POP_JUMP_IF_TRUE
x = 2
x = a != b != c # JUMP_IF_FA... |
experiments/ukf_baseball.py | VladPodilnyk/Kalman-and-Bayesian-Filters-in-Python | 12,315 | 12786680 | <gh_stars>1000+
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 8 09:55:24 2015
@author: rlabbe
"""
from math import radians, sin, cos, sqrt, exp, atan2, radians
from numpy import array, asarray
from numpy.random import randn
import numpy as np
import math
import matplotlib.pyplot as plt
from filterpy.kalman import U... |
scaffold/generators/common.py | CaravelKit/saas-base | 189 | 12786683 | <reponame>CaravelKit/saas-base<filename>scaffold/generators/common.py
# Functions used all the generators
import os
# Check if file and path exist, if not, create them. Then rewrite file or add content at the
# beginning, commenting the existing part.
def create_write_file(file_path, new_content, rewrite = False, co... |
toollib/__init__.py | atpuxiner/toollib | 113 | 12786744 | <filename>toollib/__init__.py
"""
@author axiner
@version v1.0.0
@created 2021/12/12 13:14
@abstract This is a tool library.
@description
@history
"""
from pathlib import Path
here = Path(__file__).absolute().parent
__version__ = '2022.05.11'
|
tests/test_regression.py | weninc/bitshuffle-1 | 162 | 12786746 | """
Test that data encoded with earlier versions can still be decoded correctly.
"""
from __future__ import absolute_import, division, print_function
import pathlib
import unittest
import numpy as np
import h5py
TEST_DATA_DIR = pathlib.Path(__file__).parent / "data"
OUT_FILE_TEMPLATE = "regression_%s.h5"
VERSIO... |
tests/test_config.py | isidentical/unimport | 147 | 12786750 | <reponame>isidentical/unimport
import re
from pathlib import Path
from unittest import TestCase
from unimport import constants as C
from unimport import utils
from unimport.config import Config, DefaultConfig
TEST_DIR = Path(__file__).parent / "configs"
pyproject = TEST_DIR / "pyproject.toml"
setup_cfg = TEST_DIR / ... |
ghostwriter/rolodex/migrations/0013_projectsubtask_marked_complete.py | bbhunter/Ghostwriter | 601 | 12786759 | # Generated by Django 3.0.10 on 2021-02-11 21:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rolodex', '0012_auto_20210211_1853'),
]
operations = [
migrations.AddField(
model_name='projectsubtask',
name='mark... |
public-engines/iris-h2o-automl/marvin_iris_h2o_automl/training/metrics_evaluator.py | guialba/incubator-marvin | 101 | 12786771 | #!/usr/bin/env python
# coding=utf-8
"""MetricsEvaluator engine action.
Use this module to add the project main code.
"""
from .._compatibility import six
from .._logging import get_logger
from marvin_python_toolbox.engine_base import EngineBaseTraining
from ..model_serializer import ModelSerializer
__all__ = ['Me... |
pyscf/x2c/test/test_x2c_grad.py | robert-anderson/pyscf | 501 | 12786788 | #!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
vdb/extensions/arm.py | wisdark/vivisect | 716 | 12786801 | <reponame>wisdark/vivisect<gh_stars>100-1000
import envi
import envi.cli as e_cli
import envi.common as e_common
import envi.archs.arm.regs as e_arm_regs
import envi.archs.thumb16.disasm as e_thumb
def armdis(db, line):
'''
Disassemble arm instructions from the given address.
Usage: armdis <addr_exp>
... |
xmodaler/engine/rl_trainer.py | YehLi/xmodaler | 830 | 12786804 | # Copyright 2021 JD.com, Inc., JD AI
"""
@author: <NAME>
@contact: <EMAIL>
"""
import time
import copy
import torch
from .defaults import DefaultTrainer
from xmodaler.scorer import build_scorer
from xmodaler.config import kfg
from xmodaler.losses import build_rl_losses
import xmodaler.utils.comm as comm
fr... |
manifold_flow/flows/flow.py | selflein/manifold-flow | 199 | 12786819 | <reponame>selflein/manifold-flow
import logging
from manifold_flow.utils.various import product
from manifold_flow import distributions
from manifold_flow.flows import BaseFlow
logger = logging.getLogger(__name__)
class Flow(BaseFlow):
""" Ambient normalizing flow (AF) """
def __init__(self, data_dim, tran... |
glue/algorithms/square.py | glensc/glue | 514 | 12786832 | import copy
class SquareAlgorithmNode(object):
def __init__(self, x=0, y=0, width=0, height=0, used=False,
down=None, right=None):
"""Node constructor.
:param x: X coordinate.
:param y: Y coordinate.
:param width: Image width.
:param height: Image height.... |
Greedy/045. Jump Game II.py | beckswu/Leetcode | 138 | 12786861 |
class Solution:
def jump(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
if n<2: return 0
step, reach, next = 0, 0, 0
for i, v in enumerate(nums):
if i == reach:
reach = max(next, i+v)
... |
examples/eventTester.py | tgolsson/appJar | 666 | 12786863 | <filename>examples/eventTester.py
import sys
sys.path.append("../")
from appJar import gui
def press(btn):
print("default:", btn)
if btn == "writing":
app.setTextArea("t1", "some writing")
elif btn == "writing2":
app.setTextArea("t2", "some writing")
elif btn == "get":
print(app... |
pymagnitude/third_party/allennlp/tests/data/token_indexers/dep_label_indexer_test.py | tpeng/magnitude | 1,520 | 12786878 | <gh_stars>1000+
# pylint: disable=no-self-use,invalid-name
from __future__ import absolute_import
from collections import defaultdict
from allennlp.common.testing import AllenNlpTestCase
from allennlp.data import Token, Vocabulary
from allennlp.data.token_indexers import DepLabelIndexer
from allennlp.data.tokenizers.... |
examples/layout_form.py | pzahemszky/guizero | 320 | 12786913 | from guizero import App, Text, TextBox, Combo, PushButton, Box
app = App()
Text(app, text="My form")
form = Box(app, width="fill", layout="grid")
form.border = True
Text(form, text="Title", grid=[0,0], align="right")
TextBox(form, grid=[1,0])
Text(form, text="Name", grid=[0,1], align="right")
TextBox(form, grid=[1... |
api/tests/unit/telemetry/test_unit_telemetry_serializers.py | mevinbabuc/flagsmith | 1,259 | 12786937 | <reponame>mevinbabuc/flagsmith<filename>api/tests/unit/telemetry/test_unit_telemetry_serializers.py
from unittest import mock
from django.test import override_settings
from telemetry.serializers import TelemetrySerializer
from tests.unit.telemetry.helpers import get_example_telemetry_data
@override_settings(INFLUXDB... |
fetch_cord/computer/gpu/Gpu_interface.py | TabulateJarl8/FetchCord | 286 | 12786938 | # from __future__ import annotations
from abc import ABCMeta, abstractmethod
from typing import List, TypeVar, Dict
from ..Peripheral_interface import Peripherical_interface
class Gpu_interface(Peripherical_interface, metaclass=ABCMeta):
_vendor: str
_model: str
@property
def vendor(self) -> str:
... |
WebMirror/management/rss_parser_funcs/feed_parse_extractCgtranslationsMe.py | fake-name/ReadableWebProxy | 193 | 12786940 | <filename>WebMirror/management/rss_parser_funcs/feed_parse_extractCgtranslationsMe.py
def extractCgtranslationsMe(item):
'''
Parser for 'cgtranslations.me'
'''
if 'Manga' in item['tags']:
return None
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" i... |
probe/modules/antivirus/eset/eset_file_security.py | krisshol/bach-kmno | 248 | 12786944 | <filename>probe/modules/antivirus/eset/eset_file_security.py
#
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the to... |
examples/Plot_FibonacciLines.py | Physicworld/pyjuque | 343 | 12787019 | import os
import sys
curr_path = os.path.abspath(__file__)
root_path = os.path.abspath(
os.path.join(curr_path, os.path.pardir, os.path.pardir))
sys.path.append(root_path)
from pyjuque.Exchanges.CcxtExchange import CcxtExchange
from pyjuque.Plotting import PlotData
import plotly.graph_objs as go
def horizontal_lin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.