repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
superhasduper/PythonGames
levels/sombie.py
64995d3e0b619006a2cf80d0da3c0fdf97db6fd9
import arcade import os SPRITE_SCALING = 0.5 SPRITE_NATIVE_SIZE = 128 SPRITE_SIZE = int(SPRITE_NATIVE_SIZE * SPRITE_SCALING) SCREEN_WIDTH = SPRITE_SIZE * 14 SCREEN_HEIGHT = SPRITE_SIZE * 10 MOVEMENT_SPEED = 5 COIN_SCALE = 0.7 class Room: """ This class holds all the information about the ...
[((1087, 1106), 'arcade.SpriteList', 'arcade.SpriteList', ([], {}), '()\n', (1104, 1106), False, 'import arcade\n'), ((1129, 1148), 'arcade.SpriteList', 'arcade.SpriteList', ([], {}), '()\n', (1146, 1148), False, 'import arcade\n'), ((1171, 1190), 'arcade.SpriteList', 'arcade.SpriteList', ([], {}), '()\n', (1188, 1190)...
Guillaume-Fernandez/phishfinder
venv/lib/python3.6/site-packages/gevent/testing/openfiles.py
b459a30202fd5dfb1340b43c70363705de7cedd9
# Copyright (c) 2018 gevent community # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, di...
[((2976, 3000), 'os.path.exists', 'os.path.exists', (['"""/proc/"""'], {}), "('/proc/')\n", (2990, 3000), False, 'import os\n'), ((1343, 1392), 'unittest.SkipTest', 'unittest.SkipTest', (['"""lsof not expected on Windows"""'], {}), "('lsof not expected on Windows')\n", (1360, 1392), False, 'import unittest\n'), ((1458,...
ct-clmsn/distributed-tensorflow-orchestration
examples/multiprocess_example.py
c841659881e98209149bd6e3e09774a50e3c748e
''' marathon_example.py performs a simple matrix multiply using 3 compute nodes ''' def parseargs(): parser = argparse.ArgumentParser(description='Marathon for TensorFlow.') parser.add_argument('--n_tasks', default=1, help='an integer for the accumulator') parser.add_argument('--cpu', default=100.0, ...
[]
Awannaphasch2016/CDKFAUCovid19Cralwer
FAUCovidCrawler/AWSLambda/lambda_function.py
a84d90612314cb4d4618da95238617a524b1b280
''' Original code contributor: mentzera Article link: https://aws.amazon.com/blogs/big-data/building-a-near-real-time-discovery-platform-with-aws/ ''' import boto3 import json import twitter_to_es # from Examples.Demo.AWS_Related.TwitterStreamWithAWS.LambdaWithS3Trigger import \ # twitter_to_es from tweet_utils i...
[((425, 443), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (437, 443), False, 'import boto3\n'), ((461, 484), 'boto3.client', 'boto3.client', (['"""kinesis"""'], {}), "('kinesis')\n", (473, 484), False, 'import boto3\n'), ((2209, 2235), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "(...
everaccountable/django-user-messages
user_messages/context_processors.py
101d539b785bdb440bf166fb16ad25eb66e4174a
from django.contrib.messages.constants import DEFAULT_LEVELS from user_messages.api import get_messages def messages(request): """ Return a lazy 'messages' context variable as well as 'DEFAULT_MESSAGE_LEVELS'. """ return { "messages": get_messages(request=request), "DEFAULT_MESSAG...
[((266, 295), 'user_messages.api.get_messages', 'get_messages', ([], {'request': 'request'}), '(request=request)\n', (278, 295), False, 'from user_messages.api import get_messages\n')]
ecanro/100DaysOfCode_Python
Day_5/highest_score.py
a86ebe5a793fd4743e0de87454ba76925efdd23d
## Highest Score # 🚨 Don't change the code below 👇 student_scores = input("Input a list of student scores: ").split() for n in range(0, len(student_scores)): student_scores[n] = int(student_scores[n]) print(student_scores) # 🚨 Don't change the code above 👆 # Write your code below this row 👇 highest_score = 0...
[]
zaixizhang/MGSSL
finetune/finetune.py
fdb7e78bb927d735ed64dc78fb792adb13352e1c
import argparse from loader import MoleculeDataset from torch_geometric.data import DataLoader import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tqdm import tqdm import numpy as np from model import GNN, GNN_graphpred from sklearn.metrics import roc_auc_score from ...
[((464, 502), 'torch.nn.BCEWithLogitsLoss', 'nn.BCEWithLogitsLoss', ([], {'reduction': '"""none"""'}), "(reduction='none')\n", (484, 502), True, 'import torch.nn as nn\n'), ((2369, 2476), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch implementation of pre-training of graph neura...
threefoldtech/js-sdk
jumpscale/packages/vdc_dashboard/bottle/api/exceptions.py
811f783ac34a60225175bab2d806802a87b9d5c7
from jumpscale.core import exceptions class BaseError(exceptions.Base): """a generic base error for bcdb rest, with status code""" def __init__(self, status, *args, **kwargs): super().__init__(*args, *kwargs) self.status = status class VDCNotFound(BaseError): pass class MissingAuthori...
[]
gutierrezps/NeuroKit
neurokit2/signal/signal_plot.py
a30f76e64b4108abdc652a20391dc0288c62501d
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np import pandas as pd from ..events import events_plot from ..stats import standardize as nk_standardize def signal_plot( signal, sampling_rate=None, subplots=False, standardize=False, labels=None, **kwargs ): """Plot signal with events...
[((5581, 5606), 'matplotlib.pyplot.legend', 'plt.legend', (['labels'], {'loc': '(1)'}), '(labels, loc=1)\n', (5591, 5606), True, 'import matplotlib.pyplot as plt\n'), ((2079, 2093), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2091, 2093), True, 'import pandas as pd\n'), ((2599, 2631), 'pandas.DataFrame', 'pd...
MTES-MCT/mobilic-api
migrations/versions/1a89721126f7_only_one_validation_per_mission_user_.py
b3754de2282262fd60a27dc90e40777df9c1e230
"""Only one validation per mission, user and actor Revision ID: 1a89721126f7 Revises: fa96dfc8237d Create Date: 2021-10-14 11:22:01.124488 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "1a89721126f7" down_revision = "fa96dfc8237d" branch_labels = None depends...
[((352, 756), 'alembic.op.execute', 'op.execute', (['"""\n WITH validation_duplicates AS (\n SELECT\n id,\n ROW_NUMBER() OVER (PARTITION BY user_id, mission_id, submitter_id ORDER BY reception_time DESC) AS rn\n FROM mission_validation\n )\n DELET...
Falcons-Robocup/code
packages/facilities/rtdb/python/rtdb2_get.py
2281a8569e7f11cbd3238b7cc7341c09e2e16249
# Copyright 2020 Jan Feitsma (Falcons) # SPDX-License-Identifier: Apache-2.0 #!/usr/bin/python import os import sys import argparse from rtdb2 import RtDB2Store, RTDB2_DEFAULT_PATH import rtdb2tools from hexdump import hexdump # Main structure of the program if __name__ == "__main__": # Argument parsing. des...
[((943, 1071), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'descriptionTxt', 'epilog': 'exampleTxt', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=descriptionTxt, epilog=exampleTxt,\n formatter_class=argparse.RawDescriptionHelpFormatter)\n', (966, 1071), Fa...
what3versin/reinforce_py
algorithms/A3C/atari/atari_env_deprecated.py
46769da50aea65346cd3a300b55306d25f1f2683
from __future__ import print_function from __future__ import division import os import gym import numpy as np from skimage.transform import resize from skimage.color import rgb2gray class Atari(object): s_dim = [84, 84, 1] a_dim = 3 def __init__(self, args, record_video=False): self.env = gym.m...
[((315, 349), 'gym.make', 'gym.make', (['"""BreakoutNoFrameskip-v4"""'], {}), "('BreakoutNoFrameskip-v4')\n", (323, 349), False, 'import gym\n'), ((2046, 2097), 'numpy.reshape', 'np.reshape', (['observ'], {'newshape': '(self.screen_size + [1])'}), '(observ, newshape=self.screen_size + [1])\n', (2056, 2097), True, 'impo...
NBCLab/nimare-paper
content/_build/jupyter_execute/macm.py
2b9e70febcfde4ca12420adc3c2910ff622252f2
#!/usr/bin/env python # coding: utf-8 # # Meta-Analytic Coactivation Modeling # In[1]: # First, import the necessary modules and functions import os from datetime import datetime import matplotlib.pyplot as plt from myst_nb import glue from repo2data.repo2data import Repo2Data import nimare start = datetime.now(...
[((307, 321), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (319, 321), False, 'from datetime import datetime\n'), ((428, 475), 'os.path.join', 'os.path.join', (['"""../binder/data_requirement.json"""'], {}), "('../binder/data_requirement.json')\n", (440, 475), False, 'import os\n'), ((486, 514), 'os.path....
Maikor/ydk-py
cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_IPSLA_ECHO_MIB.py
b86c4a7c570ae3b2c5557d098420446df5de4929
""" CISCO_IPSLA_ECHO_MIB This MIB module defines the templates for IP SLA operations of ICMP echo, UDP echo and TCP connect. The ICMP echo operation measures end\-to\-end response time between a Cisco router and any IP enabled device by computing the time taken between sending an ICMP echo request message to the d...
[((2360, 2687), 'collections.OrderedDict', 'OrderedDict', (["[('cipslaIcmpEchoTmplTable', ('cipslaicmpechotmpltable', CISCOIPSLAECHOMIB.\n CipslaIcmpEchoTmplTable)), ('cipslaUdpEchoTmplTable', (\n 'cipslaudpechotmpltable', CISCOIPSLAECHOMIB.CipslaUdpEchoTmplTable)), (\n 'cipslaTcpConnTmplTable', ('cipslatcpcon...
tkameyama/incubator-mxnet
example/model-parallel/matrix_factorization/train.py
47b0bdd00e7c5e1c9a448809b02e68c0e4b72e96
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[((978, 1018), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (997, 1018), False, 'import logging\n'), ((1029, 1184), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run model parallel version of matrix factorization"""', 'format...
nbfigueroa/franka_interactive_controllers
scripts/libfranka_gui_gripper_run.py
7befdd5fbaa3c7a83b931292fab39ab98754a60c
#!/usr/bin/env python3 import shlex from tkinter import * from tkinter import messagebox from psutil import Popen top = Tk() top.title("Franka Gripper Control") top.geometry("300x75") def open(): node_process = Popen(shlex.split('rosrun franka_interactive_controllers libfranka_gripper_run 1')) messagebox.showinfo...
[((301, 354), 'tkinter.messagebox.showinfo', 'messagebox.showinfo', (['"""Open Gripper"""', '"""Gripper Opened"""'], {}), "('Open Gripper', 'Gripper Opened')\n", (320, 354), False, 'from tkinter import messagebox\n'), ((499, 553), 'tkinter.messagebox.showinfo', 'messagebox.showinfo', (['"""Close Gripper"""', '"""Grippe...
zubtsov/competitive-programming
codeforces.com/1669F/solution.py
919d63130144347d7f6eddcf8f5bc2afb85fddf3
for i in range(int(input())): number_of_candies = int(input()) candies_weights = list(map(int, input().split())) bob_pos = number_of_candies - 1 alice_pos = 0 bob_current_weight = 0 alice_current_weight = 0 last_equal_candies_total_number = 0 while alice_pos <= bob_pos: if al...
[]
patriotemeritus/grr
client/client_build.py
bf2b9268c8b9033ab091e27584986690438bd7c3
#!/usr/bin/env python """This tool builds or repacks the client binaries. This handles invocations for the build across the supported platforms including handling Visual Studio, pyinstaller and other packaging mechanisms. """ import logging import os import platform import time # pylint: disable=unused-import from ...
[((7005, 7041), 'time.strftime', 'time.strftime', (['"""%Y-%m-%dT%H:%M:%S%z"""'], {}), "('%Y-%m-%dT%H:%M:%S%z')\n", (7018, 7041), False, 'import time\n'), ((7800, 7851), 'grr.lib.config_lib.CONFIG.Get', 'config_lib.CONFIG.Get', (['"""ClientBuilder.BuildTargets"""'], {}), "('ClientBuilder.BuildTargets')\n", (7821, 7851)...
naveena41/greyatom-python-for-data-science
Greyatom-projects/code.py
3aa63878ff12e0e8cdf0e63bafe9b4a2c082f7b1
# -------------- # Code starts here # Create the lists class_1 = ['geoffrey hinton', 'andrew ng', 'sebastian raschka', 'yoshu bengio'] class_2 = ['hilary mason', 'carla gentry', 'corinna cortes'] # Concatenate both the strings new_class = class_1+class_2 print(new_class) # Append the list new_class.append('p...
[]
jackblandin/ml-fairness-gym
environments/recommenders/recsim_wrapper_test.py
dce1feaacf2588e0a2d6187e896796241a25ed81
# coding=utf-8 # Copyright 2022 The ML Fairness Gym Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
[((1814, 1829), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (1827, 1829), False, 'from absl.testing import absltest\n'), ((1269, 1305), 'environments.recommenders.recsim_wrapper.RecsimWrapper', 'recsim_wrapper.RecsimWrapper', (['params'], {}), '(params)\n', (1297, 1305), False, 'from environments.r...
mernst32/dl-searchcode-code
moss_client_cli.py
504fe59df245ba123ad8ad6e45f03b17de6ef236
import argparse import csv import os from moss_client.core import submit_and_dl, parse_moss_reports data_folder = 'data' def handle_input(user_id, base_folder, parse, only_parse, join_file, batch): global data_folder abs_path = os.path.abspath(os.path.dirname(__file__)) root_data_folder = os.path.join(ab...
[((305, 340), 'os.path.join', 'os.path.join', (['abs_path', 'data_folder'], {}), '(abs_path, data_folder)\n', (317, 340), False, 'import os\n'), ((448, 508), 'os.path.join', 'os.path.join', (['root_data_folder', '"""links_to_moss_reports.html"""'], {}), "(root_data_folder, 'links_to_moss_reports.html')\n", (460, 508), ...
DiegoOrtegoP/Software
catkin_ws/src/localization/src/localization_node.py
4a07dd2dab29db910ca2e26848fa6b53b7ab00cd
#!/usr/bin/env python import rospy #from apriltags_ros.msg import AprilTagDetectionArray from duckietown_msgs.msg import AprilTagsWithInfos import tf2_ros from tf2_msgs.msg import TFMessage import tf.transformations as tr from geometry_msgs.msg import Transform, TransformStamped import numpy as np from localization imp...
[((6381, 6434), 'rospy.init_node', 'rospy.init_node', (['"""localization_node"""'], {'anonymous': '(False)'}), "('localization_node', anonymous=False)\n", (6396, 6434), False, 'import rospy\n'), ((6482, 6494), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (6492, 6494), False, 'import rospy\n'), ((1308, 1377), 'rospy.Su...
wusui/NCAA2019
gen_data/get_teams.py
d33a69926dc2d5355f33f9b69e39475c54d03c56
#!/usr/bin/python # pylint: disable=W0223 """ Get a list of teams """ from html.parser import HTMLParser import requests class ChkTeams(HTMLParser): """ Extract team names from page """ def __init__(self): HTMLParser.__init__(self) self.retval = [] def handle_starttag(self, tag, a...
[((640, 661), 'requests.get', 'requests.get', (['DATALOC'], {}), '(DATALOC)\n', (652, 661), False, 'import requests\n'), ((232, 257), 'html.parser.HTMLParser.__init__', 'HTMLParser.__init__', (['self'], {}), '(self)\n', (251, 257), False, 'from html.parser import HTMLParser\n')]
agustinhenze/mibs.snmplabs.com
pysnmp-with-texts/Nortel-MsCarrier-MscPassport-SubnetInterfaceMIB.py
1fc5c07860542b89212f4c8ab807057d9a9206c7
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-SubnetInterfaceMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-SubnetInterfaceMIB # Produced by pysmi-0.3.4 at Wed May 1 14:31:21 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5....
[]
omniscale/svgserver
svgserver/app.py
a98f75ec9547fda25941129e854af046ba8f5dfe
import codecs import tempfile from contextlib import closing from .cgi import CGIClient from .combine import CombineSVG from .mapserv import MapServer, InternalError from .tree import build_tree def _recursive_add_layer(nodes, params, svg, mapserver, translations): for node in nodes: group_name = format...
[((1413, 1437), 'tempfile.TemporaryFile', 'tempfile.TemporaryFile', ([], {}), '()\n', (1435, 1437), False, 'import tempfile\n'), ((2365, 2405), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (2384, 2405), False, 'import logging\n'), ((1933, 1971), 'codecs.open...
israillaky/ERPOSAPP11
11_app/script/purchase_order.py
90dd26213fecce7f6301bfa2f2356d8f5d3a8086
import frappe @frappe.whitelist() def filt_itemby_supplier(doctype, txt, searchfield, start, page_len, filters): return frappe.db.sql("""Select parent from `tabItem Supplier` where supplier= %s""",(filters.get("supplier"))); @frappe.whitelist() def filteritem(doctype, txt, searchfield, start, page_len, filters...
[((17, 35), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (33, 35), False, 'import frappe\n'), ((235, 253), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (251, 253), False, 'import frappe\n'), ((334, 444), 'frappe.db.sql', 'frappe.db.sql', (['"""select item_code, item_name, item_group, volume, i...
duttaprat/proteinGAN
src/common/bio/smiles.py
92b32192ab959e327e1d713d09fc9b40dc01d757
from common.bio.constants import SMILES_CHARACTER_TO_ID, ID_TO_SMILES_CHARACTER def from_smiles_to_id(data, column): """Converts sequences from smiles to ids Args: data: data that contains characters that need to be converted to ids column: a column of the dataframe that contains characters that ...
[]
yokoyama-flogics/ibp_monitor_2
test/lib_config_test.py
1a7df55a524ff3a7908df330e7e02c9f27e24ae0
import os import sys import unittest # Set Python search path to the parent directory sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from lib.config import * class TestLibConfig(unittest.TestCase): def test_config_noconfigfile(self): config = BeaconConfigParser('not_exist.cfg') wit...
[((974, 1000), 'unittest.main', 'unittest.main', ([], {'buffer': '(True)'}), '(buffer=True)\n', (987, 1000), False, 'import unittest\n'), ((116, 141), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (131, 141), False, 'import os\n')]
phdye/nimporter
tests/test_installation.py
64eccc74950811e03efdde50649e84ca1fe87ae4
""" Test to make sure that libraries built with Nimporter can be installed via Pip. """ import sys, os, subprocess, shutil, pkg_resources, json, warnings from pathlib import Path import pytest import nimporter PYTHON = 'python' if sys.platform == 'win32' else 'python3' PIP = 'pip' if shutil.which('pip') else 'pip3' ...
[((287, 306), 'shutil.which', 'shutil.which', (['"""pip"""'], {}), "('pip')\n", (299, 306), False, 'import sys, os, subprocess, shutil, pkg_resources, json, warnings\n'), ((825, 852), 'nimporter.cd', 'nimporter.cd', (['"""tests/proj1"""'], {}), "('tests/proj1')\n", (837, 852), False, 'import nimporter\n'), ((937, 949),...
bvanaken/pytorch-pretrained-BERT
hotpot_sample_dict.py
71c1660fb082fa5ebde4afd8c7db2bc96b80bb59
samples = { "2_brother_plays": { "question_parts": [range(1, 13), range(13, 17)], "sp_parts": [range(20, 43), range(50, 60)] } }
[]
alexander-sidorov/tms-z43
src/applications/blog/migrations/0003_post_author.py
61ecd204f5de4e97ff0300f6ef91c36c2bcda31c
# Generated by Django 3.1.7 on 2021-03-24 17:41 import django.db.models.deletion from django.conf import settings from django.db import migrations from django.db import models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("blo...
[((248, 305), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (279, 305), False, 'from django.db import migrations\n'), ((483, 602), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(...
mdop-wh/pulumi-aws
sdk/python/pulumi_aws/cloudformation/stack_set.py
05bb32e9d694dde1c3b76d440fd2cd0344d23376
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Dict, List, Mapping, Optional, Tuple, Union from .. import ...
[((12443, 12486), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""administrationRoleArn"""'}), "(name='administrationRoleArn')\n", (12456, 12486), False, 'import pulumi\n'), ((13411, 13450), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""executionRoleName"""'}), "(name='executionRoleName')\n", (13424, 13450), ...
farioso-fernando/cover-meu-beat
code/config/imports.py
b15a9c0c97086e51e42cee4dd40e7d0650130d0e
from kivy.uix.screenmanager import ScreenManager from kivy.uix.boxlayout import BoxLayout from kivy.lang.builder import Builder from kivy.animation import Animation from kivy.core.window import Window from kivymd.app import MDApp import kivymd import kivy print( ) def version(): kivy.require('2.0.0') print( )
[((287, 308), 'kivy.require', 'kivy.require', (['"""2.0.0"""'], {}), "('2.0.0')\n", (299, 308), False, 'import kivy\n')]
kwalberg/claripy
claripy/vsa/valueset.py
b5cfa0a355eaa3cd5403e1d81f0b80bb3db20c90
import functools import itertools import numbers from ..backend_object import BackendObject from ..annotation import Annotation def normalize_types_two_args(f): @functools.wraps(f) def normalizer(self, region, o): """ Convert any object to an object that we can process. """ if ...
[((965, 982), 'itertools.count', 'itertools.count', ([], {}), '()\n', (980, 982), False, 'import itertools\n'), ((168, 186), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', (183, 186), False, 'import functools\n'), ((653, 671), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', (668, 671), False, '...
sina-cb/fardaastationapi
fardaastationapi.py
0e27afe05195f346e17fd52e1c30b853c954a3b0
import logging from episodes import find_updates, db, count_all from logging import error as logi from flask import Flask, jsonify, request def create_app(config, debug=False, testing=False, config_overrides=None): app = Flask(__name__) app.config.from_object(config) app.config['JSON_AS_ASCII'] = False ...
[((228, 243), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (233, 243), False, 'from flask import Flask, jsonify, request\n'), ((495, 534), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (514, 534), False, 'import logging\n'), ((594, 606), 'episode...
iTeam-co/pytglib
pytglib/api/types/can_transfer_ownership_result_password_too_fresh.py
e5e75e0a85f89b77762209b32a61b0a883c0ae61
from ..utils import Object class CanTransferOwnershipResultPasswordTooFresh(Object): """ The 2-step verification was enabled recently, user needs to wait Attributes: ID (:obj:`str`): ``CanTransferOwnershipResultPasswordTooFresh`` Args: retry_after (:obj:`int`): Time le...
[]
spraakbanken/sparv-catapult
catapult.py
03273985ceea6feef47a56084c595580d0338f7d
# -*- coding: utf-8 -*- # catapult: runs python scripts in already running processes to eliminate the # python interpreter startup time. # # The lexicon for sparv.saldo.annotate and sparv.saldo.compound can be pre-loaded and # shared between processes. See the variable annotators in handle and start. # # Run scripts in...
[((843, 911), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(process)d %(asctime)-15s %(message)s"""'}), "(format='%(process)d %(asctime)-15s %(message)s')\n", (862, 911), False, 'import logging\n'), ((918, 945), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (935, 94...
rajeshkumargp/TextBlob
tests/test_sentiments.py
a8709368f2a8a8ba4d87730111f8b6675d0735cd
from __future__ import unicode_literals import unittest from nose.tools import * # PEP8 asserts from nose.plugins.attrib import attr from textblob.sentiments import PatternAnalyzer, NaiveBayesAnalyzer, DISCRETE, CONTINUOUS class TestPatternSentiment(unittest.TestCase): def setUp(self): self.analyzer = ...
[((1571, 1583), 'nose.plugins.attrib.attr', 'attr', (['"""slow"""'], {}), "('slow')\n", (1575, 1583), False, 'from nose.plugins.attrib import attr\n'), ((2429, 2444), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2442, 2444), False, 'import unittest\n'), ((320, 337), 'textblob.sentiments.PatternAnalyzer', 'Patte...
unicef/unicef-security
src/unicef_security/apps.py
cc51ba52cddb845b8174cf3dc94706f0334453b2
from django.apps import AppConfig class Config(AppConfig): name = 'unicef_security' verbose_name = "UNICEF Security"
[]
isJuhn/pcsx2_ipc
utils/pretty-tests.py
51f92d51aec05dffa82d418c97fc1d628b2ed40f
import json import sys f=open(sys.argv[1]) y = json.loads(f.read()) print("Tests results: " + str(y["result"])) print("Tests duration: " + str(y["duration"])) print("Tests output:\n~~~~~~~~~~~~~~~~~~~~\n" + str(y["stdout"]))
[]
AdityaHPatwardhan/openthread
tests/scripts/thread-cert/test_network_layer.py
a201e9d5d0273bb51fa20efc8758be20a725018e
#!/usr/bin/env python3 # # Copyright (c) 2016, The OpenThread Authors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # ...
[((1906, 1928), 'random.getrandbits', 'random.getrandbits', (['(16)'], {}), '(16)\n', (1924, 1928), False, 'import random\n'), ((2044, 2065), 'random.getrandbits', 'random.getrandbits', (['(1)'], {}), '(1)\n', (2062, 2065), False, 'import random\n'), ((2098, 2120), 'random.getrandbits', 'random.getrandbits', (['(32)'],...
markgras/salt
salt/modules/kernelpkg_linux_apt.py
d66cd3c935533c63870b83228b978ce43e0ef70d
""" Manage Linux kernel packages on APT-based systems """ import functools import logging import re try: from salt.utils.versions import LooseVersion as _LooseVersion from salt.exceptions import CommandExecutionError HAS_REQUIRED_LIBS = True except ImportError: HAS_REQUIRED_LIBS = False log = loggin...
[((314, 341), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (331, 341), False, 'import logging\n'), ((2115, 2165), 're.match', 're.match', (['"""^(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\\\\.(\\\\d+)"""', 'result'], {}), "('^(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\\\\.(\\\\d+)', result)\n", (2123, 2165), F...
david-slatinek/running-a-program-on-the-CPU-vs.-on-the-GPU
main.py
971b911efee8f52c5950ba777b79e58a4f840024
import json import numpy as np from numba import jit from timeit import default_timer as timer # Constant, used in the formula. # Defined here to speed up the calculation, i.e. it's calculated only once # and then placed in the formula. SQRT_2PI = np.float32(np.sqrt(2 * np.pi)) # This function will run on the CPU. d...
[((822, 839), 'numba.jit', 'jit', (['gaussian_cpu'], {}), '(gaussian_cpu)\n', (825, 839), False, 'from numba import jit\n'), ((260, 278), 'numpy.sqrt', 'np.sqrt', (['(2 * np.pi)'], {}), '(2 * np.pi)\n', (267, 278), True, 'import numpy as np\n'), ((587, 608), 'numpy.zeros_like', 'np.zeros_like', (['values'], {}), '(valu...
ninetymiles/jj-logcat-analyzer
src/jj_analyzer/__init__.py
d4ae0fddfefc303ae9c17e6c9e08aad6a231e036
#! /usr/bin/python import sys if sys.version_info[0] == 3: from .__main__ import * else: pass
[]
Team-501-The-PowerKnights/Powerknights-Slack-Bot
utility_functions.py
1ce25c954aa0c089aa93a3d63bd475d585d39bb6
import datetime def iso_extract_info(string): """ Will get all of the info and return it as an array :param string: ISO formatted string that will be used for extraction :return: array [year, month, day, military_time_hour, minutes, hours] :note: every item is an int except for minutes ...
[((3981, 4024), 'datetime.date', 'datetime.date', (['year_int', 'month_int', 'day_int'], {}), '(year_int, month_int, day_int)\n', (3994, 4024), False, 'import datetime\n'), ((5018, 5061), 'datetime.date', 'datetime.date', (['year_int', 'month_int', 'day_int'], {}), '(year_int, month_int, day_int)\n', (5031, 5061), Fals...
tallamjr/mbms
python/ch_06_Animatronic_Head.py
6763faa870d1a16f272b3eade70b433ed3df0e51
from microbit import * import random, speech, radio eye_angles = [50, 140, 60, 90, 140] radio.off() sentences = [ "Hello my name is Mike", "What is your name", "I am looking at you", "Exterminate exterminate exterminate", "Number Five is alive", "I cant do that Dave", "daisee daisee give ...
[((90, 101), 'radio.off', 'radio.off', ([], {}), '()\n', (99, 101), False, 'import random, speech, radio\n'), ((985, 1005), 'speech.say', 'speech.say', (['words[i]'], {}), '(words[i])\n', (995, 1005), False, 'import random, speech, radio\n'), ((1072, 1097), 'random.choice', 'random.choice', (['eye_angles'], {}), '(eye_...
caoyp2/HRunDemo
debugtalk.py
41810a2fd366c780ea8f2bf9b4328fdd60aba171
import datetime import time def sleep(n_secs): time.sleep(n_secs) def get_timestamp(): dtime = datetime.datetime.now() un_time = time.mktime(dtime.timetuple()) return str(un_time) def print_docId(docId): print(docId) def print_phonepass(phone,password): print(phone + "---------" + password)...
[((52, 70), 'time.sleep', 'time.sleep', (['n_secs'], {}), '(n_secs)\n', (62, 70), False, 'import time\n'), ((105, 128), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (126, 128), False, 'import datetime\n')]
aleronupe/2019.1-hubcare-api
hubcare/metrics/community_metrics/issue_template/urls.py
3f031eac9559a10fdcf70a88ee4c548cf93e4ac2
from django.urls import path from issue_template.views import IssueTemplateView urlpatterns = [ path( '<str:owner>/<str:repo>/<str:token_auth>/', IssueTemplateView.as_view() ), ]
[((168, 195), 'issue_template.views.IssueTemplateView.as_view', 'IssueTemplateView.as_view', ([], {}), '()\n', (193, 195), False, 'from issue_template.views import IssueTemplateView\n')]
httpsgithu/hammer
src/hammer-vlsi/technology/sky130/sram_compiler/__init__.py
6099f4169a49f71cee2e24bb1052f273039505cd
import os, tempfile, subprocess from hammer_vlsi import MMMCCorner, MMMCCornerType, HammerTool, HammerToolStep, HammerSRAMGeneratorTool, SRAMParameters from hammer_vlsi.units import VoltageValue, TemperatureValue from hammer_tech import Library, ExtraLibrary from typing import NamedTuple, Dict, Any, List from abc imp...
[((714, 756), 'os.path.abspath', 'os.path.abspath', (['self.technology.cache_dir'], {}), '(self.technology.cache_dir)\n', (729, 756), False, 'import os, tempfile, subprocess\n'), ((5182, 5221), 'hammer_tech.ExtraLibrary', 'ExtraLibrary', ([], {'prefix': 'None', 'library': 'None'}), '(prefix=None, library=None)\n', (519...
PacktPublishing/Hands-on-NLP-with-NLTK-and-scikit-learn-
Section 4/nlp-4-ngrams.py
8bb2095093a822363675368a4216d30d14cac501
import collections import nltk import os from sklearn import ( datasets, model_selection, feature_extraction, linear_model, naive_bayes, ensemble ) def extract_features(corpus): '''Extract TF-IDF features from corpus''' sa_stop_words = nltk.corpus.stopwords.words("english") # words that might in...
[((1548, 1597), 'sklearn.datasets.load_files', 'datasets.load_files', (['data_directory'], {'shuffle': '(True)'}), '(data_directory, shuffle=True)\n', (1567, 1597), False, 'from sklearn import datasets, model_selection, feature_extraction, linear_model, naive_bayes, ensemble\n'), ((1854, 1964), 'sklearn.model_selection...
bhavinjawade/project-euler-solutions
code/gcd_sequence/sol_443.py
56bf6a282730ed4b9b875fa081cf4509d9939d98
# -*- coding: utf-8 -*- ''' File name: code\gcd_sequence\sol_443.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #443 :: GCD sequence # # For more information see: # https://projecteuler.net/problem=443 # Problem Statement ''' Let g(n) ...
[]
lreed/Diamond
src/collectors/rabbitmq/rabbitmq.py
2772cdbc27a7ba3fedeb6d4241aeee9d2fcbdb80
# coding=utf-8 """ Collects data from RabbitMQ through the admin interface #### Notes * if two vhosts have the queues with the same name, the metrics will collide #### Dependencies * pyrabbit """ import diamond.collector try: from numbers import Number Number # workaround for pyflakes issue #13 im...
[]
MalikIdreesHasanKhan/NeMo
nemo/collections/tts/torch/data.py
984fd34921e81659c4594a22ab142311808b3bb7
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. 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 requ...
[((11774, 11822), 'nemo.collections.asr.parts.preprocessing.features.WaveformFeaturizer', 'WaveformFeaturizer', ([], {'sample_rate': 'self.sample_rate'}), '(sample_rate=self.sample_rate)\n', (11792, 11822), False, 'from nemo.collections.asr.parts.preprocessing.features import WaveformFeaturizer\n'), ((13421, 13442), 't...
MarkWengSTR/ansys-maxwell-online
anmotordesign/server.py
f9bbc535c7637d8f34abb241acfb97d1bdbe4103
from flask import Flask, request, jsonify from flask_cors import CORS from run import run_ansys from api.validate import spec_present, data_type_validate, spec_keys_validate, ansys_overload_check ansys_processing_count = 0 # debug # import ipdb; ipdb.set_trace() app = Flask(__name__) CORS(app) # local development co...
[((271, 286), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (276, 286), False, 'from flask import Flask, request, jsonify\n'), ((287, 296), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (291, 296), False, 'from flask_cors import CORS\n'), ((1035, 1059), 'flask.jsonify', 'jsonify', (["ctx['response'...
eric8607242/darts
cnn/donas_utils/dataset/__init__.py
34c79a0956039f56a6a87bfb7f4b1ae2af615bea
from .dataset import get_cifar100, get_cifar10, get_imagenet_lmdb, get_imagenet __all__ = ["get_cifar100", "get_cifar10", "get_imagenet_lmdb", "get_imagenet"]
[]
ahmdrz/spam-classifier
classifier/cross_validation.py
a9cc3916a7c22545c82f0bfae7e4b95f3b36248f
from sklearn.model_selection import KFold def kfold_cross_validation(data, k=10): kfold = KFold(n_splits=k) for train, test in kfold.split(data): yield data[train], data[test]
[((95, 112), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'k'}), '(n_splits=k)\n', (100, 112), False, 'from sklearn.model_selection import KFold\n')]
captainxavier/AutoBlog
category/models.py
44fb23628fe0210a3dcec80b91e1217d27ee9462
from django.db import models class Category(models.Model): title = models.CharField(max_length=20) class Meta: db_table = 'category' verbose_name = ("Category") verbose_name_plural = ("Categories") def __str__(self): return self.title
[((77, 108), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)'}), '(max_length=20)\n', (93, 108), False, 'from django.db import models\n')]
aucoeur/WeVoteServer
admin_tools/urls.py
7b30bdbb59d6e0c19abc81237aa42fba7de1a432
# admin_tools/urls.py # Brought to you by We Vote. Be good. # -*- coding: UTF-8 -*- from django.conf.urls import re_path from . import views urlpatterns = [ re_path(r'^$', views.admin_home_view, name='admin_home',), re_path(r'^data_cleanup/$', views.data_cleanup_view, name='data_cleanup'), re_path(r'^dat...
[((164, 219), 'django.conf.urls.re_path', 're_path', (['"""^$"""', 'views.admin_home_view'], {'name': '"""admin_home"""'}), "('^$', views.admin_home_view, name='admin_home')\n", (171, 219), False, 'from django.conf.urls import re_path\n'), ((227, 299), 'django.conf.urls.re_path', 're_path', (['"""^data_cleanup/$"""', '...
tautomer/hippynn
hippynn/graphs/nodes/base/multi.py
df4504a5ea4680cfc61f490984dcddeac7ed99ee
""" A base node that provides several output tensors. """ from ....layers.algebra import Idx from .base import SingleNode, Node from .. import _debprint from ...indextypes import IdxType class IndexNode(SingleNode): _input_names = ("parent",) def __init__(self, name, parents, index, index_state=None): ...
[]
JohanNicander/python-test-architecture
main_module/__init__.py
2418f861cb46c3fccaa21be94ee92c5862985a15
from .zero import zero from main_module._unittester import UnitTester test = UnitTester(__name__) del UnitTester
[((78, 98), 'main_module._unittester.UnitTester', 'UnitTester', (['__name__'], {}), '(__name__)\n', (88, 98), False, 'from main_module._unittester import UnitTester\n')]
LSSTDESC/barber
barber/cutter.py
9dbe69e69a078ef3b70a316807517e2a4d4e60cd
import numpy as np import numpy.random as npr import scipy.optimize as spo import tomo_challenge.metrics as tcm # custom data type, could be replaced with/tie in to tree.py class # cut_vals is (nfeat, nbins - 1) numpy array, float # tree_ids is ((nbins,) * nfeat) numpy array, int TreePars = namedtuple('TreePars', ['cu...
[((529, 558), 'numpy.flatten', 'np.flatten', (['treepars.cut_vals'], {}), '(treepars.cut_vals)\n', (539, 558), True, 'import numpy as np\n'), ((569, 598), 'numpy.flatten', 'np.flatten', (['treepars.tree_ids'], {}), '(treepars.tree_ids)\n', (579, 598), True, 'import numpy as np\n'), ((609, 636), 'numpy.concatenate', 'np...
coding-world/matrix_max7219
examples/transfer/highscore.py
3126604ee400a9ec1d25797f6957a2eae8a3f33c
import shelve regal = shelve.open('score.txt') def updateScore(neuerScore): if('score' in regal): score = regal['score'] if(neuerScore not in score): score.insert(0, neuerScore) score.sort() ranking = score.index(neuerScore) ranking = len(score)-ranking else: score = [neuerScore] ...
[((23, 47), 'shelve.open', 'shelve.open', (['"""score.txt"""'], {}), "('score.txt')\n", (34, 47), False, 'import shelve\n')]
enfold/node.ext.ldap
src/node/ext/ldap/scope.py
28127057be6ba3092389f3c920575292d43d9f94
# -*- coding: utf-8 -*- import ldap BASE = ldap.SCOPE_BASE ONELEVEL = ldap.SCOPE_ONELEVEL SUBTREE = ldap.SCOPE_SUBTREE SCOPES = [BASE, ONELEVEL, SUBTREE] del ldap
[]
tensorflow-korea/tfk-notebooks
urban-sound-classification/feature_merge.py
67831acce7f435500377bf03e6bd9d15fdd5f1bc
import glob import numpy as np X = np.empty((0, 193)) y = np.empty((0, 10)) groups = np.empty((0, 1)) npz_files = glob.glob('./urban_sound_?.npz') for fn in npz_files: print(fn) data = np.load(fn) X = np.append(X, data['X'], axis=0) y = np.append(y, data['y'], axis=0) groups = np.append(groups, dat...
[((36, 54), 'numpy.empty', 'np.empty', (['(0, 193)'], {}), '((0, 193))\n', (44, 54), True, 'import numpy as np\n'), ((59, 76), 'numpy.empty', 'np.empty', (['(0, 10)'], {}), '((0, 10))\n', (67, 76), True, 'import numpy as np\n'), ((86, 102), 'numpy.empty', 'np.empty', (['(0, 1)'], {}), '((0, 1))\n', (94, 102), True, 'im...
JankaSvK/thesis
program/program/trackers/TrackerCorrelation.py
c440ab8242b058f580fdf9d5a1d00708a1696561
import dlib class CorrelationTracker(object): def init(self, image, bbox): self.tracker = dlib.correlation_tracker() x, y, x2, y2 = bbox x2 += x y2 += y self.tracker.start_track(image, dlib.rectangle(x, y, x2, y2)) return True def update(self, image): s...
[((104, 130), 'dlib.correlation_tracker', 'dlib.correlation_tracker', ([], {}), '()\n', (128, 130), False, 'import dlib\n'), ((231, 259), 'dlib.rectangle', 'dlib.rectangle', (['x', 'y', 'x2', 'y2'], {}), '(x, y, x2, y2)\n', (245, 259), False, 'import dlib\n')]
rilango/NeMo
examples/nlp/language_modeling/megatron_gpt_ckpt_to_nemo.py
6f23ff725c596f25fab6043d95e7c0b4a5f56331
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[((992, 1008), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (1006, 1008), False, 'from argparse import ArgumentParser\n'), ((2129, 2139), 'nemo.utils.AppState', 'AppState', ([], {}), '()\n', (2137, 2139), False, 'from nemo.utils import AppState, logging\n'), ((2191, 2236), 'pytorch_lightning.trainer.t...
dixler/pulumi-aws
sdk/python/pulumi_aws/apigateway/api_key.py
88838ed6d412c092717a916b0b5b154f68226c3a
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import json import warnings import pulumi import pulumi.runtime from typing import Union from .. import utilities, tables class ApiKey...
[((2413, 2488), 'warnings.warn', 'warnings.warn', (['"""explicit use of __name__ is deprecated"""', 'DeprecationWarning'], {}), "('explicit use of __name__ is deprecated', DeprecationWarning)\n", (2426, 2488), False, 'import warnings\n'), ((2571, 2670), 'warnings.warn', 'warnings.warn', (['"""explicit use of __opts__ i...
jwarner308/SROMPy
SROMPy/optimize/ObjectiveFunction.py
12007e4cd99c88446f10974a93050405c5cd925b
# Copyright 2018 United States Government as represented by the Administrator of # the National Aeronautics and Space Administration. No copyright is claimed in # the United States under Title 17, U.S. Code. All Other Rights Reserved. # The Stochastic Reduced Order Models with Python (SROMPy) platform is licensed # un...
[((7943, 7993), 'numpy.zeros', 'np.zeros', (['(num_cdf_grid_points, self._target._dim)'], {}), '((num_cdf_grid_points, self._target._dim))\n', (7951, 7993), True, 'import numpy as np\n'), ((6051, 6084), 'numpy.where', 'np.where', (['(target_cdfs[:, (0)] > 0)'], {}), '(target_cdfs[:, (0)] > 0)\n', (6059, 6084), True, 'i...
vasili-v/distcovery
test/utils.py
e07882d55ebe2e4fd78a720764803e6b3e8cbc7d
import os import errno import sys def mock_directory_tree(tree): tree = dict([(os.path.join(*key), value) \ for key, value in tree.iteritems()]) def listdir(path): try: names = tree[path] except KeyError: raise OSError(errno.ENOENT, os.strerror(err...
[((84, 102), 'os.path.join', 'os.path.join', (['*key'], {}), '(*key)\n', (96, 102), False, 'import os\n'), ((406, 432), 'os.strerror', 'os.strerror', (['errno.ENOTDIR'], {}), '(errno.ENOTDIR)\n', (417, 432), False, 'import os\n'), ((3873, 3899), 'sys.meta_path.remove', 'sys.meta_path.remove', (['item'], {}), '(item)\n'...
adrianjhpc/spack
var/spack/repos/builtin/packages/perl-ipc-run/package.py
0a9e4fcee57911f2db586aa50c8873d9cca8de92
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PerlIpcRun(PerlPackage): """IPC::Run allows you to run and interact with child processes u...
[]
WillAyd/tabcmd
tests/test_parser_create_site_users.py
1ba4a6ce1586b5ec4286aca0edff0fbaa1c69f15
import sys import unittest try: from unittest import mock except ImportError: import mock import argparse from tabcmd.parsers.create_site_users_parser import CreateSiteUsersParser from .common_setup import * commandname = 'createsiteusers' class CreateSiteUsersParserTest(unittest.TestCase): @classmethod...
[((445, 513), 'tabcmd.parsers.create_site_users_parser.CreateSiteUsersParser.create_site_user_parser', 'CreateSiteUsersParser.create_site_user_parser', (['manager', 'mock_command'], {}), '(manager, mock_command)\n', (490, 513), False, 'from tabcmd.parsers.create_site_users_parser import CreateSiteUsersParser\n'), ((612...
iarlyy/secretsmanager-env
secretsmanager_env.py
3a34a4e9561e4651fa2975ff6f32b00ef0c0ca73
#!/usr/bin/env python import argparse import json import os import boto3 parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description='''\ Output following the defined format. Options are: dotenv - dotenv style [default] export - shell export style std...
[((85, 358), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'description': '"""Output following the defined format.\n Options are:\n dotenv - dotenv style [default]\n export - shell export style\n stdout - secret plain value style"""'...
juandarr/ProjectEuler
109.py
951705ac62f550d7fbecdc3f35ab8c38b53b9225
""" Finds the number of distinct ways a player can checkout a score less than 100 Author: Juan Rios """ import math def checkout_solutions(checkout,sequence,idx_sq,d): ''' returns the number of solution for a given checkout value ''' counter = 0 for double in d: if double>checkout: ...
[]
vjeronymo2/tevatron
src/tevatron/tevax/loss.py
7235b0823b5c3cdf1c8ce8f67cb5f1209218086a
import jax.numpy as jnp from jax import lax import optax import chex def _onehot(labels: chex.Array, num_classes: int) -> chex.Array: x = labels[..., None] == jnp.arange(num_classes).reshape((1,) * labels.ndim + (-1,)) x = lax.select(x, jnp.ones(x.shape), jnp.zeros(x.shape)) return x.astype(jnp.float32) ...
[((247, 264), 'jax.numpy.ones', 'jnp.ones', (['x.shape'], {}), '(x.shape)\n', (255, 264), True, 'import jax.numpy as jnp\n'), ((266, 284), 'jax.numpy.zeros', 'jnp.zeros', (['x.shape'], {}), '(x.shape)\n', (275, 284), True, 'import jax.numpy as jnp\n'), ((518, 570), 'jax.numpy.arange', 'jnp.arange', (['(0)', 'per_shard_...
kinnala/gammy
setup.py
85237d424001f77f296d724c95c8dec5803a8e1e
import os from setuptools import setup, find_packages import versioneer if __name__ == "__main__": def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() meta = {} base_dir = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(base_dir, 'gammy', '_m...
[((244, 269), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (259, 269), False, 'import os\n'), ((285, 328), 'os.path.join', 'os.path.join', (['base_dir', '"""gammy"""', '"""_meta.py"""'], {}), "(base_dir, 'gammy', '_meta.py')\n", (297, 328), False, 'import os\n'), ((435, 459), 'versioneer.ge...
gabrielstork/fast-ml
fast-ml/main.py
ce93c1263970ce7b958e1c3e932c70909bcc0e31
import root if __name__ == '__main__': window = root.Root() window.mainloop()
[((54, 65), 'root.Root', 'root.Root', ([], {}), '()\n', (63, 65), False, 'import root\n')]
QualiChain/qualichain_backend
application/recommendations/__init__.py
cc6dbf1ae5d09e8d01cccde94326563b25d28b58
from flask import Blueprint recommendation_blueprint = Blueprint('recommendations', __name__) from application.recommendations import routes
[((57, 95), 'flask.Blueprint', 'Blueprint', (['"""recommendations"""', '__name__'], {}), "('recommendations', __name__)\n", (66, 95), False, 'from flask import Blueprint\n')]
XenonLamb/higan
predictors/scene_predictor.py
6e7b47f91df23d8d6075d95921e664c9fa4f1306
# python 3.7 """Predicts the scene category, attribute.""" import numpy as np from PIL import Image import torch import torch.nn.functional as F import torchvision.transforms as transforms from .base_predictor import BasePredictor from .scene_wideresnet import resnet18 __all__ = ['ScenePredictor'] N...
[((1996, 2067), 'torch.load', 'torch.load', (['self.weight_path'], {'map_location': '(lambda storage, loc: storage)'}), '(self.weight_path, map_location=lambda storage, loc: storage)\n', (2006, 2067), False, 'import torch\n'), ((2492, 2538), 'numpy.load', 'np.load', (['self.attribute_additional_weight_path'], {}), '(se...
jackKiZhu/mypython
python_test.py
43eac97bec07338ed3b8b9473d4e4fae26f7140c
from flask import Flask, render_template, request from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config["SQLALCHEMY_DATABASE_URI"] = "mysql://root:mysql@127.0.0.1:3306/python_github" app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True db = SQLAlchemy(app) class User(db.Model): id = db.Column(db...
[((96, 111), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (101, 111), False, 'from flask import Flask, render_template, request\n'), ((259, 274), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (269, 274), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((1697, 1747), 'flask.r...
iml1111/algorithm-study
src/etc/gec/3.py
f21f6f9f43235248f3496f034a899f2314ab6fcc
from collections import deque def solution(N, bus_stop): answer = [[1300 for _ in range(N)] for _ in range(N)] bus_stop = [(x-1, y-1) for x,y in bus_stop] q = deque(bus_stop) for x,y in bus_stop: answer[x][y] = 0 while q: x, y = q.popleft() for nx, ny in ((x-1, y), (x+1, y)...
[((172, 187), 'collections.deque', 'deque', (['bus_stop'], {}), '(bus_stop)\n', (177, 187), False, 'from collections import deque\n')]
linshaoyong/leetcode
python/tree/0103_binary_tree_zigzag_level_order_traversal.py
ea052fad68a2fe0cbfa5469398508ec2b776654f
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def zigzagLevelOrder(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ if not root: return [] ...
[]
berggren/plaso
plaso/parsers/winreg_plugins/usbstor.py
2658c80c5076f97a9a27272e73997bde8c39e875
# -*- coding: utf-8 -*- """File containing a Windows Registry plugin to parse the USBStor key.""" from __future__ import unicode_literals from plaso.containers import events from plaso.containers import time_events from plaso.lib import definitions from plaso.parsers import logger from plaso.parsers import winreg fro...
[((5397, 5451), 'plaso.parsers.winreg.WinRegistryParser.RegisterPlugin', 'winreg.WinRegistryParser.RegisterPlugin', (['USBStorPlugin'], {}), '(USBStorPlugin)\n', (5436, 5451), False, 'from plaso.parsers import winreg\n'), ((1737, 1844), 'plaso.parsers.winreg_plugins.interface.WindowsRegistryKeyPathFilter', 'interface.W...
CodyKochmann/damn_vulnerable_python
damn_vulnerable_python/evil.py
8a90ee3b70dddae96f9f0a8500ed9ba5693f3082
''' static analyzers are annoying so lets rename eval ''' evil = eval
[]
MIMUW-RL/spp-rl
rltoolkit/rltoolkit/acm/off_policy/ddpg_acm.py
86b96cdd220cc4eae86f7cfd26924c69b498dcc6
import numpy as np import torch from torch.nn import functional as F from rltoolkit.acm.off_policy import AcMOffPolicy from rltoolkit.algorithms import DDPG from rltoolkit.algorithms.ddpg.models import Actor, Critic class DDPG_AcM(AcMOffPolicy, DDPG): def __init__( self, unbiased_update: bool = False, cu...
[((1132, 1206), 'rltoolkit.algorithms.ddpg.models.Actor', 'Actor', (['self.ob_dim'], {'ac_lim': 'self.actor_ac_lim', 'ac_dim': 'self.actor_output_dim'}), '(self.ob_dim, ac_lim=self.actor_ac_lim, ac_dim=self.actor_output_dim)\n', (1137, 1206), False, 'from rltoolkit.algorithms.ddpg.models import Actor, Critic\n'), ((601...
ftrimble/route-grower
pyroute/poi_osm.py
d4343ecc9b13a3e1701c8460c8a1792d08b74567
#!/usr/bin/python #---------------------------------------------------------------- # OSM POI handler for pyroute # #------------------------------------------------------ # Copyright 2007, Oliver White # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Publ...
[]
peleiden/pelutils
pelutils/logger.py
9860734c0e06481aa58a9f767a4cfb5129cb48ec
from __future__ import annotations import os import traceback as tb from collections import defaultdict from enum import IntEnum from functools import update_wrapper from itertools import chain from typing import Any, Callable, DefaultDict, Generator, Iterable, Optional from pelutils import get_timestamp, get_repo fro...
[((3255, 3272), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (3266, 3272), False, 'from collections import defaultdict\n'), ((7274, 7289), 'pelutils.get_timestamp', 'get_timestamp', ([], {}), '()\n', (7287, 7289), False, 'from pelutils import get_timestamp, get_repo\n'), ((11220, 11237), 'colle...
aaxelb/django-elasticsearch-metrics
tests/test_metrics.py
8a02ffc57f57257843834d4f84c41480f4e27fbd
import mock import pytest import datetime as dt from django.utils import timezone from elasticsearch_metrics import metrics from elasticsearch_dsl import IndexTemplate from elasticsearch_metrics import signals from elasticsearch_metrics.exceptions import ( IndexTemplateNotFoundError, IndexTemplateOutOfSyncErro...
[((522, 549), 'elasticsearch_metrics.metrics.Keyword', 'metrics.Keyword', ([], {'index': '(True)'}), '(index=True)\n', (537, 549), False, 'from elasticsearch_metrics import metrics\n'), ((564, 591), 'elasticsearch_metrics.metrics.Keyword', 'metrics.Keyword', ([], {'index': '(True)'}), '(index=True)\n', (579, 591), Fals...
mwk0408/codewars_solutions
6 kyu/SumFibs.py
9b4f502b5f159e68024d494e19a96a226acad5e5
from functools import lru_cache @lru_cache def fib(n): return n if n<2 else fib(n-1)+fib(n-2) def sum_fibs(n): return sum(j for j in (fib(i) for i in range(n+1)) if j%2==0)
[]
jvegreg/ESMValCore
tests/unit/test_iris_helpers.py
03eb1c942bf1dc3be98cb30c3592b42e82a94f16
"""Tests for :mod:`esmvalcore.iris_helpers`.""" import datetime import iris import numpy as np import pytest from cf_units import Unit from esmvalcore.iris_helpers import date2num, var_name_constraint @pytest.fixture def cubes(): """Test cubes.""" cubes = iris.cube.CubeList([ iris.cube.Cube(0.0, var...
[((529, 590), 'cf_units.Unit', 'Unit', (['"""days since 0001-01-01"""'], {'calendar': '"""proleptic_gregorian"""'}), "('days since 0001-01-01', calendar='proleptic_gregorian')\n", (533, 590), False, 'from cf_units import Unit\n'), ((864, 898), 'esmvalcore.iris_helpers.date2num', 'date2num', (['date', 'units'], {'dtype'...
saeed-moghimi-noaa/Maxelev_plot
geo_regions.py
5bb701d8cb7d64db4c89ea9d7993a8269e57e504
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Geo regions for map plot """ __author__ = "Saeed Moghimi" __copyright__ = "Copyright 2017, UCAR/NOAA" __license__ = "GPL" __version__ = "1.0" __email__ = "moghimis@gmail.com" import matplotlib.pyplot as plt from collections import defaultdict defs = defaultdict(dic...
[((305, 322), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (316, 322), False, 'from collections import defaultdict\n')]
davidADSP/deepAI_paper
figures/plot_log_figure_paper.py
f612e80aa0e8507444228940c54554a83bc16119
import numpy import matplotlib.pyplot as plt fig_convergence = plt.figure(1,figsize=(12,6)) x = numpy.loadtxt('log_deepAI_paper_nonlin_action_long.txt') plt.subplot(122) plt.plot(x[:,0]) plt.xlim([0,500]) plt.ylim([-10,200]) plt.xlabel('Steps') plt.ylabel('Free Action') plt.axvline(x=230.0,linestyle=':') plt.axvline...
[((64, 94), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(12, 6)'}), '(1, figsize=(12, 6))\n', (74, 94), True, 'import matplotlib.pyplot as plt\n'), ((98, 154), 'numpy.loadtxt', 'numpy.loadtxt', (['"""log_deepAI_paper_nonlin_action_long.txt"""'], {}), "('log_deepAI_paper_nonlin_action_long.txt')\n",...
matiasgrana/nagios_sql
setup.py
7858b852cf539da418a1a289e8c06e386b62287a
#! python3 # Help from: http://www.scotttorborg.com/python-packaging/minimal.html # https://docs.python.org/3/distutils/commandref.html#sdist-cmd # https://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # https://docs.python.org/3.4/tutorial/modules.html # Install it with python setup.py ins...
[((1474, 1503), 'os.path.join', 'path.join', (['here', '"""README.rst"""'], {}), "(here, 'README.rst')\n", (1483, 1503), False, 'from os import path\n'), ((702, 724), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (714, 724), False, 'from os import path\n'), ((737, 775), 'os.path.join', 'os.path...
tongr/TextNN
textnn/utils/test/test_progress_iterator.py
a0294a197d3be284177214e8f019e9fed13dff1a
import io import sys from textnn.utils import ProgressIterator #inspired by https://stackoverflow.com/a/34738440 def capture_sysout(cmd): capturedOutput = io.StringIO() # Create StringIO object sys.stdout = capturedOutput # and redirect stdout. cmd() ...
[((161, 174), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (172, 174), False, 'import io\n'), ((575, 630), 'textnn.utils.ProgressIterator', 'ProgressIterator', (['[1, 2, 3]'], {'interval': '(0)', 'description': '""""""'}), "([1, 2, 3], interval=0, description='')\n", (591, 630), False, 'from textnn.utils import Prog...
NIKH0610/class5-homework
reach.py
d4cfb1b28656a37002dff6b1b20bae1253b2ae80
import os import numpy as np import pandas as pd housing_df = pd.read_csv(filepath_or_buffer='~/C:\Users\nikhi\NIKH0610\class5-homework\toys-datasets\boston')
[]
souparvo/airflow-plugins
queries/general_queries.py
0ca7fa634335145b69671054680d5d67de329644
def insert_metatable(): """SQL query to insert records from table insert into a table on a DB """ return """ INSERT INTO TABLE {{ params.target_schema }}.{{ params.target_table }} VALUES ('{{ params.schema }}', '{{ params.table }}', {{ ti.xcom_pull(key='hive_res', task_ids=params.count_inserts)[0...
[]
Handfeger/pyvisa-py
pyvisa_py/highlevel.py
fcfb45895cd44dd922985c3a9d8f3372c8318d63
# -*- coding: utf-8 -*- """Highlevel wrapper of the VISA Library. :copyright: 2014-2020 by PyVISA-py Authors, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ import random from collections import OrderedDict from typing import Any, Dict, Iterable, List, Optional, Tuple, Union, cast fr...
[((2771, 2784), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2782, 2784), False, 'from collections import OrderedDict\n'), ((15966, 15996), 'pyvisa.rname.filter', 'rname.filter', (['resources', 'query'], {}), '(resources, query)\n', (15978, 15996), False, 'from pyvisa import constants, highlevel, rname\...
sisrfeng/NA-fWebSOD
detectron/utils/webly_vis.py
49cb75a9a0d557b05968c6b11b0f17a7043f2077
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import cv2 import numpy as np import os import math from PIL import Image, ImageDraw, ImageFont from caffe2.python import workspace from detectron.core.config import cf...
[((602, 651), 'detectron.core.config.get_output_dir', 'get_output_dir', (['cfg.TRAIN.DATASETS'], {'training': '(True)'}), '(cfg.TRAIN.DATASETS, training=True)\n', (616, 651), False, 'from detectron.core.config import get_output_dir\n'), ((669, 709), 'os.path.join', 'os.path.join', (['output_dir', '"""webly_sample"""'],...
StepOneInc/salt
salt/runner.py
ee210172c37bf0cee224794cd696b38e288e4073
# -*- coding: utf-8 -*- ''' Execute salt convenience routines ''' # Import python libs from __future__ import print_function from __future__ import absolute_import import collections import logging import time import sys import multiprocessing # Import salt libs import salt.exceptions import salt.loader import salt.m...
[((572, 599), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (589, 599), False, 'import logging\n'), ((5758, 5773), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (5768, 5773), False, 'import time\n'), ((9659, 9689), 'salt.utils.event.tagify', 'tagify', (['"""ret"""'], {'base': "...
RivtLib/replit01
.venv/lib/python3.8/site-packages/poetry/core/_vendor/lark/__pyinstaller/__init__.py
ce1ae18b446a9c844f40e88a51c71fbc45ab3ad7
# For usage of lark with PyInstaller. See https://pyinstaller-sample-hook.readthedocs.io/en/latest/index.html import os def get_hook_dirs(): return [os.path.dirname(__file__)]
[((160, 185), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'import os\n')]
s-gv/pong-keras
pong-pg.py
38a0f25ae0e628f357512d085dc957720d83ece2
# Copyright (c) 2019 Sagar Gubbi. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import sys import numpy as np import gym import tensorflow as tf from tensorflow.keras.models import Sequential, Model from tensorflow.keras.layers import Input,...
[((490, 522), 'gym.make', 'gym.make', (['"""PongDeterministic-v4"""'], {}), "('PongDeterministic-v4')\n", (498, 522), False, 'import gym\n'), ((3389, 3475), 'gym.wrappers.Monitor', 'gym.wrappers.Monitor', (['env', '"""./tmp"""'], {'video_callable': '(lambda ep_id: True)', 'force': '(True)'}), "(env, './tmp', video_call...