repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
JoOkuma/dexp
dexp/cli/dexp_commands/crop.py
6d9003384605b72f387d38b5befa29e4e2246af8
import click from arbol.arbol import aprint, asection from dexp.cli.defaults import DEFAULT_CLEVEL, DEFAULT_CODEC, DEFAULT_STORE from dexp.cli.parsing import _get_output_path, _parse_channels, _parse_chunks from dexp.datasets.open_dataset import glob_datasets from dexp.datasets.operations.crop import dataset_crop @c...
[((319, 334), 'click.command', 'click.command', ([], {}), '()\n', (332, 334), False, 'import click\n'), ((336, 375), 'click.argument', 'click.argument', (['"""input_paths"""'], {'nargs': '(-1)'}), "('input_paths', nargs=-1)\n", (350, 375), False, 'import click\n'), ((401, 436), 'click.option', 'click.option', (['"""--o...
YinuoJin/DMT_loss
morse_DMT/write_dipha_file_3d_revise.py
c6e66cb7997b7cd5616156faaf294e350e77c4c2
import sys from matplotlib import image as mpimg import numpy as np import os DIPHA_CONST = 8067171840 DIPHA_IMAGE_TYPE_CONST = 1 DIM = 3 input_dir = os.path.join(os.getcwd(), sys.argv[1]) dipha_output_filename = sys.argv[2] vert_filename = sys.argv[3] input_filenames = [name for nam...
[((638, 660), 'numpy.zeros', 'np.zeros', (['[nx, ny, nz]'], {}), '([nx, ny, nz])\n', (646, 660), True, 'import numpy as np\n'), ((174, 185), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (183, 185), False, 'import os\n'), ((488, 531), 'os.path.join', 'os.path.join', (['input_dir', 'input_filenames[0]'], {}), '(input_dir,...
clodonil/pipeline_aws_custom
microservices/validate/tools/validates.py
8ca517d0bad48fe528461260093f0035f606f9be
""" Tools para validar o arquivo template recebido do SQS """ class Validate: def __init__(self): pass def check_validate_yml(self, template): """ valida se o arquivo yml é valido """ if template: return True else: return False def che...
[]
unrealTOM/MC
MetropolisMCMC.py
5a4cdf1ee11ef3d438f24dd38e894731103448ac
import numpy as np import matplotlib.pyplot as plt import math def normal(mu,sigma,x): #normal distribution return 1/(math.pi*2)**0.5/sigma*np.exp(-(x-mu)**2/2/sigma**2) def eval(x): return normal(-4,1,x) + normal(4,1,x) #return 0.3*np.exp(-0.2*x**2)+0.7*np.exp(-0.2*(x-10)**2) def ref(x_star,x): #normal...
[((396, 408), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (406, 408), True, 'import matplotlib.pyplot as plt\n'), ((1126, 1170), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""MetropolisNormal.png"""'], {'dpi': '(100)'}), "('MetropolisNormal.png', dpi=100)\n", (1137, 1170), True, 'import matplotlib.p...
lipeijian/shadowsocks-android
gfwlist/gen.py
ef707e4383a0d430775c8ac9b660c334e87e40ec
#!/usr/bin/python # -*- encoding: utf8 -*- import itertools import math import sys import IPy def main(): china_list_set = IPy.IPSet() for line in sys.stdin: china_list_set.add(IPy.IP(line)) # 输出结果 for ip in china_list_set: print '<item>' + str(ip) + '</item>' if __name__ == "__ma...
[]
lastralab/Statistics
Specialization/Personal/SortHours.py
358679f2e749db2e23c655795b34382c84270704
name = "mail.txt" counts = dict() handle = open(name) for line in handle: line = line.rstrip() if line == '': continue words = line.split() if words[0] == 'From': counts[words[5][:2]] = counts.get(words[5][:2], 0) + 1 tlist = list() for key, value in counts.items(): ...
[]
RangiLyu/DI-drive
core/simulators/carla_scenario_simulator.py
f7db2e7b19d70c05184d6d6edae6b7e035a324d7
import os from typing import Any, Dict, List, Optional import carla from core.simulators.carla_simulator import CarlaSimulator from core.simulators.carla_data_provider import CarlaDataProvider from .srunner.scenarios.route_scenario import RouteScenario, SCENARIO_CLASS_DICT from .srunner.scenariomanager.scenario_mana...
[((4290, 4332), 'core.simulators.carla_data_provider.CarlaDataProvider.set_client', 'CarlaDataProvider.set_client', (['self._client'], {}), '(self._client)\n', (4318, 4332), False, 'from core.simulators.carla_data_provider import CarlaDataProvider\n'), ((4345, 4385), 'core.simulators.carla_data_provider.CarlaDataProvid...
Conengmo/python-empty-project
bin/run.py
18d275422116577d48ae4fdbe1c93501a5e6ef78
import myproject myproject.logs(show_level='debug') myproject.mymod.do_something()
[((18, 52), 'myproject.logs', 'myproject.logs', ([], {'show_level': '"""debug"""'}), "(show_level='debug')\n", (32, 52), False, 'import myproject\n'), ((55, 85), 'myproject.mymod.do_something', 'myproject.mymod.do_something', ([], {}), '()\n', (83, 85), False, 'import myproject\n')]
gerold-penz/python-simplemail
development/simple_email.py
9cfae298743af2b771d6d779717b602de559689b
#!/usr/bin/env python # coding: utf-8 # BEGIN --- required only for testing, remove in real world code --- BEGIN import os import sys THISDIR = os.path.dirname(os.path.abspath(__file__)) APPDIR = os.path.abspath(os.path.join(THISDIR, os.path.pardir, os.path.pardir)) sys.path.insert(0, APPDIR) # END --- required only f...
[]
DerekYJC/bmi_python
features/hdf_features.py
7b9cf3f294a33688db24b0863c1035e9cc6999ea
''' HDF-saving features ''' import time import tempfile import random import traceback import numpy as np import fnmatch import os, sys import subprocess from riglib import calibrations, bmi from riglib.bmi import extractor from riglib.experiment import traits import hdfwriter class SaveHDF(object): ''' Saves...
[((662, 717), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'suffix': '""".h5"""', 'delete': '(False)'}), "(suffix='.h5', delete=False)\n", (689, 717), False, 'import tempfile\n'), ((793, 853), 'riglib.sink.sinks.start', 'sink.sinks.start', (['self.sink_class'], {'filename': 'self.h5file.name'}), ...
vaginessa/irma
common/irma/common/exceptions.py
02285080b67b25ef983a99a765044683bd43296c
# # 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 top-level directory # of this distribution and at: # # http:...
[]
sunmengnan/city_brain
tf_crnn/libs/infer.py
478f0b974f4491b4201956f37b83ce6860712bc8
import time import os import math import numpy as np from libs import utils from libs.img_dataset import ImgDataset from nets.crnn import CRNN from nets.cnn.paper_cnn import PaperCNN import shutil def calculate_accuracy(predicts, labels): """ :param predicts: encoded predict result :param labels: ground...
[((761, 785), 'numpy.array', 'np.array', (['edit_distences'], {}), '(edit_distences)\n', (769, 785), True, 'import numpy as np\n'), ((864, 877), 'numpy.mean', 'np.mean', (['data'], {}), '(data)\n', (871, 877), True, 'import numpy as np\n'), ((4012, 4042), 'os.path.join', 'os.path.join', (['result_dir', 'name'], {}), '(...
giTan7/30-Days-Of-Code
Day 2/Day_2_Python.py
f023a2bf1b5e58e1eb5180162443b9cd4b6b2ff8
#!/bin/python3 import math import os import random import re import sys # Complete the solve function below. def solve(meal_cost, tip_percent, tax_percent): tip = (meal_cost * tip_percent)/100 tax = (meal_cost * tax_percent)/100 print(int(meal_cost + tip + tax + 0.5)) # We add 0.5 because...
[]
nursix/rlpptm
modules/templates/RLPPTM/tools/mis.py
e7b50b2fdf6277aed5f198ca10ad773c5ca0b947
# -*- coding: utf-8 -*- # # Helper Script for Mass-Invitation of Participant Organisations # # RLPPTM Template Version 1.0 # # Execute in web2py folder after code upgrade like: # python web2py.py -S eden -M -R applications/eden/modules/templates/RLPPTM/tools/mis.py # import os import sys from core import s3_format_dat...
[((1031, 1071), 'core.s3_format_datetime', 's3_format_datetime', ([], {'dtfmt': '"""%Y%m%d%H%M%S"""'}), "(dtfmt='%Y%m%d%H%M%S')\n", (1049, 1071), False, 'from core import s3_format_datetime\n'), ((1082, 1146), 'os.path.join', 'os.path.join', (['request.folder', '"""private"""', "('mis_%s.log' % timestmp)"], {}), "(requ...
harshp8l/deep-learning-lang-detection
data/train/python/22aec8fbe47f7975a1e7f4a0caa5c88c56e4a03e__init__.py
2a54293181c1c2b1a2b840ddee4d4d80177efb33
def save_form(form, actor=None): """Allows storing a form with a passed actor. Normally, Form.save() does not accept an actor, but if you require this to be passed (is not handled by middleware), you can use this to replace form.save(). Requires you to use the audit.Model model as the actor is passed to th...
[]
kingsd041/os-tests
engine/test_sysctl.py
2ea57cb6f1da534633a4670ccb83d40300989886
# coding = utf-8 # Create date: 2018-11-05 # Author :Hailong def test_sysctl(ros_kvm_with_paramiko, cloud_config_url): command = 'sudo cat /proc/sys/kernel/domainname' feed_back = 'test' client = ros_kvm_with_paramiko(cloud_config='{url}/test_sysctl.yml'.format(url=cloud_config_url)) stdin, stdout, st...
[]
grschafer/paprika-sync
paprika_sync/core/management/commands/import_recipes_from_file.py
8b6fcd6246557bb79009fa9355fd4d588fb8ed90
import json import logging from django.core.management.base import BaseCommand from django.db import transaction from paprika_sync.core.models import PaprikaAccount from paprika_sync.core.serializers import RecipeSerializer, CategorySerializer from paprika_sync.core.utils import log_start_end logger = logging.getLo...
[((307, 334), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (324, 334), False, 'import logging\n'), ((1089, 1110), 'paprika_sync.core.utils.log_start_end', 'log_start_end', (['logger'], {}), '(logger)\n', (1102, 1110), False, 'from paprika_sync.core.utils import log_start_end\n'), ((1469...
sot/mica
scripts/update_asp_l1.py
136a9b0d9521efda5208067b51cf0c8700b4def3
#!/usr/bin/env python # Licensed under a 3-clause BSD style license - see LICENSE.rst import mica.archive.asp_l1 mica.archive.asp_l1.main()
[]
hhgarnes/python-validity
pair.py
82b42e4fd152f10f75584de56502fd9ada299bb5
from time import sleep from proto9x.usb import usb from proto9x.tls import tls from proto9x.flash import read_flash from proto9x.init_flash import init_flash from proto9x.upload_fwext import upload_fwext from proto9x.calibrate import calibrate from proto9x.init_db import init_db #usb.trace_enabled=True #tls.trace_en...
[((500, 510), 'proto9x.usb.usb.open', 'usb.open', ([], {}), '()\n', (508, 510), False, 'from proto9x.usb import usb\n'), ((542, 554), 'proto9x.init_flash.init_flash', 'init_flash', ([], {}), '()\n', (552, 554), False, 'from proto9x.init_flash import init_flash\n'), ((597, 611), 'proto9x.upload_fwext.upload_fwext', 'upl...
tefra/xsdata-w3c-tests
output/models/ms_data/element/elem_q017_xsd/elem_q017.py
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
from dataclasses import dataclass, field @dataclass class FooTest: class Meta: name = "fooTest" value: str = field( init=False, default="Hello" ) @dataclass class Root: class Meta: name = "root" foo_test: str = field( init=False, default="Hello",...
[((128, 162), 'dataclasses.field', 'field', ([], {'init': '(False)', 'default': '"""Hello"""'}), "(init=False, default='Hello')\n", (133, 162), False, 'from dataclasses import dataclass, field\n'), ((269, 374), 'dataclasses.field', 'field', ([], {'init': '(False)', 'default': '"""Hello"""', 'metadata': "{'name': 'fooTe...
modelhub-ai/mic-dkfz-brats
contrib_src/predict.py
4522a26442f1e323f97aa45fbd5047bfe9029b2b
import json import os from collections import OrderedDict from copy import deepcopy import SimpleITK as sitk from batchgenerators.augmentations.utils import resize_segmentation # resize_softmax_output from skimage.transform import resize from torch.optim import lr_scheduler from torch import nn import numpy as np impor...
[((4533, 4572), 'numpy.pad', 'np.pad', (['image', 'pad_list', 'mode'], {}), '(image, pad_list, mode, **kwargs)\n', (4539, 4572), True, 'import numpy as np\n'), ((13081, 13101), 'torch.exp', 'torch.exp', (['(x - x_max)'], {}), '(x - x_max)\n', (13090, 13101), False, 'import torch\n'), ((16372, 16387), 'numpy.unique', 'n...
architsakhadeo/Offline-Hyperparameter-Tuning-for-RL
plot/finderror.py
94b8f205b12f0cc59ae8e19b2e6099f34be929d6
import os basepath = '/home/archit/scratch/cartpoles/data/hyperparam/cartpole/offline_learning/esarsa-adam/' dirs = os.listdir(basepath) string = '''''' for dir in dirs: print(dir) subbasepath = basepath + dir + '/' subdirs = os.listdir(subbasepath) for subdir in subdirs: print(subdir) subsubbasepath = subbasep...
[((116, 136), 'os.listdir', 'os.listdir', (['basepath'], {}), '(basepath)\n', (126, 136), False, 'import os\n'), ((229, 252), 'os.listdir', 'os.listdir', (['subbasepath'], {}), '(subbasepath)\n', (239, 252), False, 'import os\n'), ((354, 380), 'os.listdir', 'os.listdir', (['subsubbasepath'], {}), '(subsubbasepath)\n', ...
bluePlatinum/pyback
src/pybacked/zip_handler.py
1c12a52974232b0482981c12a9af27e52dd2190e
import os import shutil import tempfile import zipfile def archive_write(archivepath, data, filename, compression, compressionlevel): """ Create a file named filename in the archive and write data to it :param archivepath: The path to the zip-archive :type archivepath: str :param data: The data t...
[((696, 795), 'zipfile.ZipFile', 'zipfile.ZipFile', (['archivepath'], {'mode': '"""a"""', 'compression': 'compression', 'compresslevel': 'compressionlevel'}), "(archivepath, mode='a', compression=compression,\n compresslevel=compressionlevel)\n", (711, 795), False, 'import zipfile\n'), ((1491, 1518), 'os.path.isfile...
imvinod/Eva
src/query_planner/abstract_scan_plan.py
0ed9814ae89db7dce1fb734dc99d5dac69cb3c82
"""Abstract class for all the scan planners https://www.postgresql.org/docs/9.1/using-explain.html https://www.postgresql.org/docs/9.5/runtime-config-query.html """ from src.query_planner.abstract_plan import AbstractPlan from typing import List class AbstractScan(AbstractPlan): """Abstract class for all the scan...
[]
jimmy-huang/zephyr.js
tests/tools/test-tcp4-client.py
cef5c0dffaacf7d5aa3f8265626f68a1e2b32eb5
# !usr/bin/python # coding:utf-8 import time import socket def main(): print "Socket client creat successful" host = "192.0.2.1" port = 9876 bufSize = 1024 addr = (host, port) Timeout = 300 mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mySocket.settimeout(Timeout) ...
[]
s-utsch/kinto
kinto/__main__.py
5e368849a8ab652a6e1923f44febcf89afd2c78b
import argparse import sys from cliquet.scripts import cliquet from pyramid.scripts import pserve from pyramid.paster import bootstrap def main(args=None): """The main routine.""" if args is None: args = sys.argv[1:] parser = argparse.ArgumentParser(description="Kinto commands...
[((269, 322), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Kinto commands"""'}), "(description='Kinto commands')\n", (292, 322), False, 'import argparse\n'), ((1148, 1177), 'pyramid.paster.bootstrap', 'bootstrap', (['"""config/kinto.ini"""'], {}), "('config/kinto.ini')\n", (1157, 1177)...
JumboCode/GroundWorkSomerville
apis/admin.py
280f9cd8ea38f065c9fb113e563a4be362a7e265
from django.contrib import admin from django.contrib.auth.models import User from .models import Vegetable, Harvest, Transaction, Merchandise, MerchandisePrice from .models import PurchasedItem, UserProfile, VegetablePrice, StockedVegetable from .models import MerchandisePhotos admin.site.register(Vegetable) admin.sit...
[((280, 310), 'django.contrib.admin.site.register', 'admin.site.register', (['Vegetable'], {}), '(Vegetable)\n', (299, 310), False, 'from django.contrib import admin\n'), ((311, 348), 'django.contrib.admin.site.register', 'admin.site.register', (['StockedVegetable'], {}), '(StockedVegetable)\n', (330, 348), False, 'fro...
AnantTiwari-Naman/pyglet
tests/unit/media/test_synthesis.py
4774f2889057da95a78785a69372112931e6a620
from ctypes import sizeof from io import BytesIO import unittest from pyglet.media.synthesis import * local_dir = os.path.dirname(__file__) test_data_path = os.path.abspath(os.path.join(local_dir, '..', '..', 'data')) del local_dir def get_test_data_file(*file_parts): """Get a file from the test data directory...
[((2573, 2601), 'io.BytesIO', 'BytesIO', (['generated_data.data'], {}), '(generated_data.data)\n', (2580, 2601), False, 'from io import BytesIO\n')]
tavo1599/F.P2021
Ejercicio/Ejercicio7.py
a592804fb5ae30da55551d9e29819887919db041
#Datos de entrada num=int(input("Ingrese un numero: ")) # Proceso if num==10: print("Calificacion: A") elif num==9: print("Calificacion: B") elif num==8: print("Calificacion: C") elif num==7 and num==6: print("Calificacion: D") elif num<=5 and num>=0: print("Calificacion: F")
[]
nairraghav/advent-of-code-2019
2015/day-2/part2.py
274a2a4a59a8be39afb323356c592af5e1921e54
ribbon_needed = 0 with open("input.txt", "r") as puzzle_input: for line in puzzle_input: length, width, height = [int(item) for item in line.split("x")] dimensions = [length, width, height] smallest_side = min(dimensions) dimensions.remove(smallest_side) second_smallest_side = min(dimensions) ribbon_n...
[]
aaronwJordan/Lean
Algorithm.Python/Alphas/GreenblattMagicFormulaAlgorithm.py
3486a6de56a739e44af274f421ac302cbbc98f8d
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Licen...
[((717, 739), 'clr.AddReference', 'AddReference', (['"""System"""'], {}), "('System')\n", (729, 739), False, 'from clr import AddReference\n'), ((740, 775), 'clr.AddReference', 'AddReference', (['"""QuantConnect.Common"""'], {}), "('QuantConnect.Common')\n", (752, 775), False, 'from clr import AddReference\n'), ((776, ...
axelbr/berkeley-cs182-deep-neural-networks
hw2/deeplearning/style_transfer.py
2bde27d9d5361d48dce7539d00b136209c1cfaa1
import numpy as np import torch import torch.nn.functional as F def content_loss(content_weight, content_current, content_target): """ Compute the content loss for style transfer. Inputs: - content_weight: Scalar giving the weighting for the content loss. - content_current: features of the curre...
[((4883, 4939), 'torch.square', 'torch.square', (['(img[(...), 1:, :-1] - img[(...), :-1, :-1])'], {}), '(img[(...), 1:, :-1] - img[(...), :-1, :-1])\n', (4895, 4939), False, 'import torch\n'), ((4938, 4994), 'torch.square', 'torch.square', (['(img[(...), :-1, 1:] - img[(...), :-1, :-1])'], {}), '(img[(...), :-1, 1:] -...
brittjay0104/rose6icse
submissions/available/Johnson-CausalTesting/Holmes/fuzzers/Peach/Transformers/Encode/HTMLDecode.py
7b24743b7a805b9ed094b67e4a08bad7894f0e84
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import xml.sax.saxutils from Peach.transformer import Transformer class HtmlDecode(Transformer): """Decode HTML en...
[]
AuraUAS/aura-core
src/archive/greatcircle.py
4711521074db72ba9089213e14455d89dc5306c0
# From: http://williams.best.vwh.net/avform.htm#GCF import math EPS = 0.0001 d2r = math.pi / 180.0 r2d = 180.0 / math.pi rad2nm = (180.0 * 60.0) / math.pi nm2rad = 1.0 / rad2nm nm2meter = 1852 meter2nm = 1.0 / nm2meter # p1 = (lat1(deg), lon1(deg)) # p2 = (lat2(deg), lon2(deg)) def course_and_dist(p1, p2): # thi...
[((690, 704), 'math.cos', 'math.cos', (['lat1'], {}), '(lat1)\n', (698, 704), False, 'import math\n'), ((1919, 1932), 'math.cos', 'math.cos', (['lat'], {}), '(lat)\n', (1927, 1932), False, 'import math\n'), ((1084, 1098), 'math.sin', 'math.sin', (['lat2'], {}), '(lat2)\n', (1092, 1098), False, 'import math\n'), ((1150,...
JoeCare/flask_geolocation_api
app/__init__.py
ad9ea0d22b738a7af8421cc57c972bd0e0fa80da
import connexion, os from connexion.resolver import RestyResolver from flask import json from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow # Globally accessible libraries db = SQLAlchemy() mm = Marshmallow() def init_app(): """Initialize the Connexion application.""" BASE_DIR...
[((210, 222), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (220, 222), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((228, 241), 'flask_marshmallow.Marshmallow', 'Marshmallow', ([], {}), '()\n', (239, 241), False, 'from flask_marshmallow import Marshmallow\n'), ((385, 414), 'os.path.join', 'os...
vkmanojk/Networks-VirtualLAN
RIPv2-Simulation/Router.py
52c6546da611a7a7b9fdea65c567b284664a99b4
''' Summary: Program that implements a routing deamon based on the RIP version 2 protocol from RFC2453. Usage: python3 Router.py <router_config_file> Configuration File: The user supplies a router configuration file of the format: [Setting...
[((15093, 15116), 'struct.calcsize', 'struct.calcsize', (['FORMAT'], {}), '(FORMAT)\n', (15108, 15116), False, 'import struct\n'), ((16427, 16450), 'struct.calcsize', 'struct.calcsize', (['FORMAT'], {}), '(FORMAT)\n', (16442, 16450), False, 'import struct\n'), ((6336, 6363), 'configparser.ConfigParser', 'configparser.C...
alowet/iblapps
atlaselectrophysiology/extract_files.py
9be936cd6806153dde0cbff1b6f2180191de3aeb
from ibllib.io import spikeglx import numpy as np import ibllib.dsp as dsp from scipy import signal from ibllib.misc import print_progress from pathlib import Path import alf.io as aio import logging import ibllib.ephys.ephysqc as ephysqc from phylib.io import alf _logger = logging.getLogger('ibllib') ...
[((287, 314), 'logging.getLogger', 'logging.getLogger', (['"""ibllib"""'], {}), "('ibllib')\n", (304, 314), False, 'import logging\n'), ((1104, 1176), 'ibllib.dsp.WindowGenerator', 'dsp.WindowGenerator', ([], {'ns': 'sglx.ns', 'nswin': 'rms_win_length_samples', 'overlap': '(0)'}), '(ns=sglx.ns, nswin=rms_win_length_sam...
shervinbdndev/Django-Shop
site_settings/models.py
baa4e7b91fbdd01ee591049c12cd9fbfaa434379
from django.db import models class SiteSettings(models.Model): site_name = models.CharField(max_length=200 , verbose_name='Site Name') site_url = models.CharField(max_length=200 , verbose_name='Site URL') site_address = models.CharField(max_length=300 , verbose_name='Site Address') site_phone = mode...
[((83, 141), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'verbose_name': '"""Site Name"""'}), "(max_length=200, verbose_name='Site Name')\n", (99, 141), False, 'from django.db import models\n'), ((158, 215), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'...
3DAlgoLab/vispy
examples/basics/visuals/line_prototype.py
91972307cf336674aad58198fb26b9e46f8f9ca1
# -*- coding: utf-8 -*- # vispy: gallery 10 # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import sys import numpy as np from vispy import app, gloo, visuals from vispy.visuals.filters import Clipper, ColorFilter from vispy.visual...
[((5805, 5891), 'vispy.app.Canvas', 'app.Canvas', ([], {'keys': '"""interactive"""', 'size': '(900, 600)', 'show': '(True)', 'title': '"""Visual Canvas"""'}), "(keys='interactive', size=(900, 600), show=True, title=\n 'Visual Canvas')\n", (5815, 5891), False, 'from vispy import app, gloo, visuals\n'), ((6096, 6141),...
Mou-Ikkai/h1st
h1st/tests/core/test_schemas_inferrer.py
da47a8f1ad6af532c549e075fba19e3b3692de89
from unittest import TestCase from datetime import datetime import pyarrow as pa import numpy as np import pandas as pd from h1st.schema import SchemaInferrer class SchemaInferrerTestCase(TestCase): def test_infer_python(self): inferrer = SchemaInferrer() self.assertEqual(inferrer.infer_schema(1)...
[((253, 269), 'h1st.schema.SchemaInferrer', 'SchemaInferrer', ([], {}), '()\n', (267, 269), False, 'from h1st.schema import SchemaInferrer\n'), ((1286, 1302), 'h1st.schema.SchemaInferrer', 'SchemaInferrer', ([], {}), '()\n', (1300, 1302), False, 'from h1st.schema import SchemaInferrer\n'), ((1708, 1724), 'h1st.schema.S...
nicolasessisbreton/pyzehe
c_core_librairies/exercise_a.py
7497a0095d974ac912ce9826a27e21fd9d513942
""" # refactoring Refactoring is the key to successfull projects. Refactor: 1) annuity_factor such that: conversion to integer is handled, no extra printing 2) policy_book into a class such that: a function generates the book and the premium stats and visualizations functions are avalaible 3) book_report su...
[]
harshitAgr/vess2ret
util/util.py
5702175bcd9ecde34d4fedab45a7cd2878a0184c
"""Auxiliary methods.""" import os import json from errno import EEXIST import numpy as np import seaborn as sns import cPickle as pickle import matplotlib.pyplot as plt sns.set() DEFAULT_LOG_DIR = 'log' ATOB_WEIGHTS_FILE = 'atob_weights.h5' D_WEIGHTS_FILE = 'd_weights.h5' class MyDict(dict): """ Dictionar...
[((172, 181), 'seaborn.set', 'sns.set', ([], {}), '()\n', (179, 181), True, 'import seaborn as sns\n'), ((1798, 1822), 'numpy.zeros', 'np.zeros', (['(h, 2 * w, ch)'], {}), '((h, 2 * w, ch))\n', (1806, 1822), True, 'import numpy as np\n'), ((2920, 2946), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 4)...
CakeCrusher/voon-video_processing
services/apiRequests.py
6ecaacf4e36baa72d713a92101b445885b3d95ef
from github import Github def parseGithubURL(url): splitURL = url.split('/') owner = splitURL[3] repo = splitURL[4] return { "owner": owner, "repo": repo } def fetchRepoFiles(owner, repo): files = [] g = Github('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') repo = g.get_rep...
[((249, 299), 'github.Github', 'Github', (['"""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"""'], {}), "('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')\n", (255, 299), False, 'from github import Github\n')]
HouchangX-AI/Dialog-Solution
utils/tricks.py
1f68f847d9c9c4a46ef0b5fc6a78014402a4dd7a
#-*- coding: utf-8 -*- import codecs import random from utils.global_names import GlobalNames, get_file_path def modify_tokens(tokens): new_tokens = [] pos = 0 len_ = len(tokens) while pos < len_: if tokens[pos] == "[": if pos+2 < len_ and tokens[pos+2] == "]": to...
[]
Jagadambass/Graph-Neural-Networks
test/functional/test_device.py
c8f1d87f8cd67d645c2f05f370be039acf05ca52
from graphgallery.functional import device import tensorflow as tf import torch def test_device(): # how about other backend? # tf assert isinstance(device("cpu", "tf"), str) assert device() == 'cpu' assert device("cpu", "tf") == 'CPU' assert device("cpu", "tf") == 'cpu' assert device("de...
[((496, 512), 'tensorflow.device', 'tf.device', (['"""cpu"""'], {}), "('cpu')\n", (505, 512), True, 'import tensorflow as tf\n'), ((597, 619), 'graphgallery.functional.device', 'device', (['"""cpu"""', '"""torch"""'], {}), "('cpu', 'torch')\n", (603, 619), False, 'from graphgallery.functional import device\n'), ((702, ...
krinj/hanabi-simulator
py_hanabi/card.py
b77b04aa09bab8bd8d7b784e04bf8b9d5d76d1a6
# -*- coding: utf-8 -*- """ A card (duh). """ import random import uuid from enum import Enum from typing import List from py_hanabi.settings import CARD_DECK_DISTRIBUTION __author__ = "Jakrin Juangbhanich" __email__ = "juangbhanich.k@gmail.com" class Color(Enum): RED = 1 BLUE = 2 GREEN = 3 YELLOW ...
[((3139, 3159), 'random.shuffle', 'random.shuffle', (['deck'], {}), '(deck)\n', (3153, 3159), False, 'import random\n'), ((497, 509), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (507, 509), False, 'import uuid\n')]
bigsassy/django-facetools
facetools/test/testcases.py
aeedaea81ab0007ee8e96b2f81f1404dc8bddb3c
import types import django.test.testcases from django.conf import settings from facetools.models import TestUser from facetools.common import _create_signed_request from facetools.test import TestUserNotLoaded from facetools.signals import sync_facebook_test_user, setup_facebook_test_client from facetools.common impor...
[((1433, 1475), 'facetools.common._get_facetools_test_fixture_name', '_get_facetools_test_fixture_name', (['app_name'], {}), '(app_name)\n', (1465, 1475), False, 'from facetools.common import _get_facetools_test_fixture_name\n'), ((947, 1054), 'facetools.common._create_signed_request', '_create_signed_request', (['sett...
d2gex/distpickymodel
setup.py
7acd4ffafbe592d6336d91d6e7411cd45357e41c
import setuptools import distpickymodel def get_long_desc(): with open("README.rst", "r") as fh: return fh.read() setuptools.setup( name="distpickymodel", version=distpickymodel.__version__, author="Dan G", author_email="daniel.garcia@d2garcia.com", description="A shared Mongoengine-...
[]
tinatasha/passwordgenerator
credentials_test.py
ad161e14779e975e98ad989c5df976ac3662f8d8
import unittest from password import Credentials class TestCredentials(unittest.TestCase): """ Class to test behaviour of the credentials class """ def setUp(self): """ Setup method that defines instructions """ self.new_credentials = Credentials("Github","Tina","blackfa...
[]
ufpa-organization-repositories/evolutionary-computing
homework_08/calc_fitness.py
e16786f9619e2b357b94ab91ff3a7b352e6a0d92
def calc_fitness(pop): from to_decimal import to_decimal from math import sin, sqrt for index, elem in enumerate(pop): # só atribui a fitness a cromossomos que ainda não possuem fitness # print(elem[0], elem[1]) x = to_decimal(elem[0]) y = to_decimal(elem[1]) # x = ...
[((254, 273), 'to_decimal.to_decimal', 'to_decimal', (['elem[0]'], {}), '(elem[0])\n', (264, 273), False, 'from to_decimal import to_decimal\n'), ((286, 305), 'to_decimal.to_decimal', 'to_decimal', (['elem[1]'], {}), '(elem[1])\n', (296, 305), False, 'from to_decimal import to_decimal\n'), ((375, 396), 'math.sqrt', 'sq...
jamenor/pichetprofile
pichetprofile/__init__.py
6633ea6eaa7473af9e10f34f6a19428c2db92465
# -*- coding: utf-8 -*- from oopschool.school import Student,Tesla,SpecialStudent,Teacher from oopschool.newschool import Test
[]
HPluseven/playground
leetcode/group2/461.py
78e363b5b376af3945bcb55a13d6a96b7c151a1b
class Solution: def hammingDistance(self, x: int, y: int) -> int: xor = x ^ y distance = 0 while xor: if xor & 1: distance += 1 xor = xor >> 1 return distance class Solution: def hammingDistance(self, x: int, y: int) -> int: xor =...
[]
pageuppeople-opensource/relational-data-loader
rdl/data_sources/DataSourceFactory.py
0bac7036d65636d06eacca4e68e09d6e1c506ea4
import logging from rdl.data_sources.MsSqlDataSource import MsSqlDataSource from rdl.data_sources.AWSLambdaDataSource import AWSLambdaDataSource class DataSourceFactory(object): def __init__(self, logger=None): self.logger = logger or logging.getLogger(__name__) self.sources = [MsSqlDataSource, AW...
[((249, 276), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (266, 276), False, 'import logging\n')]
alexmalins/kagglebook
ch05/ch05-02-timeseries.py
260f6634b6bbaa94c2e989770e75dc7101f5c614
# --------------------------------- # Prepare the data etc. # ---------------------------------- import numpy as np import pandas as pd # train_x is the training data, train_y is the target values, and test_x is the test data # stored in pandas DataFrames and Series (numpy arrays also used) train = pd.read_csv('../in...
[((302, 360), 'pandas.read_csv', 'pd.read_csv', (['"""../input/sample-data/train_preprocessed.csv"""'], {}), "('../input/sample-data/train_preprocessed.csv')\n", (313, 360), True, 'import pandas as pd\n'), ((437, 494), 'pandas.read_csv', 'pd.read_csv', (['"""../input/sample-data/test_preprocessed.csv"""'], {}), "('../i...
owo/jitalk
server/WitClient.py
2db2782282a2302b4cf6049030822734a6856982
#!/usr/bin/env python # -*- coding: utf-8 -*- import wit import json class WitClient(object): """docstring for WitClient""" _access_token = 'NBPOVLY7T6W3KOUEML2GXOWODH3LPWPD' def __init__(self): wit.init() def text_query(self, text): res = json.loads(wit.text_query(text, WitClient._access_token)) return ...
[]
Mohammed-Shoaib/HackerRank-Problems
HackerRank/Python/Easy/E0036.py
ccfb9fc2f0d8dff454439d75ce519cf83bad7c3b
# Problem Statement: https://www.hackerrank.com/challenges/itertools-combinations-with-replacement/problem from itertools import combinations_with_replacement S, k = input().split() for comb in combinations_with_replacement(sorted(S), int(k)): print(''.join(comb))
[]
hayyubi/visual-genome-driver
visual_genome/models.py
412223bf1552b1927fb1219cfcf90dcd2599bf34
""" Visual Genome Python API wrapper, models """ class Image: """ Image. ID int url hyperlink string width int height int """ def __init__(self, id, url, width, height, coco_id, flickr_id): self.id = id self.url = url self.width ...
[]
GayashanNA/my-scripts
python-scripts/plot_delay.py
d865e828c833d6b54c787ce9475da512f8488278
import csv import matplotlib.pyplot as plt import time PLOT_PER_WINDOW = False WINDOW_LENGTH = 60000 BINS = 1000 delay_store = {} perwindow_delay_store = {} plotting_delay_store = {} filename = "output-large.csv" # filename = "output.csv" # filename = "output-medium.csv" # filename = "output-small.csv" # filename = "...
[((2013, 2037), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Delay (ms)"""'], {}), "('Delay (ms)')\n", (2023, 2037), True, 'import matplotlib.pyplot as plt\n'), ((2038, 2063), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Probability"""'], {}), "('Probability')\n", (2048, 2063), True, 'import matplotlib.pyplot as ...
peterthorpe5/Methods_M.cerasi_R.padi_genome_assembly
python_scripts/BUSCO_phylogenetics/rename_all_fa_seq.py
c6cb771afaf40f5def47e33ff11cd8867ec528e0
#!/usr/bin/env python # author: Peter Thorpe September 2015. The James Hutton Insitute, Dundee, UK. # title rename single copy busco genes from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from Bio import SeqIO import os from sys import stdin,argv import sys from optparse import OptionParser ###############...
[]
afeld/api-snippets
video/rest/compositionhooks/delete-hook/delete-hook.6.x.py
d77456c387c9471d36aa949e2cf785d8a534a370
# Download the Python helper library from twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/console api_key_sid = 'SKXXXX' api_key_secret = 'your_api_key_secret' client = Client(api_key_sid, api_key_secret) did_delete = client.video\ .c...
[((234, 269), 'twilio.rest.Client', 'Client', (['api_key_sid', 'api_key_secret'], {}), '(api_key_sid, api_key_secret)\n', (240, 269), False, 'from twilio.rest import Client\n')]
AkagiYui/AzurLaneTool
global_info.py
f00fa6e5c6371db72ee399d7bd178a81f39afd8b
from time import sleep debug_mode = False time_to_exit = False exiting = False exit_code = 0 def get_debug_mode(): return debug_mode def trigger_exit(_exit_code): global time_to_exit, exit_code exit_code = _exit_code time_to_exit = True sleep(0.1)
[((263, 273), 'time.sleep', 'sleep', (['(0.1)'], {}), '(0.1)\n', (268, 273), False, 'from time import sleep\n')]
slowy07/tensorflow-model-research
advesarial_text/data/data_utils_test.py
48ba4ba6240452eb3e3350fe7099f2b045acc530
from __future__ import absoulte_import from __future__ import division from __future__ import print_function import tensorflow as tf from data import data_utils data = data_utils class SequenceWrapperTest(tf.test.TestCase): def testDefaultTimesteps(self): seq = data.SequenceWrapper() t1 = seq....
[((6909, 6923), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (6921, 6923), True, 'import tensorflow as tf\n')]
arush15june/wagtail-torchbox
headlesspreview/apps.py
c4d06e096c72bd8007975dc016133024f9d27fab
from django.apps import AppConfig class HeadlesspreviewConfig(AppConfig): name = 'headlesspreview'
[]
revbucket/LipSDP
LipSDP/solve_sdp.py
39f2ffe65cb656440e055e4e86a750bc7e77e357
import argparse import numpy as np import matlab.engine from scipy.io import savemat import os from time import time def main(args): start_time = time() eng = matlab.engine.start_matlab() eng.addpath(os.path.join(file_dir, 'matlab_engine')) eng.addpath(os.path.join(file_dir, r'matlab_engine/weight_uti...
[((152, 158), 'time.time', 'time', ([], {}), '()\n', (156, 158), False, 'from time import time\n'), ((1347, 1372), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1370, 1372), False, 'import argparse\n'), ((214, 253), 'os.path.join', 'os.path.join', (['file_dir', '"""matlab_engine"""'], {}), "(...
chihyi-liao/stockprophet
stockprophet/__init__.py
891c91b2a446e3bd30bb56b88be3874d7dda1b8d
from stockprophet.cli import entry_point from stockprophet.crawler import ( init_stock_type, init_stock_category ) from stockprophet.db import init_db from .utils import read_db_settings def preprocessing() -> bool: result = False # noinspection PyBroadException try: db_config = read_db_setti...
[((561, 579), 'stockprophet.db.init_db', 'init_db', (['db_config'], {}), '(db_config)\n', (568, 579), False, 'from stockprophet.db import init_db\n'), ((588, 609), 'stockprophet.crawler.init_stock_category', 'init_stock_category', ([], {}), '()\n', (607, 609), False, 'from stockprophet.crawler import init_stock_type, i...
mpcjanssen/Advent-of-Code
2021/day_25.py
06c5257d038bfcd3d4790f3213afecb5c36d5c61
import aoc_helper RAW = aoc_helper.day(25) print(RAW) def parse_raw(): ... DATA = parse_raw() def part_one(): ... def part_two(): ... aoc_helper.submit(25, part_one) aoc_helper.submit(25, part_two)
[((25, 43), 'aoc_helper.day', 'aoc_helper.day', (['(25)'], {}), '(25)\n', (39, 43), False, 'import aoc_helper\n'), ((152, 183), 'aoc_helper.submit', 'aoc_helper.submit', (['(25)', 'part_one'], {}), '(25, part_one)\n', (169, 183), False, 'import aoc_helper\n'), ((184, 215), 'aoc_helper.submit', 'aoc_helper.submit', (['(...
Hunter1753/adventofcode
6/6.2.py
962df52af01f6ab575e8f00eb2d1c1335dba5430
def setIntersectionCount(group): return len(set.intersection(*group)) groupList = [] tempGroup = [] with open("./6/input.txt") as inputFile: for line in inputFile: line = line.replace("\n","") if len(line) > 0: tempGroup.append(set(line)) else: groupList.append(tempGroup) tempGroup = [] if len(tempGr...
[]
ZichaoGuo/PaddleSlim
demo/gpnas/CVPR2021_NAS_competition_gpnas_demo.py
2550fb4ec86aee6155c1c8a2c9ab174e239918a3
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License" # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
[((2078, 2085), 'paddleslim.nas.GPNAS', 'GPNAS', ([], {}), '()\n', (2083, 2085), False, 'from paddleslim.nas import GPNAS\n'), ((1260, 1272), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1269, 1272), False, 'import json\n'), ((1480, 1495), 'numpy.array', 'np.array', (['X_all'], {}), '(X_all)\n', (1488, 1495), True,...
yogeshprasad/spa-development
pages/migrations/0004_auto_20181102_0944.py
1bee9ca64da5815e1c9a2f7af43b44b59ee2ca7b
# Generated by Django 2.0.6 on 2018-11-02 09:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pages', '0003_coachingcourse'), ] operations = [ migrations.AlterField( model_name='coachingcourse', name='username'...
[((340, 384), 'django.db.models.CharField', 'models.CharField', ([], {'default': '""""""', 'max_length': '(100)'}), "(default='', max_length=100)\n", (356, 384), False, 'from django.db import migrations, models\n')]
waikato-datamining/keras-imaging
imageclassification/src/sample/splitters/_StratifiedSplitter.py
f044f883242895c18cfdb31a827bc32bdb0405ed
from collections import OrderedDict from random import Random from typing import Set from .._types import Dataset, Split, LabelIndices from .._util import per_label from ._RandomSplitter import RandomSplitter from ._Splitter import Splitter class StratifiedSplitter(Splitter): """ TODO """ def __init_...
[((386, 394), 'random.Random', 'Random', ([], {}), '()\n', (392, 394), False, 'from random import Random\n'), ((894, 907), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (905, 907), False, 'from collections import OrderedDict\n'), ((909, 922), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (92...
YuraHavrylko/revenuecat_python
revenuecat_python/enums.py
a25b234933b6e80e1ff09b6a82d73a0e3df91caa
from enum import Enum class SubscriptionPlatform(Enum): ios = 'ios' android = 'android' macos = 'macos' uikitformac = 'uikitformac' stripe = 'stripe' class AttributionNetworkCode(Enum): apple_search_ads = 0 adjust = 1 apps_flyer = 2 branch = 3 tenjin = 4 facebook = 5
[]
codeproject/DeepStack
windows_packages_gpu/torch/nn/intrinsic/qat/modules/linear_relu.py
d96368a3db1bc0266cb500ba3701d130834da0e6
from __future__ import absolute_import, division, print_function, unicode_literals import torch.nn.qat as nnqat import torch.nn.intrinsic import torch.nn.functional as F class LinearReLU(nnqat.Linear): r""" A LinearReLU module fused from Linear and ReLU modules, attached with FakeQuantize modules f...
[]
temelkirci/Motion_Editor
venv/Lib/site-packages/PyOpenGL-3.0.1/OpenGL/GL/EXT/draw_buffers2.py
a8b8d4c4d2dcc9be28385600f56066cef92a38ad
'''OpenGL extension EXT.draw_buffers2 This module customises the behaviour of the OpenGL.raw.GL.EXT.draw_buffers2 to provide a more Python-friendly API Overview (from the spec) This extension builds upon the ARB_draw_buffers extension and provides separate blend enables and color write masks for each color outp...
[]
liquidpele/pymemcache
pymemcache/client/retrying.py
0001f94a06b91078ed7b7708729ef0d1aaa73a68
""" Module containing the RetryingClient wrapper class. """ from time import sleep def _ensure_tuple_argument(argument_name, argument_value): """ Helper function to ensure the given arguments are tuples of Exceptions (or subclasses), or can at least be converted to such. Args: argument_name: s...
[((5561, 5585), 'time.sleep', 'sleep', (['self._retry_delay'], {}), '(self._retry_delay)\n', (5566, 5585), False, 'from time import sleep\n')]
HuaichenOvO/EIE3280HW
8.1.py
e1424abb8baf715a4e9372e2ca6b0bed1e62f3d6
import numpy as np import numpy.linalg as lg A_mat = np.matrix([ [0, 1, 1, 1, 0], [1, 0, 0, 0, 1], [1, 0, 0, 1, 1], [1, 0, 1, 0, 1], [0, 1, 1, 1, 0] ]) eigen = lg.eig(A_mat) # return Arr[5] with 5 different linear independent eigen values vec = eigen[1][:, 0] # the column (eigen vect...
[((57, 158), 'numpy.matrix', 'np.matrix', (['[[0, 1, 1, 1, 0], [1, 0, 0, 0, 1], [1, 0, 0, 1, 1], [1, 0, 1, 0, 1], [0, 1,\n 1, 1, 0]]'], {}), '([[0, 1, 1, 1, 0], [1, 0, 0, 0, 1], [1, 0, 0, 1, 1], [1, 0, 1, 0, \n 1], [0, 1, 1, 1, 0]])\n', (66, 158), True, 'import numpy as np\n'), ((193, 206), 'numpy.linalg.eig', 'l...
Abulhusain/E-learing
classroom/migrations/0025_myfile_file.py
65cfe3125f1b6794572ef2daf89917976f0eac09
# Generated by Django 2.2.2 on 2019-08-25 09:29 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('classroom', '0024_auto_20190825_1723'), ] operations = [ migrations.AddField( model_name='myfile', name='file', ...
[((334, 378), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(100)'}), '(blank=True, max_length=100)\n', (350, 378), False, 'from django.db import migrations, models\n')]
rolfberkenbosch/python-jumbo-api
jumbo_api/objects/profile.py
9ca35cbea6225dcc6108093539e76f110b1840b0
from jumbo_api.objects.store import Store class Profile(object): def __init__(self, data): self.id = data.get("identifier") self.store = Store(data.get("store")) def __str__(self): return f"{self.id} {self.store}"
[]
hankai17/test
tmp/real_time_log_analy/logWatcher.py
8f38d999a7c6a92eac94b4d9dc8e444619d2144f
#!/usr/bin/env python import os import sys import time import errno import stat import datetime import socket import struct import atexit import logging #from lru import LRUCacheDict from logging import handlers from task_manager import Job, taskManage from ctypes import * from urlparse import * from multiprocessing ...
[]
jonathonfletcher/LazyBlacksmith
lazyblacksmith/views/ajax/__init__.py
f244f0a15c795707b64e7cc53f82c6d6270691b5
# -*- encoding: utf-8 -*- from flask import request from lazyblacksmith.utils.request import is_xhr import logging logger = logging.getLogger('lb.ajax') def is_not_ajax(): """ Return True if request is not ajax This function is used in @cache annotation to not cache direct call (http 40...
[((132, 160), 'logging.getLogger', 'logging.getLogger', (['"""lb.ajax"""'], {}), "('lb.ajax')\n", (149, 160), False, 'import logging\n'), ((348, 363), 'lazyblacksmith.utils.request.is_xhr', 'is_xhr', (['request'], {}), '(request)\n', (354, 363), False, 'from lazyblacksmith.utils.request import is_xhr\n')]
logic-and-learning/AdvisoRL
src/automata_learning_with_policybank/Traces.py
3bbd741e681e6ea72562fec142d54e9d781d097d
import os class Traces: def __init__(self, positive = set(), negative = set()): self.positive = positive self.negative = negative """ IG: at the moment we are adding a trace only if it ends up in an event. should we be more restrictive, e.g. consider xxx, the same as xxxxxxxxxx (wher...
[((5457, 5482), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (5472, 5482), False, 'import os\n'), ((5491, 5530), 'os.makedirs', 'os.makedirs', (['parent_path'], {'exist_ok': '(True)'}), '(parent_path, exist_ok=True)\n', (5502, 5530), False, 'import os\n')]
edwilding/django-comments-xtd
example/comp/urls.py
c3a335b6345b52c75cce69c66b7cf0ef72439d35
import django from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns if django.VERSION[:2] > (1, 9): from django.views.i18n import JavaScriptCatalog else: from django.views.i18n import javas...
[((472, 492), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (490, 492), False, 'from django.contrib import admin\n'), ((1626, 1651), 'django.contrib.staticfiles.urls.staticfiles_urlpatterns', 'staticfiles_urlpatterns', ([], {}), '()\n', (1649, 1651), False, 'from django.contrib.staticfile...
jumploop/high_performance_python
09_multiprocessing/prime_validation/primes_factor_test.py
da5b11735601b51f141975f9d59f14293cab16bb
import math import time def check_prime(n): if n % 2 == 0: return False, 2 for i in range(3, int(math.sqrt(n)) + 1): if n % i == 0: return False, i return True, None if __name__ == "__main__": primes = [] t1 = time.time() # 100109100129100151 big prime # htt...
[((262, 273), 'time.time', 'time.time', ([], {}), '()\n', (271, 273), False, 'import time\n'), ((1306, 1317), 'time.time', 'time.time', ([], {}), '()\n', (1315, 1317), False, 'import time\n'), ((1702, 1713), 'time.time', 'time.time', ([], {}), '()\n', (1711, 1713), False, 'import time\n'), ((115, 127), 'math.sqrt', 'ma...
hagabb/katana
python/test/test_dynamic_bitset.py
a52a688b90315a79aa95cf8d279fd7f949a3b94b
import pytest from katana.dynamic_bitset import DynamicBitset __all__ = [] SIZE = 50 @pytest.fixture def dbs(): return DynamicBitset(SIZE) def test_set(dbs): dbs[10] = 1 assert dbs[10] def test_set_invalid_type(dbs): try: dbs[2.3] = 0 assert False except TypeError: p...
[((128, 147), 'katana.dynamic_bitset.DynamicBitset', 'DynamicBitset', (['SIZE'], {}), '(SIZE)\n', (141, 147), False, 'from katana.dynamic_bitset import DynamicBitset\n')]
kopp/python-astar
tests/basic/test_basic.py
642dd4bcef9829776614dc0f12681ac94634a3bc
import unittest import astar class BasicTests(unittest.TestCase): def test_bestpath(self): """ensure that we take the shortest path, and not the path with less elements. the path with less elements is A -> B with a distance of 100 the shortest path is A -> C -> D -> B with a distanc...
[((1010, 1025), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1023, 1025), False, 'import unittest\n'), ((719, 841), 'astar.find_path', 'astar.find_path', (['"""A"""', '"""B"""'], {'neighbors_fnct': 'neighbors', 'heuristic_cost_estimate_fnct': 'cost', 'distance_between_fnct': 'distance'}), "('A', 'B', neighbors_...
abdza/skyrim_formulas
potions.py
bf6be3c82715cfde89810d6e6183c95a55a4414c
#!/bin/env python3 import csv def intersect(list1,list2): list3 = [ value for value in list1 if value in list2] return list3 def category(list1,effects): cat = 'Good' good = 0 bad = 0 for ing in list1: if effects[ing]=='Good': good += 1 else: bad += 1 ...
[((550, 584), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (560, 584), False, 'import csv\n'), ((755, 789), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (765, 789), False, 'import csv\n'), ((2176, 2215), 'csv.wri...
IceT-M/ctm-python-client
src/clients/ctm_api_client/models/user_additional_properties.py
0ef1d8a3c9a27a01c088be1cdf5d177d25912bac
# coding: utf-8 """ Control-M Services Provides access to BMC Control-M Services # noqa: E501 OpenAPI spec version: 9.20.215 Contact: customer_support@bmc.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from clients.ct...
[((4118, 4151), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (4131, 4151), False, 'import six\n'), ((1445, 1460), 'clients.ctm_api_client.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1458, 1460), False, 'from clients.ctm_api_client.configuration import C...
harshasunder-1/pyleecan
Tests/Methods/Mesh/Interpolation/test_interpolation.py
32ae60f98b314848eb9b385e3652d7fc50a77420
# -*- coding: utf-8 -*- import pytest import numpy as np from unittest import TestCase from pyleecan.Classes.CellMat import CellMat from pyleecan.Classes.MeshSolution import MeshSolution from pyleecan.Classes.PointMat import PointMat from pyleecan.Classes.MeshMat import MeshMat from pyleecan.Classes.ScalarProductL2 i...
[((666, 675), 'pyleecan.Classes.MeshMat.MeshMat', 'MeshMat', ([], {}), '()\n', (673, 675), False, 'from pyleecan.Classes.MeshMat import MeshMat\n'), ((704, 729), 'pyleecan.Classes.CellMat.CellMat', 'CellMat', ([], {'nb_pt_per_cell': '(2)'}), '(nb_pt_per_cell=2)\n', (711, 729), False, 'from pyleecan.Classes.CellMat impo...
ecarg/grace
lib/models.py
8c1540116c07648f7d8852ee5e9edff33b6ae2f6
# -*- coding: utf-8 -*- """ Pytorch models __author__ = 'Jamie (krikit@naver.com)' __copyright__ = 'No copyright. Just copyleft!' """ # pylint: disable=no-member # pylint: disable=invalid-name ########### # imports # ########### import torch import torch.nn as nn from embedder import Embedder from pos_models impo...
[((1783, 1808), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1806, 1808), False, 'import torch\n'), ((1880, 1905), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1903, 1905), False, 'import torch\n'), ((2126, 2151), 'torch.cuda.is_available', 'torch.cuda.is_availabl...
BioGeek/pyseqlogo
pyseqlogo/__init__.py
e41d9645c7a9fa5baf3deab281acf40ea5357f64
# -*- coding: utf-8 -*- """Top-level package for pyseqlogo.""" __author__ = """Saket Choudhary""" __email__ = 'saketkc@gmail.com' __version__ = '0.1.0' from .pyseqlogo import draw_logo from .pyseqlogo import setup_axis
[]
edulix/apscheduler
setup.py
8030e0fc7e1845a15861e649988cc73a1aa624ec
# coding: utf-8 import os.path try: from setuptools import setup extras = dict(zip_safe=False, test_suite='nose.collector', tests_require=['nose']) except ImportError: from distutils.core import setup extras = {} import apscheduler here = os.path.dirname(__file__) readme_path = os.path.join(here, 'R...
[((367, 1212), 'distutils.core.setup', 'setup', ([], {'name': '"""APScheduler"""', 'version': 'apscheduler.release', 'description': '"""In-process task scheduler with Cron-like capabilities"""', 'long_description': 'readme', 'author': '"""Alex Gronholm"""', 'author_email': '"""apscheduler@nextday.fi"""', 'url': '"""htt...
travisyates81/object-detection
object_detection/exporter_test.py
931bebfa54798c08d2c401e9c1bad39015d8c832
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Travis Yates """Tests for object_detection.export_inference_graph.""" import os import mock import numpy as np import tensorflow as tf from object_detection import exporter from object_detection.builders import model_builder from object_detection.core i...
[((9561, 9575), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (9573, 9575), True, 'import tensorflow as tf\n'), ((1516, 1526), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (1524, 1526), True, 'import tensorflow as tf\n'), ((2004, 2014), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (2012, 2014), Tr...
matthewyoung28/macmentum
run.py
af1a26903e25b4a4f278388d7be1e638e071c0a8
import os import sys import random def get_next_wallpaper(curr_path): lst_dir = os.listdir() rand_index = random.randint(0, len(lst_dir) - 1) return lst_dir[rand_index] def get_wall_dir(): return "/Users/MYOUNG/Pictures/mmt" def main(): script = "osascript -e 'tell application \"Finder\" to s...
[((86, 98), 'os.listdir', 'os.listdir', ([], {}), '()\n', (96, 98), False, 'import os\n'), ((514, 531), 'os.system', 'os.system', (['script'], {}), '(script)\n', (523, 531), False, 'import os\n')]
dolfno/mlops_demo
noxfile.py
52a04525f1655a32d45002384a972a1920fd517a
"""Automated CI tools to run with Nox""" import nox from nox import Session locations = "src", "noxfile.py", "docs/conf.py" nox.options.sessions = "lint", "tests" @nox.session(python="3.9") def tests(session: Session) -> None: """Run tests with nox""" session.run("poetry", "install", external=True) sessi...
[((167, 192), 'nox.session', 'nox.session', ([], {'python': '"""3.9"""'}), "(python='3.9')\n", (178, 192), False, 'import nox\n'), ((349, 374), 'nox.session', 'nox.session', ([], {'python': '"""3.9"""'}), "(python='3.9')\n", (360, 374), False, 'import nox\n'), ((728, 753), 'nox.session', 'nox.session', ([], {'python': ...
canerbulduk/cocotb-test
cocotb_test/run.py
ece092446a1e5de932db12dfb60441d6f322d5f1
import cocotb_test.simulator # For partial back compatibility def run(simulator=None, **kwargs): if simulator: sim = simulator(**kwargs) sim.run() else: cocotb_test.simulator.run(**kwargs)
[]
hamzabouissi/kanban_backend
kanban_backend/project_management/apps.py
549d8c2711313011f3186b5b3a3ac969481df3f7
from django.apps import AppConfig class ProjectManagementConfig(AppConfig): name = 'kanban_backend.project_management' def ready(self): try: import kanban_backend.users.signals # noqa F401 except ImportError: pass
[]
davidhozic/Discord-Shiller
src/framework/tracing.py
ff22bb1ceb7b4128ee0d27f3c9c9dd0a5279feb9
""" ~ Tracing ~ This modules containes functions and classes related to the console debug long or trace. """ from enum import Enum, auto import time __all__ = ( "TraceLEVELS", "trace" ) m_use_debug = None class TraceLEVELS(Enum): """ Info: Level of trace for debug """ NORMAL...
[((339, 345), 'enum.auto', 'auto', ([], {}), '()\n', (343, 345), False, 'from enum import Enum, auto\n'), ((359, 365), 'enum.auto', 'auto', ([], {}), '()\n', (363, 365), False, 'from enum import Enum, auto\n'), ((625, 641), 'time.localtime', 'time.localtime', ([], {}), '()\n', (639, 641), False, 'import time\n')]
jeffreypaul15/sunkit-image
sunkit_image/__init__.py
0987db8fcd38c79a83d7d890e407204e63a05c4f
""" sunkit-image ============ A image processing toolbox for Solar Physics. * Homepage: https://sunpy.org * Documentation: https://sunkit-image.readthedocs.io/en/latest/ """ import sys from .version import version as __version__ # NOQA # Enforce Python version check during package import. __minimum_python_version_...
[]
lucasblazzi/stocker
app/view.py
52cdec481ed84a09d97369ee4da229e169f99f51
import plotly.graph_objects as go import plotly.express as px import pandas as pd class View: def __init__(self, st): self.st = st self.st.set_page_config(layout='wide') self.side_bar = st.sidebar def show_message(self, location, _type, message): if location == "sb": ...
[((3491, 3502), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (3500, 3502), True, 'import plotly.graph_objects as go\n'), ((12580, 12603), 'pandas.DataFrame', 'pd.DataFrame', (['companies'], {}), '(companies)\n', (12592, 12603), True, 'import pandas as pd\n'), ((12618, 12735), 'plotly.express.bar', 'px....
ProhardONE/python_primer
ch_4/stopping_length.py
211e37c1f2fd169269fc4f3c08e8b7e5225f2ad0
# Exercise 4.11 # Author: Noah Waterfield Price import sys g = 9.81 # acceleration due to gravity try: # initial velocity (convert to m/s) v0 = (1000. / 3600) * float(sys.argv[1]) mu = float(sys.argv[2]) # coefficient of friction except IndexError: print 'Both v0 (in km/s) and mu must be supplied on...
[]
GeorgeIoak/Oden
TestFiles/volumioTest.py
9bb6a5811e2ea40ceef67e46bc56eab1be9ce06c
# Testing code to check update status on demand from socketIO_client import SocketIO, LoggingNamespace from threading import Thread socketIO = SocketIO('localhost', 3000) status = 'pause' def on_push_state(*args): print('state', args) global status, position, duration, seek status = args[0]['s...
[((144, 171), 'socketIO_client.SocketIO', 'SocketIO', (['"""localhost"""', '(3000)'], {}), "('localhost', 3000)\n", (152, 171), False, 'from socketIO_client import SocketIO, LoggingNamespace\n'), ((640, 683), 'threading.Thread', 'Thread', ([], {'target': '_receive_thread', 'daemon': '(True)'}), '(target=_receive_thread...