repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
Inrixia/pyais
examples/single_message.py
b50fd4d75c687d71b3c70ee939ac9112cfec991e
from pyais.messages import NMEAMessage message = NMEAMessage(b"!AIVDM,1,1,,B,15M67FC000G?ufbE`FepT@3n00Sa,0*5C") print(message.decode()) # or message = NMEAMessage.from_string("!AIVDM,1,1,,B,15M67FC000G?ufbE`FepT@3n00Sa,0*5C") print(message.decode())
[((50, 113), 'pyais.messages.NMEAMessage', 'NMEAMessage', (["b'!AIVDM,1,1,,B,15M67FC000G?ufbE`FepT@3n00Sa,0*5C'"], {}), "(b'!AIVDM,1,1,,B,15M67FC000G?ufbE`FepT@3n00Sa,0*5C')\n", (61, 113), False, 'from pyais.messages import NMEAMessage\n'), ((155, 229), 'pyais.messages.NMEAMessage.from_string', 'NMEAMessage.from_string...
sercangul/HackerRank
30_days_of_code_10.py
e6d7056babe03baafee8d7f1cacdca7c28b72ded
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 3 19:02:33 2019 @author: sercangul """ def maxConsecutiveOnes(x): # Initialize result count = 0 # Count the number of iterations to # reach x = 0. while (x!=0): # This operation reduces length ...
[]
artap-framework/artap
artap/algorithm_cmaes.py
7e4b01abbe5ca0fce9fa87a1a307ebd11ace36b4
import numpy as np from .problem import Problem from .algorithm_genetic import GeneralEvolutionaryAlgorithm from .individual import Individual from .operators import CustomGenerator, nondominated_truncate, RandomGenerator, UniformGenerator import time class CMA_ES(GeneralEvolutionaryAlgorithm): """ Implementa...
[((2477, 2538), 'numpy.random.uniform', 'np.random.uniform', (['self.min_val', 'self.max_val', 'self.dim_theta'], {}), '(self.min_val, self.max_val, self.dim_theta)\n', (2494, 2538), True, 'import numpy as np\n'), ((2591, 2656), 'numpy.random.uniform', 'np.random.uniform', (['(self.max_val - 1)', 'self.max_val', 'self....
hagino3000/apns-proxy-client-py
apns_proxy_client/core.py
b5ce34be940a8f8a990dc369e293408380d0c359
# -*- coding: utf-8 -*- """ APNS Proxy Serverのクライアント """ import time import zmq import simplejson as json READ_TIMEOUT = 1500 # msec FLUSH_TIMEOUT = 5000 # msec COMMAND_ASK_ADDRESS = b'\1' COMMAND_SEND = b'\2' COMMAND_FEEDBACK = b'\3' DEVICE_TOKEN_LENGTH = 64 JSON_ALERT_KEY_SET = set(['body', 'action_loc_key', ...
[((784, 797), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (795, 797), False, 'import zmq\n'), ((1749, 1761), 'zmq.Poller', 'zmq.Poller', ([], {}), '()\n', (1759, 1761), False, 'import zmq\n'), ((4626, 4637), 'time.time', 'time.time', ([], {}), '()\n', (4635, 4637), False, 'import time\n'), ((4679, 4690), 'time.time...
svetlanama/snowball
003_joint_probabilities.py
a41865a866dae124b4a22134f091a7d09bd0896e
import sys sys.path.insert(0, '..') import numpy import time import ConfigParser import topicmodel def main(): # read configuration file config = ConfigParser.ConfigParser() config.readfp(open('config.ini')) dataDir = config.get('main', 'dataDir') io = topicmodel.io(dataDir) model ...
[]
FirebirdSQL/firebird-qa
tests/bugs/core_4318_test.py
96af2def7f905a06f178e2a80a2c8be4a4b44782
#coding:utf-8 # # id: bugs.core_4318 # title: Regression: Predicates involving PSQL variables/parameters are not pushed inside the aggregation # decription: # tracker_id: CORE-4318 # min_versions: ['3.0'] # versions: 3.0 # qmid: None import pytest from firebird.qa import db_factory, i...
[((1292, 1353), 'firebird.qa.db_factory', 'db_factory', ([], {'page_size': '(4096)', 'sql_dialect': '(3)', 'init': 'init_script_1'}), '(page_size=4096, sql_dialect=3, init=init_script_1)\n', (1302, 1353), False, 'from firebird.qa import db_factory, isql_act, Action\n'), ((2113, 2175), 'firebird.qa.isql_act', 'isql_act'...
WilliamHackspeare/profanity-percentage
dictionary.py
4aab708620b7543a2a5cb30c9cee8404dcc836cb
#Import the json library to parse JSON file to Python import json #Import list of punctuation characters from the string library from string import punctuation as p #This method checks if the given word is a profanity def is_profanity(word): #Open the JSON file words_file = open('data.json') #Parse the JSON f...
[((377, 398), 'json.load', 'json.load', (['words_file'], {}), '(words_file)\n', (386, 398), False, 'import json\n')]
cyfrmedia/cerridwen
setup.py
6ac9193d41d7c6fdea0abab5e5f207132844fb4e
from setuptools import setup import os here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() #NEWS = open(os.path.join(here, 'NEWS.txt')).read() rootdir = os.path.dirname(os.path.abspath(__file__)) exec(open(rootdir + '/cerridwen/version.py').read()) version = __VERS...
[((327, 1385), 'setuptools.setup', 'setup', ([], {'name': '"""cerridwen"""', 'version': 'version', 'description': '"""Accurate solar system data for everyone"""', 'long_description': 'README', 'author': '"""Leslie P. Polzer"""', 'author_email': '"""polzer@fastmail.com"""', 'url': '"""http://cerridwen.bluemagician.vc/""...
JoachimFlottorp/pajbot
pajbot/apiwrappers/authentication/access_token.py
4fb88c403dedb20d95be80e38da72be1ed064901
import datetime from abc import ABC, abstractmethod import pajbot class AccessToken(ABC): SHOULD_REFRESH_THRESHOLD = 0.9 """Fraction between 0 and 1 indicating what fraction/percentage of the specified full validity period should actually be utilized. E.g. if this is set to 0.9, the implementation will ...
[((1530, 1557), 'datetime.timedelta', 'datetime.timedelta', ([], {'hours': '(1)'}), '(hours=1)\n', (1548, 1557), False, 'import datetime\n'), ((1635, 1653), 'pajbot.utils.now', 'pajbot.utils.now', ([], {}), '()\n', (1651, 1653), False, 'import pajbot\n'), ((2662, 2718), 'datetime.timedelta', 'datetime.timedelta', ([], ...
RadicalAjay/Ghost_data
GHOST.py
b151b0b92d27c3b8454e28d4f037eafb587d7b23
#! /usr/bin/python3 # Description: Data_Ghost, concealing data into spaces and tabs making it imperceptable to human eyes. # Author: Ajay Dyavathi # Github: Radical Ajay class Ghost(): def __init__(self, file_name, output_format='txt'): ''' Converts ascii text to spaces and tabs ''' self.file_name...
[]
ychu196/chicago_scan
scan_predict.py
ed5f32a9f27fd5b9350cb3232a2631c3aaa60744
# Image classification using AWS Sagemaker and Linear Learner # Program set up and import libraries import numpy as np import pandas as pd import os from sagemaker import get_execution_role role = get_execution_role() bucket = 'chi-hackathon-skin-images' # Import Data import boto3 from sagemaker import get_execution...
[((199, 219), 'sagemaker.get_execution_role', 'get_execution_role', ([], {}), '()\n', (217, 219), False, 'from sagemaker import get_execution_role\n'), ((334, 354), 'sagemaker.get_execution_role', 'get_execution_role', ([], {}), '()\n', (352, 354), False, 'from sagemaker import get_execution_role\n'), ((533, 560), 'pan...
FixturFab/pcb-tools
gerber/am_statements.py
7b8d1c6ccd9c242c162ede47557bb816233cf66f
#!/usr/bin/env python # -*- coding: utf-8 -*- # copyright 2015 Hamilton Kibbe <ham@hamiltonkib.be> and Paulo Henrique Silva # <ph.silva@gmail.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...
[((26154, 26189), 'math.asin', 'asin', (['(self.gap / 2.0 / inner_radius)'], {}), '(self.gap / 2.0 / inner_radius)\n', (26158, 26189), False, 'from math import asin\n'), ((26219, 26254), 'math.asin', 'asin', (['(self.gap / 2.0 / outer_radius)'], {}), '(self.gap / 2.0 / outer_radius)\n', (26223, 26254), False, 'from mat...
DeividVM/heroquest
heroquest/migrations/0002_auto_20160819_1747.py
c693d664717a849de645908ae78d62ec2a5837a5
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2016-08-19 17:47 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('heroquest', '0001_initial'), ] operations = [ migrations.RemoveField( ...
[((290, 347), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""player"""', 'name': '"""armor"""'}), "(model_name='player', name='armor')\n", (312, 347), False, 'from django.db import migrations, models\n'), ((492, 585), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (...
epervago/dask
dask/array/utils.py
958732ce6c51ef6af39db4727d948bfa66a0a8d6
from distutils.version import LooseVersion import difflib import os import numpy as np from .core import Array from ..async import get_sync if LooseVersion(np.__version__) >= '1.10.0': allclose = np.allclose else: def allclose(a, b, **kwargs): if kwargs.pop('equal_nan', False): a_nans = np...
[]
inniyah/launchpad-py
launchpad_py/__init__.py
b8dd4815b05d7e75ba5ca09ced64ddc38f515bad
# more specific selections for Python 3 (ASkr, 2/2018) from launchpad_py.launchpad import Launchpad from launchpad_py.launchpad import LaunchpadMk2 from launchpad_py.launchpad import LaunchpadPro from launchpad_py.launchpad import LaunchControlXL from launchpad_py.launchpad import LaunchKeyMini from launchpad_py.launch...
[]
EvoCargo/mono_depth
networks/adabins/utils.py
3a77291a7fc8f3eaad5f93aa17e2b60c9339a0b1
import base64 import math import re from io import BytesIO import matplotlib.cm import numpy as np import torch import torch.nn from PIL import Image # Compute edge magnitudes from scipy import ndimage class RunningAverage: def __init__(self): self.avg = 0 self.count = 0 ...
[((2040, 2072), 'numpy.maximum', 'np.maximum', (['(gt / pred)', '(pred / gt)'], {}), '(gt / pred, pred / gt)\n', (2050, 2072), True, 'import numpy as np\n'), ((2249, 2279), 'numpy.mean', 'np.mean', (['((gt - pred) ** 2 / gt)'], {}), '((gt - pred) ** 2 / gt)\n', (2256, 2279), True, 'import numpy as np\n'), ((2891, 2938)...
simbilod/gdsfactory
gdsfactory/types.py
4d76db32674c3edb4d16260e3177ee29ef9ce11d
"""In programming, a factory is a function that returns an object. Functions are easy to understand because they have clear inputs and outputs. Most gdsfactory functions take some inputs and return a Component object. Some of these inputs parameters are also functions. - Component: Object with. - name. - refe...
[((2114, 2164), 'typing.NewType', 'NewType', (['"""LayerSpec"""', 'Union[Layer, int, str, None]'], {}), "('LayerSpec', Union[Layer, int, str, None])\n", (2121, 2164), False, 'from typing import Any, Callable, Dict, List, NewType, Optional, Tuple, Union\n'), ((2940, 3025), 'typing.NewType', 'NewType', (['"""ComponentSpe...
ahmetdaglarbas/e-commerce
tests/_site/myauth/models.py
ff190244ccd422b4e08d7672f50709edcbb6ebba
# -*- coding: utf-8 -*- # Code will only work with Django >= 1.5. See tests/config.py import re from django.utils.translation import ugettext_lazy as _ from django.db import models from django.core import validators from django.contrib.auth.models import BaseUserManager from oscar.apps.customer.abstract_models impor...
[((1208, 1221), 'django.utils.translation.ugettext_lazy', '_', (['"""username"""'], {}), "('username')\n", (1209, 1221), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1556, 1576), 'django.utils.translation.ugettext_lazy', '_', (['"""Nobody needs me"""'], {}), "('Nobody needs me')\n", (1557, 1576...
brouwa/CNNs-on-FPSPs
5 - FC layers retraining/4 - FC weights to C++ code/weights_pck_to_cpp_unrolled_loop.py
71bcc2335e6d71ad21ba66e04a651d4db218356d
import pickle import numpy as np INPUT_FILENAME = 'NP_WEIGHTS.pck' PRECISION = 100 # Open weights fc1_k, fc1_b, fc2_k, fc2_b = pickle.load( open(INPUT_FILENAME, 'rb')) # Round them fc1_k, fc1_b, fc2_k, fc2_b = fc1_k*PRECISION//1, fc1_b*PRECISION//1, fc2_k*PRECISION//1, fc2_b*PRECISION*PRECISION//1 fc1_k, fc1_b, f...
[]
yubaoliu/Computer-Vision
python/Canny_EdgeDetection.py
2fe4d3e1db0a65ef8c9def5f84d5e494bec3faa9
import cv2 import numpy as np import random img = cv2.imread('../../Assets/Images/flower-white.jpeg', 1) imgInfo = img.shape height = imgInfo[0] width = imgInfo[1] cv2.imshow('img', img) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) imgG = cv2.GaussianBlur(gray, (3, 3), 0) dst = cv2.Canny(img, 50, 50) cv2.imshow(...
[((52, 106), 'cv2.imread', 'cv2.imread', (['"""../../Assets/Images/flower-white.jpeg"""', '(1)'], {}), "('../../Assets/Images/flower-white.jpeg', 1)\n", (62, 106), False, 'import cv2\n'), ((168, 190), 'cv2.imshow', 'cv2.imshow', (['"""img"""', 'img'], {}), "('img', img)\n", (178, 190), False, 'import cv2\n'), ((199, 23...
Guoxs/DODT
avod/core/trainer_stride.py
f354cda6ef08465018fdeec1a8b4be4002e6a71f
"""Detection model trainer. This file provides a generic training method to train a DetectionModel. """ import datetime import os import tensorflow as tf import time from avod.builders import optimizer_builder from avod.core import trainer_utils from avod.core import summary_utils slim = tf.contrib.slim def train(m...
[((759, 810), 'tensorflow.Variable', 'tf.Variable', (['(0)'], {'trainable': '(False)', 'name': '"""global_step"""'}), "(0, trainable=False, name='global_step')\n", (770, 810), True, 'import tensorflow as tf\n'), ((2410, 2499), 'avod.builders.optimizer_builder.build', 'optimizer_builder.build', (['train_config.optimizer...
nickc92/django-rest-framework-hmac
rest_framework_hmac/hmac_key/models.py
c32e37cf00ef0c13957a6e02eb0a7fabac3d1ac1
import binascii import os from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ class HMACKey(models.Model): """ The default HMACKey model that can auto generate a key/secret for HMAC Auth via a signal """ def generate_key(): ...
[((822, 855), 'django.db.models.BigIntegerField', 'models.BigIntegerField', ([], {'default': '(1)'}), '(default=1)\n', (844, 855), False, 'from django.db import models\n'), ((501, 509), 'django.utils.translation.ugettext_lazy', '_', (['"""Key"""'], {}), "('Key')\n", (502, 509), True, 'from django.utils.translation impo...
Geoiv/river
test/conftest.py
d013985145c09f263172b054819e811689002ae9
import os from tempfile import NamedTemporaryFile import boto3 from moto import mock_s3 import pandas as pd import pandavro as pdx import pickle import pytest @pytest.fixture(autouse=True, scope='session') def aws_credentials(): """ Sets AWS credentials to invalid values. Applied to all test functions and ...
[((163, 208), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)', 'scope': '"""session"""'}), "(autouse=True, scope='session')\n", (177, 208), False, 'import pytest\n'), ((1854, 1957), 'pandas.DataFrame', 'pd.DataFrame', (["{'intcol': [1, 2, 3], 'strcol': ['four', 'five', 'six'], 'floatcol': [7.0, \n 8.5,...
uktrade/directory-api
company/migrations/0021_auto_20161208_1113.py
45a9024a7ecc2842895201cbb51420ba9e57a168
# -*- coding: utf-8 -*- # Generated by Django 1.9.10 on 2016-12-08 11:13 from __future__ import unicode_literals from django.db import migrations from company import helpers def ensure_verification_code(apps, schema_editor): Company = apps.get_model("company", "Company") for company in Company.objects.filte...
[((381, 417), 'company.helpers.generate_verification_code', 'helpers.generate_verification_code', ([], {}), '()\n', (415, 417), False, 'from company import helpers\n'), ((587, 633), 'django.db.migrations.RunPython', 'migrations.RunPython', (['ensure_verification_code'], {}), '(ensure_verification_code)\n', (607, 633), ...
Toktar/indy-test-automation
system/indy-node-tests/TestAuthMapSuite.py
4d583dda7cbf2a9f451b3a01312a90e55c7bacc8
import pytest import asyncio from system.utils import * from random import randrange as rr import hashlib import time from datetime import datetime, timedelta, timezone from indy import payment import logging logger = logging.getLogger(__name__) @pytest.mark.usefixtures('docker_setup_and_teardown') class TestAuthMa...
[((220, 247), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (237, 247), False, 'import logging\n'), ((251, 303), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""docker_setup_and_teardown"""'], {}), "('docker_setup_and_teardown')\n", (274, 303), False, 'import pytest\n'), ((33...
jgough/opensearch-curator
test/integration/test_reindex.py
e8d7eb4d969eac551db9f99bd021d0c05e28dc35
import opensearchpy import curator import os import json import string import random import tempfile import click from click import testing as clicktest import time from . import CuratorTestCase from unittest.case import SkipTest from . import testvars as testvars import logging logger = logging.getLogger(__name__) ...
[((291, 318), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (308, 318), False, 'import logging\n'), ((335, 385), 'os.environ.get', 'os.environ.get', (['"""TEST_ES_SERVER"""', '"""localhost:9200"""'], {}), "('TEST_ES_SERVER', 'localhost:9200')\n", (349, 385), False, 'import os\n'), ((414,...
naivekun/libhustpass
libhustpass/login.py
d8d487e3af996898e4a7b21b924fbf0fc4fbe419
import libhustpass.sbDes as sbDes import libhustpass.captcha as captcha import requests import re import random def toWideChar(data): data_bytes = bytes(data, encoding="utf-8") ret = [] for i in data_bytes: ret.extend([0, i]) while len(ret) % 8 != 0: ret.append(0) return ret def En...
[((1293, 1311), 'requests.session', 'requests.session', ([], {}), '()\n', (1309, 1311), False, 'import requests\n'), ((1758, 1796), 'libhustpass.captcha.deCaptcha', 'captcha.deCaptcha', (['captcha_content.raw'], {}), '(captcha_content.raw)\n', (1775, 1796), True, 'import libhustpass.captcha as captcha\n'), ((704, 745),...
Asadullah-Dal17/contours-detection-advance
code/contours_sorting_by_area.py
45522492363cc01cb8c66b18790b1859c4efe44d
import cv2 as cv import numpy as np def areaFinder(contours): areas = [] for c in contours: a =cv.contourArea(c) areas.append(a) return areas def sortedContoursByArea(img, larger_to_smaller=True): edges_img = cv.Canny(img, 100, 150) contours , h = cv.findContours(edges_img, cv.RETR_...
[((474, 512), 'cv2.imread', 'cv.imread', (['"""./Images/sample-image.png"""'], {}), "('./Images/sample-image.png')\n", (483, 512), True, 'import cv2 as cv\n'), ((757, 779), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}), '()\n', (777, 779), True, 'import cv2 as cv\n'), ((242, 265), 'cv2.Canny', 'cv.Canny', (...
ChrisRBXiong/MatchZoo-py
matchzoo/metrics/precision.py
8883d0933a62610d71fec0215dce643630e03b1c
"""Precision for ranking.""" import numpy as np from matchzoo.engine.base_metric import ( BaseMetric, sort_and_couple, RankingMetric ) class Precision(RankingMetric): """Precision metric.""" ALIAS = 'precision' def __init__(self, k: int = 1, threshold: float = 0.): """ :class:`Preci...
[((1537, 1568), 'matchzoo.engine.base_metric.sort_and_couple', 'sort_and_couple', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (1552, 1568), False, 'from matchzoo.engine.base_metric import BaseMetric, sort_and_couple, RankingMetric\n')]
forkunited/ltprg
src/main/py/ltprg/config/seq.py
4e40d3571d229023df0f845c68643024e04bc202
from mung.torch_ext.eval import Loss from ltprg.model.seq import DataParameter, SequenceModelNoInput, SequenceModelInputToHidden, SequenceModelAttendedInput from ltprg.model.seq import VariableLengthNLLLoss # Expects config of the form: # { # data_parameter : { # seq : [SEQUENCE PARAMETER NAME] # inp...
[((1060, 1106), 'ltprg.model.seq.DataParameter.make', 'DataParameter.make', ([], {}), "(**config['data_parameter'])\n", (1078, 1106), False, 'from ltprg.model.seq import DataParameter, SequenceModelNoInput, SequenceModelInputToHidden, SequenceModelAttendedInput\n'), ((3436, 3482), 'ltprg.model.seq.DataParameter.make', ...
sigseg5/nometa-tg
src/Utilities/metadata_worker.py
7d0d9f0cf5d8fd98a3808c07a5c44d30f1b13032
from shutil import move import piexif from PIL import Image def delete_metadata(full_path_to_img): """ This function used for remove metadata only from documents, if you send image 'as image' Telegram automatically removes all metadata at sending. This function removes all metadata via 'piexif' lib, save...
[((493, 543), 'piexif.remove', 'piexif.remove', (['full_path_to_img', '"""clean_image.jpg"""'], {}), "(full_path_to_img, 'clean_image.jpg')\n", (506, 543), False, 'import piexif\n'), ((548, 600), 'shutil.move', 'move', (['"""clean_image.jpg"""', '"""documents/clean_image.jpg"""'], {}), "('clean_image.jpg', 'documents/c...
pbarton666/virtual_classroom
dkr-py310/docker-student-portal-310/course_files/begin_advanced/py_unit_2.py
a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675
#py_unit_2.py import unittest class FirstTest(unittest.TestCase): def setUp(self): "setUp() runs before every test" self.msg="Sorry, Charlie, but {} is not the same as {}." def tearDown(self): "tearDown runs after every test" pass def test_me(self): "this test should pass" first=1 second=2 self.asse...
[((750, 765), 'unittest.main', 'unittest.main', ([], {}), '()\n', (763, 765), False, 'import unittest\n')]
Sciocatti/python_scheduler_and_clean_forced_exit
src/scheduled_task/__init__.py
4e5373ba33798c08096087058773412257230662
from .scheduled_task import ScheduledTask
[]
davidnegrazis/PyPlayText-Workshop
scripts/game.py
70156b73c1d2ab52daaef839b72450e331ff1e80
from sys import exit # ------------------------------------------------------------------------------ global dev_name global game_title dev_name = "" # enter your name in the quotes! game_title = "" # enter the game title in the quotes! # ------------------------------------------------------------------------------ ...
[((1008, 1015), 'sys.exit', 'exit', (['(0)'], {}), '(0)\n', (1012, 1015), False, 'from sys import exit\n')]
moheed/algo
lc1108_defangip.py
921bb55852fa49d97e469694a64bffe6c285319e
class Solution: def defangIPaddr(self, address: str) -> str: i=0 j=0 strlist=list(address) defang=[] while i< len(strlist): if strlist[i] == '.': defang.append('[') defang.append('.') defang.append(']') ...
[]
gregbunce/assign_vista_pcts_to_sgid_addrpnts
src/elections_address_files/commands/zip_files.py
c1a3210e68c8c1e94c0b68547d0c26697de77ff7
import os, zipfile # Zip files. def zipfiles(directory): # File extension to zip. #ext = ('.gdb', '.csv') ext = ('.gdb') # Iterate over all files and check for desired extentions for zipping. for file in os.listdir(directory): if file.endswith(ext): #: Zip it. ...
[((233, 254), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (243, 254), False, 'import os, zipfile\n'), ((633, 668), 'os.path.basename', 'os.path.basename', (['full_path_to_fgdb'], {}), '(full_path_to_fgdb)\n', (649, 668), False, 'import os, zipfile\n'), ((687, 776), 'zipfile.ZipFile', 'zipfile.ZipF...
erezsh/tartiflette
tartiflette/parser/nodes/node.py
c945b02e9025e2524393c1eaec2191745bfc38f4
class Node: def __init__(self, path, libgraphql_type, location, name): self.path = path self.parent = None self.children = [] self.libgraphql_type = libgraphql_type self.location = location self.name = name def __repr__(self): return "%s(%s)" % (self.libg...
[]
yuyiming/mars
mars/services/web/tests/test_core.py
5e6990d1ea022444dd646c56697e596ef5d7e747
# Copyright 1999-2021 Alibaba Group Holding 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 law or a...
[((2212, 2261), 'os.environ.get', 'os.environ.get', (['"""POOL_START_METHOD"""', '"""forkserver"""'], {}), "('POOL_START_METHOD', 'forkserver')\n", (2226, 2261), False, 'import os\n'), ((4441, 4476), 'pytest.raises', 'pytest.raises', (['httpclient.HTTPError'], {}), '(httpclient.HTTPError)\n', (4454, 4476), False, 'impo...
caizhanjin/deepseg
test/test.py
5e91a387683ad73075b51b49da8957d8f4bb6b7f
""" 例子为MNIST,对手写图片进行分类。 神经网络hello world。 """ import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) # 封装网络用到的API def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf....
[((155, 208), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MNIST_data"""'], {'one_hot': '(True)'}), "('MNIST_data', one_hot=True)\n", (180, 208), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((819, 842), 'tensorflow.InteractiveSession', '...
jwvhewitt/gearhead-caramel
game/content/ghplots/lancemates.py
dfe1bc5dbf2960b82a97577f4bf687b60040d8bf
import pbge from game.content.plotutility import LMSkillsSelfIntro from game.content import backstory from pbge.plots import Plot from pbge.dialogue import Offer, ContextTag from game.ghdialogue import context import gears import game.content.gharchitecture import game.content.ghterrain import random from game import m...
[((4839, 4859), 'random.randint', 'random.randint', (['(1)', '(4)'], {}), '(1, 4)\n', (4853, 4859), False, 'import random\n'), ((8555, 8597), 'random.choice', 'random.choice', (['gears.personality.MUTATIONS'], {}), '(gears.personality.MUTATIONS)\n', (8568, 8597), False, 'import random\n'), ((11591, 11662), 'gears.relat...
zzzzzz0407/detectron2
projects/detr/scripts/dd.py
021fc5b1502bbba54e4714735736898803835ab0
import json if __name__ == '__main__': jsonFile = '/data00/home/zhangrufeng1/projects/detectron2/projects/detr/datasets/mot/mot17/annotations/mot17_train_half.json' with open(jsonFile, 'r') as f: infos = json.load(f) count_dict = dict() for info in infos["images"]: if info["file_name"]...
[]
wesleibarboza/natasha-virtual
app/app.py
74c5ef9a4db5ce98dd72499d40775bfd65d34974
# -*- coding: utf-8 -*- """Archivo principal para el echobot. Main File for the echobot""" from fbmq import Page from flask import Flask, request # Token generado por la página web. Generated token in the facebook web page PAGE_ACCESS_TOKEN = "COPY_HERE_YOUR_PAGE_ACCES_TOKEN" # Token generado por nosotros. Token gener...
[((554, 569), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (559, 569), False, 'from flask import Flask, request\n'), ((577, 600), 'fbmq.Page', 'Page', (['PAGE_ACCESS_TOKEN'], {}), '(PAGE_ACCESS_TOKEN)\n', (581, 600), False, 'from fbmq import Page\n'), ((1289, 1319), 'flask.request.get_data', 'request.get...
Water2style/FCN-pytorch-CanRun
Camvid/CamVid_utlis.py
b2994f98930580cd2c32f58d19f94becb68a3ccb
# -*- coding: utf-8 -*- from __future__ import print_function from matplotlib import pyplot as plt import matplotlib.image as mpimg import numpy as np import scipy.misc import random import os import imageio ############################# # global variables # ############################# root_dir = "/ho...
[((369, 413), 'os.path.join', 'os.path.join', (['root_dir', '"""701_StillsRaw_full"""'], {}), "(root_dir, '701_StillsRaw_full')\n", (381, 413), False, 'import os\n'), ((450, 496), 'os.path.join', 'os.path.join', (['root_dir', '"""LabeledApproved_full"""'], {}), "(root_dir, 'LabeledApproved_full')\n", (462, 496), False,...
patrik999/AdaptiveStreamReasoningMonitoring
stream-reasoner/ws_client.py
7bbfa1a394e0127e0c4ea670a632be216c83faea
#!/usr/bin/env python import websocket import time try: import thread except ImportError: import _thread as thread runs = 100 def on_message(ws, message): print(message) def on_error(ws, error): print(error) def on_close(ws): print("### closed ###") def on_open(ws): ...
[((513, 545), '_thread.start_new_thread', 'thread.start_new_thread', (['run', '()'], {}), '(run, ())\n', (536, 545), True, 'import _thread as thread\n'), ((585, 612), 'websocket.enableTrace', 'websocket.enableTrace', (['(True)'], {}), '(True)\n', (606, 612), False, 'import websocket\n'), ((658, 750), 'websocket.WebSock...
samuelterra22/Data-Mining
Main.py
0237bc6e86f28f7bf1306dfb60c41987f5e41bbd
import pandas as pd import matplotlib.pyplot as plt import numpy as np import scipy.stats as stats import seaborn as sns from matplotlib import rcParams import statsmodels.api as sm from statsmodels.formula.api import ols df = pd.read_csv('kc_house_data.csv') # print(df.head()) # print(df.isnull().any()) # print(df.d...
[((228, 260), 'pandas.read_csv', 'pd.read_csv', (['"""kc_house_data.csv"""'], {}), "('kc_house_data.csv')\n", (239, 260), True, 'import pandas as pd\n'), ((836, 924), 'seaborn.jointplot', 'sns.jointplot', ([], {'x': '"""sqft_living"""', 'y': '"""price"""', 'data': 'df', 'kind': '"""reg"""', 'fit_reg': '(True)', 'size':...
11uc/whole_cell_patch
whole_cell_patch/filterDialog.py
84e11bbb904b363a6bb5af878d46e23d789c5be0
# Dialogs for setting filter parameters. from PyQt5.QtWidgets import QLabel, QGridLayout, QPushButton, \ QLineEdit, QVBoxLayout, QHBoxLayout, QDialog, QComboBox, QWidget from PyQt5.QtCore import pyqtSignal class FilterDialog(QDialog): ''' Dialog for choosing filter types. ''' def __init__(self, default, parent ...
[((795, 810), 'PyQt5.QtWidgets.QComboBox', 'QComboBox', (['self'], {}), '(self)\n', (804, 810), False, 'from PyQt5.QtWidgets import QLabel, QGridLayout, QPushButton, QLineEdit, QVBoxLayout, QHBoxLayout, QDialog, QComboBox, QWidget\n'), ((842, 857), 'PyQt5.QtWidgets.QComboBox', 'QComboBox', (['self'], {}), '(self)\n', (...
zl930216/ParlAI
projects/controllable_dialogue/tasks/agents.py
abf0ad6d1779af0f8ce0b5aed00d2bab71416684
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy from .build import build, make_path from parlai.utils.misc import warn_once from parlai.core.teachers import...
[((454, 525), 'parlai.utils.misc.warn_once', 'warn_once', (['"""WARNING: Test set not included. Setting datatype to valid."""'], {}), "('WARNING: Test set not included. Setting datatype to valid.')\n", (463, 525), False, 'from parlai.utils.misc import warn_once\n'), ((699, 717), 'copy.deepcopy', 'copy.deepcopy', (['opt...
davisschenk/project-euler-python
problems/p009.py
1375412e6c8199ab02250bd67223c758d4df1725
from math import ceil, sqrt from problem import Problem from utils.math import gcd class PythagoreanTriplet(Problem, name="Special Pythagorean triplet", expected=31875000): @Problem.solution() def brute_force(self, ts=1000): for a in range(3, round((ts - 3) / 2)): for b in range(a + 1, ro...
[((181, 199), 'problem.Problem.solution', 'Problem.solution', ([], {}), '()\n', (197, 199), False, 'from problem import Problem\n'), ((462, 480), 'problem.Problem.solution', 'Problem.solution', ([], {}), '()\n', (478, 480), False, 'from problem import Problem\n'), ((563, 571), 'math.sqrt', 'sqrt', (['s2'], {}), '(s2)\n...
murbanec/Roche2D
Roche.py
a4d7e85e893fd6f18c12b682c2c8ca33b2b549a6
# -*- coding: utf-8 -*- """ Created on Thu Jan 14 10:37:04 2021 @author: martin urbanec """ #calculates trajectory of small mass positioned close to L4 Lagrange point #creates gif as output import math import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation, PillowWriter ...
[((503, 536), 'math.sqrt', 'math.sqrt', (['(G * (M1 + M2) / a ** 3)'], {}), '(G * (M1 + M2) / a ** 3)\n', (512, 536), False, 'import math\n'), ((1957, 1974), 'numpy.vectorize', 'np.vectorize', (['pot'], {}), '(pot)\n', (1969, 1974), True, 'import numpy as np\n'), ((2178, 2203), 'numpy.linspace', 'np.linspace', (['(0)',...
LyleH/youtube-dl
youtube_dl/extractor/azubu.py
7564b09ef5c09454908f78cb91c3bd2d6daacac5
from __future__ import unicode_literals import json from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, sanitized_Request, ) class AzubuIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?azubu\.tv/[^/]+#!/play/(?P<id>\d+)' _TESTS = [ { 'ur...
[((2326, 2359), 'json.loads', 'json.loads', (["data['stream_params']"], {}), "(data['stream_params'])\n", (2336, 2359), False, 'import json\n')]
dan-blanchard/conda-build
conda_build/main_develop.py
2db31bb2c48d2459e16df80172967d906f43b355
# (c) Continuum Analytics, Inc. / http://continuum.io # All Rights Reserved # # conda is distributed under the terms of the BSD 3-clause license. # Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause. from __future__ import absolute_import, division, print_function import sys from os.path import join, ...
[((679, 831), 'conda.cli.conda_argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""\n\nInstall a Python package in \'development mode\'.\n\nThis works by creating a conda.pth file in site-packages."""'}), '(description=\n """\n\nInstall a Python package in \'development mode\'.\n\nThis works by crea...
ltgoslo/norBERT
benchmarking/experiments/sanity_check.py
d75d5c12d9b7f9cc11c65757f2228b7e6070b69b
#!/bin/env python3 from transformers import TFBertForTokenClassification from data_preparation.data_preparation_pos import MBERTTokenizer as MBERT_Tokenizer_pos import sys if __name__ == "__main__": if len(sys.argv) > 1: modelname = sys.argv[1] else: modelname = "ltgoslo/norbert" model = T...
[((319, 388), 'transformers.TFBertForTokenClassification.from_pretrained', 'TFBertForTokenClassification.from_pretrained', (['modelname'], {'from_pt': '(True)'}), '(modelname, from_pt=True)\n', (363, 388), False, 'from transformers import TFBertForTokenClassification\n'), ((405, 472), 'data_preparation.data_preparation...
WosunOO/nca_xianshu
nca47/api/controllers/v1/firewall/securityZone.py
bbb548cb67b755a57528796d4c5a66ee68df2678
from oslo_serialization import jsonutils as json from nca47.api.controllers.v1 import base from nca47.common.i18n import _ from nca47.common.i18n import _LI, _LE from nca47.common.exception import Nca47Exception from oslo_log import log from nca47.api.controllers.v1 import tools from nca47.manager.central import Centra...
[((537, 560), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (550, 560), False, 'from oslo_log import log\n'), ((665, 694), 'nca47.manager.central.CentralManager.get_instance', 'CentralManager.get_instance', ([], {}), '()\n', (692, 694), False, 'from nca47.manager.central import CentralM...
gitter-badger/mlmodels
mlmodels/model_tch/nbeats/model.py
f08cc9b6ec202d4ad25ecdda2f44487da387569d
import numpy as np import torch from torch import nn from torch.nn import functional as F def seasonality_model(thetas, t, device): p = thetas.size()[-1] assert p < 10, 'thetas_dim is too big.' p1, p2 = (p // 2, p // 2) if p % 2 == 0 else (p // 2, p // 2 + 1) s1 = torch.tensor([np.cos(2 * np.pi * i * ...
[((447, 466), 'torch.cat', 'torch.cat', (['[s1, s2]'], {}), '([s1, s2])\n', (456, 466), False, 'import torch\n'), ((768, 853), 'numpy.linspace', 'np.linspace', (['(-backcast_length)', 'forecast_length', '(backcast_length + forecast_length)'], {}), '(-backcast_length, forecast_length, backcast_length +\n forecast_len...
chaya-v/AI-ML-Lab-Programs
BACKPROPAGATION/Backprop.py
cb2e91cf62376f5f95395e89357fa0bef730deed
from math import exp from random import seed from random import random def initialize_network(n_inputs, n_hidden, n_outputs): network = list() hidden_layer = [{'weights':[random() for i in range(n_inputs + 1)]} for i in range(n_hidden)] network.append(hidden_layer) output_layer = [{'weights':[random() for i in r...
[((2380, 2387), 'random.seed', 'seed', (['(1)'], {}), '(1)\n', (2384, 2387), False, 'from random import seed\n'), ((615, 631), 'math.exp', 'exp', (['(-activation)'], {}), '(-activation)\n', (618, 631), False, 'from math import exp\n'), ((176, 184), 'random.random', 'random', ([], {}), '()\n', (182, 184), False, 'from r...
benoitc/hypercouch
tests/multi_design_test.py
23055c26529a7f2198288b249b45d05b796e78bf
"""\ Copyright (c) 2009 Paul J. Davis <paul.joseph.davis@gmail.com> This file is part of hypercouch which is released uner the MIT license. """ import time import unittest import couchdb COUCHURI = "http://127.0.0.1:5984/" TESTDB = "hyper_tests" class MultiDesignTest(unittest.TestCase): def setUp(self): s...
[((330, 354), 'couchdb.Server', 'couchdb.Server', (['COUCHURI'], {}), '(COUCHURI)\n', (344, 354), False, 'import couchdb\n'), ((1285, 1300), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (1295, 1300), False, 'import time\n')]
DanieleMancini/xled_plus
xled_plus/samples/colmeander.py
a6e9f3da56f95f508ec4fa2bb6ceae005450e654
from .sample_setup import * ctr = setup_control() eff = ColorMeanderEffect(ctr, "solid") eff.launch_rt() input() eff.stop_rt() ctr.turn_off()
[]
wcyjames/dgl
python/dgl/nn/pytorch/sparse_emb.py
00a668ac6898971aa154a8a3fe851010034fd6bf
"""Torch NodeEmbedding.""" from datetime import timedelta import torch as th from ...backend import pytorch as F from ...utils import get_shared_mem_array, create_shared_mem_array _STORE = None class NodeEmbedding: # NodeEmbedding '''Class for storing node embeddings. The class is optimized for training larg...
[((2330, 2361), 'torch.distributed.is_initialized', 'th.distributed.is_initialized', ([], {}), '()\n', (2359, 2361), True, 'import torch as th\n'), ((3956, 3972), 'torch.device', 'th.device', (['"""cpu"""'], {}), "('cpu')\n", (3965, 3972), True, 'import torch as th\n'), ((2382, 2407), 'torch.distributed.get_rank', 'th....
seukjung/sentry-custom
tests/sentry/web/frontend/test_create_team.py
c5f6bb2019aef3caff7f3e2b619f7a70f2b9b963
from __future__ import absolute_import from django.core.urlresolvers import reverse from sentry.models import OrganizationMember, OrganizationMemberTeam, Team from sentry.testutils import TestCase, PermissionTestCase class CreateTeamPermissionTest(PermissionTestCase): def setUp(self): super(CreateTeamPe...
[((368, 428), 'django.core.urlresolvers.reverse', 'reverse', (['"""sentry-create-team"""'], {'args': '[self.organization.slug]'}), "('sentry-create-team', args=[self.organization.slug])\n", (375, 428), False, 'from django.core.urlresolvers import reverse\n'), ((941, 996), 'django.core.urlresolvers.reverse', 'reverse', ...
eym55/mango-client-python
baseCli.py
2cb1ce77d785343c24ecba913eaa9693c3db1181
import abc import datetime import enum import logging import time import typing import aysncio import Layout as layouts from decimal import Decimal from pyserum.market import Market from pyserum.open_orders_account import OpenOrdersAccount from solana.account import Account from solana.publickey import PublicKey from...
[((60068, 60093), 'base64.b64decode', 'base64.b64decode', (['encoded'], {}), '(encoded)\n', (60084, 60093), False, 'import base64\n'), ((61520, 61562), 'datetime.datetime', 'datetime.datetime', (['(2021)', '(5)', '(17)', '(12)', '(20)', '(56)'], {}), '(2021, 5, 17, 12, 20, 56)\n', (61537, 61562), False, 'import datetim...
afnmachado/univesp_pi_1
agendamentos/migrations/0011_alter_agendamentosfuncionarios_table.py
e6f2b545faaf53d14d17f751d2fb32e6618885b7
# Generated by Django 3.2.8 on 2021-11-29 05:47 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('agendamentos', '0010_agendamentosfuncionarios'), ] operations = [ migrations.AlterModelTable( name='agendamentosfuncionarios', ...
[((238, 335), 'django.db.migrations.AlterModelTable', 'migrations.AlterModelTable', ([], {'name': '"""agendamentosfuncionarios"""', 'table': '"""agendamento_funcionario"""'}), "(name='agendamentosfuncionarios', table=\n 'agendamento_funcionario')\n", (264, 335), False, 'from django.db import migrations\n')]
teresa-ho/stx-openstacksdk
openstack/tests/unit/metric/v1/test_capabilities.py
7d723da3ffe9861e6e9abcaeadc1991689f782c5
# 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 the Li...
[((752, 779), 'openstack.metric.v1.capabilities.Capabilities', 'capabilities.Capabilities', ([], {}), '()\n', (777, 779), False, 'from openstack.metric.v1 import capabilities\n'), ((1150, 1183), 'openstack.metric.v1.capabilities.Capabilities', 'capabilities.Capabilities', ([], {}), '(**BODY)\n', (1175, 1183), False, 'f...
yqliaohk/pyXDSM
pyxdsm/tests/test_xdsm.py
3bcfab710543d6624ba0698093c6522bc94601e8
import unittest import os from pyxdsm.XDSM import XDSM, __file__ from numpy.distutils.exec_command import find_executable def filter_lines(lns): # Empty lines are excluded. # Leading and trailing whitespaces are removed # Comments are removed. return [ln.strip() for ln in lns if ln.strip() and not ln....
[((10690, 10705), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10703, 10705), False, 'import unittest\n'), ((470, 481), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (479, 481), False, 'import os\n'), ((505, 540), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'prefix': '"""testdir-"""'}), "(prefix='testdir-')\n",...
quanttide/wecom-sdk-py
wecom_sdk/base/callback.py
1c71909c08d885e52e4ec38a9ddac0938a059e5a
# -*- coding: utf-8 -*- from wecom_sdk.base.crypt import encrypt_msg, decrypt_msg class WeChatWorkCallbackSDK(object): """ 企业微信回调SDK基本类,用于实现内部系统和企业微信客户端的双向通信 详细说明:https://work.weixin.qq.com/api/doc/90000/90135/90930 """ def __init__(self, token, encoding_aes_key): self.token = token ...
[((548, 623), 'wecom_sdk.base.crypt.encrypt_msg', 'encrypt_msg', (['data'], {'token': 'self.token', 'encoding_aes_key': 'self.encoding_aes_key'}), '(data, token=self.token, encoding_aes_key=self.encoding_aes_key)\n', (559, 623), False, 'from wecom_sdk.base.crypt import encrypt_msg, decrypt_msg\n'), ((763, 904), 'wecom_...
numankh/GRE-Vocab-Helper
scripts/get-table-schemas.py
c2858f3200f6d6673b1f316879e5ac482a6b7a83
import psycopg2 from decouple import config import pandas as pd import dbconnect cursor, connection = dbconnect.connect_to_db() sql = """ SELECT "table_name","column_name", "data_type", "table_schema" FROM INFORMATION_SCHEMA.COLUMNS WHERE "table_schema" = 'public' ORDER BY table_name """ df = pd.read_sql(sql, con=co...
[((103, 128), 'dbconnect.connect_to_db', 'dbconnect.connect_to_db', ([], {}), '()\n', (126, 128), False, 'import dbconnect\n'), ((297, 329), 'pandas.read_sql', 'pd.read_sql', (['sql'], {'con': 'connection'}), '(sql, con=connection)\n', (308, 329), True, 'import pandas as pd\n')]
andriyor/agate
tests/test_table/test_pivot.py
9b12d4bcc75bf3788e0774e23188f4409c3e7519
#!/usr/bin/env python # -*- coding: utf8 -*- import sys try: from cdecimal import Decimal except ImportError: # pragma: no cover from decimal import Decimal from agate import Table from agate.aggregations import Sum from agate.computations import Percent from agate.data_types import Number, Text from agate....
[((778, 786), 'agate.data_types.Number', 'Number', ([], {}), '()\n', (784, 786), False, 'from agate.data_types import Number, Text\n'), ((812, 818), 'agate.data_types.Text', 'Text', ([], {}), '()\n', (816, 818), False, 'from agate.data_types import Number, Text\n'), ((1045, 1099), 'agate.Table', 'Table', (['self.rows',...
chengzhag/DeepPanoContext
external/pyTorchChamferDistance/chamfer_distance/__init__.py
14f847e51ec2bd08e0fc178dd1640541752addb7
import os os.makedirs(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'build')), exist_ok=True) from .chamfer_distance import ChamferDistance
[((51, 76), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (66, 76), False, 'import os\n')]
georg-wolflein/impartial
test_impartial.py
a53819cefcb74a57e3c1148a6b8fa88aed9264d4
from functools import partial from impartial import impartial def f(x: int, y: int, z: int = 0) -> int: return x + 2*y + z def test_simple_call_args(): assert impartial(f, 1)(2) == f(1, 2) def test_simple_call_kwargs(): assert impartial(f, y=2)(x=1) == f(1, 2) def test_simple_call_empty(): asse...
[((843, 865), 'impartial.impartial', 'impartial', (['f'], {'x': '(1)', 'y': '(2)'}), '(f, x=1, y=2)\n', (852, 865), False, 'from impartial import impartial\n'), ((876, 895), 'impartial.impartial', 'impartial', (['imp'], {'x': '(2)'}), '(imp, x=2)\n', (885, 895), False, 'from impartial import impartial\n'), ((906, 925),...
smilechaser/screeps-script-caddy
manager.py
11b6e809675dfd0a5a4ff917a492adc4a5a08bca
''' Python script for uploading/downloading scripts for use with the game Screeps. http://support.screeps.com/hc/en-us/articles/203022612-Commiting-scripts-using-direct-API-access Usage: # # general help/usage # python3 manager.py --help # # retrieve all scripts from the game and store them...
[((892, 922), 'os.environ.get', 'os.environ.get', (['"""SCREEPS_USER"""'], {}), "('SCREEPS_USER')\n", (906, 922), False, 'import os\n'), ((1155, 1189), 'os.environ.get', 'os.environ.get', (['"""SCREEPS_PASSWORD"""'], {}), "('SCREEPS_PASSWORD')\n", (1169, 1189), False, 'import os\n'), ((1724, 1753), 'requests.auth.HTTPB...
Nemfeto/python_training
contact.py
4d04f07700da4b0d5b50736ba197ad85fd2ee549
class Contact: def __init__(self, first_name, last_name, nickname, address, mobile, email): self.first_name = first_name self.last_name = last_name self.nickname = nickname self.address = address self.mobile = mobile self.email = email
[]
Integreat/cms-v2
integreat_cms/cms/views/dashboard/admin_dashboard_view.py
c79a54fd5abb792696420aa6427a5e5a356fa79c
import logging from django.views.generic import TemplateView from ...models import Feedback from ..chat.chat_context_mixin import ChatContextMixin logger = logging.getLogger(__name__) class AdminDashboardView(TemplateView, ChatContextMixin): """ View for the admin dashboard """ #: The template to ...
[((159, 186), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (176, 186), False, 'import logging\n')]
bhumikapahariapuresoftware/tangled-up-in-unicode
src/tangled_up_in_unicode/tangled_up_in_unicode_14_0_0.py
ee052e6f0fd4a0083178a163ec72dc37e2ad5d59
from typing import Optional import bisect from tangled_up_in_unicode.u14_0_0_data.prop_list_to_property import prop_list_to_property from tangled_up_in_unicode.u14_0_0_data.blocks_to_block_start import blocks_to_block_start from tangled_up_in_unicode.u14_0_0_data.blocks_to_block_end import blocks_to_block_end from ta...
[((4117, 4152), 'bisect.bisect_left', 'bisect.bisect_left', (['start_keys', 'idx'], {}), '(start_keys, idx)\n', (4135, 4152), False, 'import bisect\n'), ((4450, 4483), 'bisect.bisect_left', 'bisect.bisect_left', (['end_keys', 'idx'], {}), '(end_keys, idx)\n', (4468, 4483), False, 'import bisect\n'), ((5266, 5301), 'bis...
namib-project/weatherstation-image
to_display.py
ae6a11943bfd21135bf0ce5d113865b69c58bbe2
from PIL import Image from PIL import ImageDraw from PIL import ImageFont import sys import ST7735 # Create ST7735 LCD display class object and set pin numbers and display hardware information. disp = ST7735.ST7735( dc=24, cs=ST7735.BG_SPI_CS_BACK, rst=25, port=0, width=122, height=160, ro...
[((203, 306), 'ST7735.ST7735', 'ST7735.ST7735', ([], {'dc': '(24)', 'cs': 'ST7735.BG_SPI_CS_BACK', 'rst': '(25)', 'port': '(0)', 'width': '(122)', 'height': '(160)', 'rotation': '(270)'}), '(dc=24, cs=ST7735.BG_SPI_CS_BACK, rst=25, port=0, width=122,\n height=160, rotation=270)\n', (216, 306), False, 'import ST7735\...
saransh808/Projects
Smart User Targeted Advertising/MinorPro/FINALPROJECT/Resources/testInsert.py
7449ed6b53900ebb16a9084cff389cc50f3c9f6c
import sqlite3 conn=sqlite3.connect('Survey.db') fo=open('insertcommand.txt') str=fo.readline() while str: str="INSERT INTO data VALUES"+str conn.execute(str) #print(str) str=fo.readline() conn.commit() conn.close() fo.close()
[((21, 49), 'sqlite3.connect', 'sqlite3.connect', (['"""Survey.db"""'], {}), "('Survey.db')\n", (36, 49), False, 'import sqlite3\n')]
HyperionGray/python-chrome-devtools-protocol
cdp/headless_experimental.py
5463a5f3d20100255c932961b944e4b37dbb7e61
# DO NOT EDIT THIS FILE! # # This file is generated from the CDP specification. If you need to make # changes, edit the generator and regenerate all of the modules. # # CDP domain: HeadlessExperimental (experimental) from __future__ import annotations from cdp.util import event_class, T_JSON_DICT from dataclasses impo...
[((4272, 4331), 'cdp.util.event_class', 'event_class', (['"""HeadlessExperimental.needsBeginFramesChanged"""'], {}), "('HeadlessExperimental.needsBeginFramesChanged')\n", (4283, 4331), False, 'from cdp.util import event_class, T_JSON_DICT\n')]
resurtm/wvflib
tests/test_geometry.py
106f426cc2c63c8d21f3e0ec1b90b06450dfc547
import unittest from wvflib.geometry import Face class TestGeometry(unittest.TestCase): def test_constructor(self): f = Face() self.assertTrue(len(f.vertices) == 0) if __name__ == '__main__': unittest.main()
[((221, 236), 'unittest.main', 'unittest.main', ([], {}), '()\n', (234, 236), False, 'import unittest\n'), ((135, 141), 'wvflib.geometry.Face', 'Face', ([], {}), '()\n', (139, 141), False, 'from wvflib.geometry import Face\n')]
d066y/detectem
tests/test_core.py
648ddff159e17777e41b1dd266a759e9f0774ea8
import pytest from detectem.core import Detector, Result, ResultCollection from detectem.plugin import Plugin, PluginCollection from detectem.settings import INDICATOR_TYPE, HINT_TYPE, MAIN_ENTRY, GENERIC_TYPE from detectem.plugins.helpers import meta_generator class TestDetector(): HAR_ENTRY_1 = { 'requ...
[((2707, 2831), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""har,index"""', '[(HAR_NO_URL_REDIRECT, 0), (HAR_URL_REDIRECT_PATH, 1), (\n HAR_URL_REDIRECT_ABS, 1)]'], {}), "('har,index', [(HAR_NO_URL_REDIRECT, 0), (\n HAR_URL_REDIRECT_PATH, 1), (HAR_URL_REDIRECT_ABS, 1)])\n", (2730, 2831), False, 'im...
Mlitwin98/twitter-clone
twitter-clone/twitter/views.py
4fbe754a4693c39ac4e9623f51ca42a7facecd2e
from django.dispatch.dispatcher import receiver from django.shortcuts import get_object_or_404, redirect, render from django.contrib.auth.decorators import login_required from django.http.response import HttpResponse from django.contrib.auth.models import User from django.contrib.auth import authenticate, logout as aut...
[((2489, 2529), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'redirect_field_name': 'None'}), '(redirect_field_name=None)\n', (2503, 2529), False, 'from django.contrib.auth.decorators import login_required\n'), ((4880, 4920), 'django.contrib.auth.decorators.login_required', 'login_required',...
Amruthaohm/custom_app
custom_app/custom_app/doctype/depart/test_depart.py
03bc3fc11c3627251796611caf33b7117c46d69b
# Copyright (c) 2022, momscode and Contributors # See license.txt # import frappe import unittest class Testdepart(unittest.TestCase): pass
[]
khdesai/cti-python-stix2
stix2/__init__.py
20a9bb316c43b7d9faaab686db8d51e5c89416da
"""Python APIs for STIX 2. .. autosummary:: :toctree: api confidence datastore environment equivalence exceptions markings parsing pattern_visitor patterns properties serialization utils v20 v21 versioning workbench """ # flake8: noqa DEFAULT_VERSION = '2.1' # De...
[]
chr0m3/boj-codes
0/1/1436/1436.py
d71d0a22d0a3ae62c225f382442461275f56fe8f
count = int(input()) title = 0 while count > 0: title += 1 if '666' in str(title): count -= 1 print(title)
[]
jieatelement/quickstart-aws-industrial-machine-connectivity
functions/source/GreengrassLambda/idna/uts46data.py
ca6af4dcbf795ce4a91adcbec4b206147ab26bfa
# This file is automatically generated by tools/idna-data # vim: set fileencoding=utf-8 : """IDNA Mapping Table from UTS46.""" __version__ = "11.0.0" def _seg_0(): return [ (0x0, '3'), (0x1, '3'), (0x2, '3'), (0x3, '3'), (0x4, '3'), (0x5, '3'), (0x6, '3'), (0x7, '3...
[]
alex4321/ctp
tests/kbcr/smart/test_smart.py
22a6a55442a648e5f7d8c10f90708a7340360720
# -*- coding: utf-8 -*- import numpy as np import torch from torch import nn from kbcr.kernels import GaussianKernel from kbcr.smart import NeuralKB import pytest @pytest.mark.light def test_smart_v1(): embedding_size = 50 rs = np.random.RandomState(0) for _ in range(32): with torch.no_grad(...
[((243, 267), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (264, 267), True, 'import numpy as np\n'), ((3032, 3055), 'pytest.main', 'pytest.main', (['[__file__]'], {}), '([__file__])\n', (3043, 3055), False, 'import pytest\n'), ((306, 321), 'torch.no_grad', 'torch.no_grad', ([], {}), '()...
eseJiHeaLim/find_child
test.py
29596529ccf39241492b092b01baf03b76d0eb3a
import tkinter window=tkinter.Tk() window.title("YUN DAE HEE") window.geometry("640x400+100+100") window.resizable(True, True) image=tkinter.PhotoImage(file="opencv_frame_0.png") label=tkinter.Label(window, image=image) label.pack() window.mainloop()
[((23, 35), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (33, 35), False, 'import tkinter\n'), ((135, 180), 'tkinter.PhotoImage', 'tkinter.PhotoImage', ([], {'file': '"""opencv_frame_0.png"""'}), "(file='opencv_frame_0.png')\n", (153, 180), False, 'import tkinter\n'), ((188, 222), 'tkinter.Label', 'tkinter.Label', (['...
trujivan/climate-impact-changes
UMSLHackRestAPI/api/urls.py
609b8197b0ede1c1fdac3aa82b34e73e6f4526e3
from django.urls import path, include from .views import main_view, PredictionView #router = routers.DefaultRouter(trailing_slash=False) #router.register('years', YearView, basename='years') #router.register('predict', PredictionView, basename='predict') urlpatterns = [ #path('api/', get_dummy_data), #path('...
[((478, 510), 'django.urls.path', 'path', (['""""""', 'main_view'], {'name': '"""main"""'}), "('', main_view, name='main')\n", (482, 510), False, 'from django.urls import path, include\n')]
appressoas/ievv_opensource
ievv_opensource/utils/ievv_colorize.py
63e87827952ddc8f6f86145b79478ef21d6a0990
from django.conf import settings from termcolor import colored #: Red color constant for :func:`.ievv_colorize`. COLOR_RED = 'red' #: Blue color constant for :func:`.ievv_colorize`. COLOR_BLUE = 'blue' #: Yellow color constant for :func:`.ievv_colorize`. COLOR_YELLOW = 'yellow' #: Grey color constant for :func:`.i...
[((1477, 1516), 'termcolor.colored', 'colored', (['text'], {'color': 'color', 'attrs': 'attrs'}), '(text, color=color, attrs=attrs)\n', (1484, 1516), False, 'from termcolor import colored\n')]
bluefin1986/tinyspark
RSICompute.py
0b086d3af5316062c2f3aaa7d4492341ed5c71c2
# coding: utf-8 # In[1]: import baostock as bs import pandas as pd import numpy as np import talib as ta import matplotlib.pyplot as plt import KlineService import BaoStockUtil import math import datetime from scipy import integrate from RSI import DayRSI,WeekRSI,MonthRSI,SixtyMinRSI from concurrent.futures import...
[((718, 736), 'dbutil.connectDB', 'dbutil.connectDB', ([], {}), '()\n', (734, 736), False, 'import dbutil\n'), ((985, 1003), 'dbutil.connectDB', 'dbutil.connectDB', ([], {}), '()\n', (1001, 1003), False, 'import dbutil\n'), ((1267, 1285), 'dbutil.connectDB', 'dbutil.connectDB', ([], {}), '()\n', (1283, 1285), False, 'i...
abousselmi/OSNoise
osnoise/conf/base.py
f0e4baa51921f672179c014beb89555958c7ddca
# Copyright 2016 Orange # # 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, softw...
[((622, 699), 'oslo_config.cfg.StrOpt', 'cfg.StrOpt', (['"""log_file_name"""'], {'default': '"""osnoise.log"""', 'help': '"""Osnoise file name."""'}), "('log_file_name', default='osnoise.log', help='Osnoise file name.')\n", (632, 699), False, 'from oslo_config import cfg\n'), ((730, 816), 'oslo_config.cfg.StrOpt', 'cfg...
Ginkooo/ORION-sensor-visualizer
src/orionsensor/gui/sensors/proximitysensor.py
550b2e692d711bb8104fe827570ef9b9112536d3
from kivy.properties import NumericProperty from gui.sensors.sensor import Sensor import config class ProximitySensor(Sensor): """Proximity sensor view""" # maximum possible reading max = NumericProperty(config.ProximitySensor.max) # minimum possible reading min = NumericProperty(config.Proximit...
[((204, 247), 'kivy.properties.NumericProperty', 'NumericProperty', (['config.ProximitySensor.max'], {}), '(config.ProximitySensor.max)\n', (219, 247), False, 'from kivy.properties import NumericProperty\n'), ((289, 332), 'kivy.properties.NumericProperty', 'NumericProperty', (['config.ProximitySensor.min'], {}), '(conf...
gudtldn/DiscordStockBot
Cogs/HelpCommand.py
d1b06e49738092ccf3c5d5a26b35fd321a3bd0f2
#도움말 import discord from discord.ext import commands from discord.ext.commands import Context from define import * class HelpCommand_Context(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command(name="도움말", aliases=["명령어", "?"]) @CommandExecutionTime async def _Hel...
[((225, 275), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""도움말"""', 'aliases': "['명령어', '?']"}), "(name='도움말', aliases=['명령어', '?'])\n", (241, 275), False, 'from discord.ext import commands\n')]
SupermeLC/PyNeval
test/test_model/cprofile_test.py
2cccfb1af7d97857454e9cbc3515ba75e5d8d4b0
import cProfile import pstats import os # 性能分析装饰器定义 def do_cprofile(filename): """ Decorator for function profiling. """ def wrapper(func): def profiled_func(*args, **kwargs): # Flag for do profiling or not. DO_PROF = False if DO_PROF: profil...
[((324, 342), 'cProfile.Profile', 'cProfile.Profile', ([], {}), '()\n', (340, 342), False, 'import cProfile\n'), ((559, 580), 'pstats.Stats', 'pstats.Stats', (['profile'], {}), '(profile)\n', (571, 580), False, 'import pstats\n')]
cyberhck/renku-python
renku/core/commands/providers/api.py
2e52dff9dd627c93764aadb9fd1e91bd190a5de7
# Copyright 2019 - Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Y...
[]
bluetech/cattrs
cattr/__init__.py
be438d5566bd308b584359a9b0011a7bd0006b06
# -*- coding: utf-8 -*- from .converters import Converter, UnstructureStrategy __all__ = ('global_converter', 'unstructure', 'structure', 'structure_attrs_fromtuple', 'structure_attrs_fromdict', 'UnstructureStrategy') __author__ = 'Tin Tvrtković' __email__ = 'tinchester@gmail.com' global_conve...
[]
zjzh/vega
vega/security/run_dask.py
aa6e7b8c69024262fc483ee06113b4d1bd5156d8
# -*- coding: utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. 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/LICENS...
[((1229, 1389), 'distributed.security.Security', 'Security', ([], {'tls_ca_file': 'sec_cfg.ca_cert', 'tls_client_cert': 'sec_cfg.client_cert_dask', 'tls_client_key': 'sec_cfg.client_secret_key_dask', 'require_encryption': '(True)'}), '(tls_ca_file=sec_cfg.ca_cert, tls_client_cert=sec_cfg.\n client_cert_dask, tls_cli...
NoaBrazilay/DeepLearningProject
MISSGANvsStarGAN/core/solver.py
5c44d21069de1fc5fa2687c4121286670be3d773
""" StarGAN v2 Copyright (c) 2020-present NAVER Corp. This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, US...
[((7079, 7094), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7092, 7094), False, 'import torch\n'), ((7811, 7826), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7824, 7826), False, 'import torch\n'), ((11421, 11463), 'torch.full_like', 'torch.full_like', (['logits'], {'fill_value': 'target'}), '(logits, ...
vishweshwartyagi/Data-Structures-and-Algorithms-UCSD
1. Algorithmic Toolbox/week2_algorithmic_warmup/4_lcm.py
de942b3a0eb2bf56f949f47c297fad713aa81489
# Uses python3 import sys def lcm_naive(a, b): for l in range(1, a*b + 1): if l % a == 0 and l % b == 0: return l return a*b def gcd(a, b): if a%b == 0: return b elif b%a == 0: return a if a > b: return gcd(a%b, b) else: return gcd(b%...
[]
JoviCastillo/TH-Project-1-guessing-game-
guessing_game.py
efa5c7080b1a484b20655ddb01873dc3edefc415
import random highscore = [] def not_in_range(guess_it): """This is to check that the numbers inputted by the user are in range, and will let the user know. If the numbers are in range then it passes. """ if guess_it < 1: print('I am not thinking of negative numbers!') elif guess_it > 10:...
[((1411, 1432), 'random.randint', 'random.randint', (['(1)', '(10)'], {}), '(1, 10)\n', (1425, 1432), False, 'import random\n')]
dastacy/gve_devnet_unity_unread_voicemail_notifier
MAIL_SERVER.py
445177d1107e465d90971d3d6ebb3249c5ed7b29
#!/usr/bin/env python3 USER = r'server\user' PASSWORD = 'server_password' HOSTNAME = 'hostname.goes.here.com' DOMAIN = 'domain.goes.here.com' FROM_ADDR = 'emailyouwanttosendmessagesfrom@something.com'
[]
anetczuk/rsscast
src/testrsscast/rss/ytconverter_example.py
8649d1143679afcabbe19e5499f104fa1325bff1
#!/usr/bin/python3 # # MIT License # # Copyright (c) 2021 Arkadiusz Netczuk <dev.arnet@gmail.com> # # 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 limi...
[((1707, 1769), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""YouTube convert example"""'}), "(description='YouTube convert example')\n", (1730, 1769), False, 'import argparse\n'), ((1800, 1826), 'rsscast.logger.configure_console', 'logger.configure_console', ([], {}), '()\n', (1824, 18...
palazzem/elmo-server
cli.py
b2e02d600a431dc1db31090f0d8dd09a8d586373
import click APP_YAML_TEMPLATE = """runtime: python37 env_variables: ELMO_BASE_URL: '{BASE_URL}' ELMO_VENDOR: '{VENDOR}' handlers: - url: /.* script: auto secure: always redirect_http_response_code: 301 """ @click.command() @click.argument("base_url") @click.argument("vendor") def generate_app_yaml(base_u...
[((222, 237), 'click.command', 'click.command', ([], {}), '()\n', (235, 237), False, 'import click\n'), ((239, 265), 'click.argument', 'click.argument', (['"""base_url"""'], {}), "('base_url')\n", (253, 265), False, 'import click\n'), ((267, 291), 'click.argument', 'click.argument', (['"""vendor"""'], {}), "('vendor')\...