repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
OnoArnaldo/PythonApiYoutube
api_youtube.py
8507eac234cd3d05a223db3beebd10412505bcf8
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import sys import json import urllib2 import codecs BASE_DIR = os.path.dirname(__file__) BASE_URL = 'https://www.googleapis.com/youtube/v3/' API_CHANNELS = 'channels' API_PLAYLIST = 'playlistItems' API_KEY = 'YOUR KEY' CHANNELS = [ 'videos...
[((139, 164), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (154, 164), False, 'import os\n'), ((1051, 1090), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""channels.json"""'], {}), "(BASE_DIR, 'channels.json')\n", (1063, 1090), False, 'import os\n'), ((2335, 2373), 'os.path.join', 'os.pa...
be4r/ssh-miner-detection
python_and_ebpf/train.py
47003db1d9f72ae44d5a27e92d0109d5111bec35
#!/usr/bin/env python3 from sklearn.tree import DecisionTreeClassifier import pickle import numpy as np no = [b'runc:[2:INIT]', b'containerssh-ag', b'apt',b'dpkg'] class model: def __init__(self): self.d = DecisionTreeClassifier() def load(self, filename = 'model.p'): try: f = open(filename, 'rb') self...
[((213, 237), 'sklearn.tree.DecisionTreeClassifier', 'DecisionTreeClassifier', ([], {}), '()\n', (235, 237), False, 'from sklearn.tree import DecisionTreeClassifier\n'), ((501, 523), 'pickle.dump', 'pickle.dump', (['self.d', 'f'], {}), '(self.d, f)\n', (512, 523), False, 'import pickle\n'), ((325, 339), 'pickle.load', ...
slinderman/pyhsmm-spiketrains
data/parse_hipp_data.py
462d8d2c59bd2e7c39d20d624bd8b289a31baaa2
import os import numpy as np from scipy.io import loadmat data = loadmat("data/hipp_2dtrack_a/smJun03p2.dat") N = 49 data = reshape(data, 3, length(data)/3); data = data'; size(data) % 43799-by-3 fclose(fid); % sampling time Ts = 0.0333; duration = size(data,1) * Ts; % in second Tmax = data(end, 3); Tmin = d...
[]
tomdev/repokid
repokid/tests/test_roledata.py
e1a4839290bafccfaa304d87bbdeae85b9dc80aa
# Copyright 2017 Netflix, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
[((1527, 1572), 'mock.patch', 'patch', (['"""repokid.utils.roledata.expand_policy"""'], {}), "('repokid.utils.roledata.expand_policy')\n", (1532, 1572), False, 'from mock import patch\n'), ((1578, 1636), 'mock.patch', 'patch', (['"""repokid.utils.roledata.get_actions_from_statement"""'], {}), "('repokid.utils.roledata....
Matnay/KPIT_Deep_Learning
DL_Scripts/image_recognition.py
14f3815fc2829db9bede86c31f23e721f6423f79
import rospy from sensor_msgs.msg import Image from std_msgs.msg import String from cv_bridge import CvBridge import cv2 import numpy as np import tensorflow as tf import classify_image class RosTensorFlow(): def __init__(self): classify_image.maybe_download_and_extract() self._session = tf.Sessio...
[((1726, 1753), 'classify_image.setup_args', 'classify_image.setup_args', ([], {}), '()\n', (1751, 1753), False, 'import classify_image\n'), ((1758, 1790), 'rospy.init_node', 'rospy.init_node', (['"""rostensorflow"""'], {}), "('rostensorflow')\n", (1773, 1790), False, 'import rospy\n'), ((243, 286), 'classify_image.may...
aviskumar/speedo
plugins/grouputils.py
758e8ac1fdeeb0b72c3a57742032ca5c79f0b2fa
# Copyright (C) 2020-2021 by TeamSpeedo@Github, < https://github.com/TeamSpeedo >. # # This file is part of < https://github.com/TeamSpeedo/FridayUserBot > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/TeamSpeedo/blob/master/LICENSE > # # All rights reserved. imp...
[((818, 996), 'main_start.core.decorators.speedo_on_cmd', 'speedo_on_cmd', (["['silentpin']"], {'only_if_admin': '(True)', 'cmd_help': "{'help': 'Pin Message Without Sending Notification To Members!', 'example':\n '{ch}silentpin (reply to message)'}"}), "(['silentpin'], only_if_admin=True, cmd_help={'help':\n 'Pi...
Nereg/Carberretta
carberretta/bot/cogs/feeds.py
01e25bc8ece4c310ab541304e8809dfdd3eec3b8
""" FEEDS Handles YouTube and Twitch feed notifications. """ import datetime as dt import discord import feedparser from apscheduler.triggers.cron import CronTrigger from discord.ext import commands from carberretta import Config from carberretta.utils import DEFAULT_EMBED_COLOUR, chron LIVE_EMBED_COLOUR = 0x9146FF...
[((2290, 2313), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (2311, 2313), False, 'from discord.ext import commands\n'), ((15145, 15201), 'discord.ext.commands.group', 'commands.group', ([], {'name': '"""feed"""', 'invoke_without_command': '(True)'}), "(name='feed', invoke_without_com...
abaire/gdb_sniffer
gdb/proxy.py
f330193c65a39ce6abb01f25737ca967a0af9629
"""Provides a GDB logging proxy. See https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html See https://www.embecosm.com/appnotes/ean4/embecosm-howto-rsp-server-ean4-issue-2.html """ from __future__ import annotations import logging import socket from typing import Optional from typing import Tuple from .pa...
[((381, 408), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (398, 408), False, 'import logging\n'), ((1553, 1639), 'net.ip_transport.IPTransport', 'ip_transport.IPTransport', (['self._on_target_bytes_read', 'f"""Target@{self.target_addr}"""'], {}), "(self._on_target_bytes_read,\n f'Ta...
usmanwardag/pylayers
pylayers/em/openems/test/Rect_Waveguide.py
2e8a9bdc993b2aacc92610a9c7edf875c6c7b24a
from openems.openems import * # A simple simulation # # FDTD Simulation Setting # F = FDTD() F.add(Exc(typ='Sinus',f0=100000)) F.add(BoundaryCond(['PMC','PMC','PEC','PEC','MUR','MUR'])) # # CSX (Geometry setting) # C = CSX() # The Box is added as a property C.add(Excitation('excitation'),p=Box(P1=[-10,-10,0],P2=...
[]
vd1371/CBSA
DataPreprocessing/_segment_Y.py
f2b3f03c91ccd9ec02c2331f43573d7d6e72fd47
import numpy as np def segment_Y(Y, **params): Y_segments = params.get("Y_segments") Y_quantile = params.get("Y_quantile") print("segmenting Y") Y = Y.values.reshape(-1) Y_quantile = np.quantile(Y, Y_quantile, axis = 0) bigger_mask = (Y > Y_quantile).copy() smaller_mask = (Y <= Y_quantile).copy() Y[bigger_...
[((191, 225), 'numpy.quantile', 'np.quantile', (['Y', 'Y_quantile'], {'axis': '(0)'}), '(Y, Y_quantile, axis=0)\n', (202, 225), True, 'import numpy as np\n')]
Puzzlebox-IMT/Puzzlebox
WifiEnigma/BattleAI/question.py
6b80e22a4aee3228140692bd6352de18b2f6a96d
import mysql.connector import random from voice import synthetize_voice, delete_wav def AllQuestionAI(id_theme): i = 0 #CONNEXION A LA BDD conn = mysql.connector.connect(host="localhost", user="phpmyadmin", password="Vince@Mysql1997", ...
[((3450, 3479), 'voice.synthetize_voice', 'synthetize_voice', (['question[0]'], {}), '(question[0])\n', (3466, 3479), False, 'from voice import synthetize_voice, delete_wav\n'), ((3695, 3707), 'voice.delete_wav', 'delete_wav', ([], {}), '()\n', (3705, 3707), False, 'from voice import synthetize_voice, delete_wav\n'), (...
IanHawke/toy-amr
toy-amr/flux_functions.py
1f616791993ccd83cc6034616c08e09fa4ba310d
import numpy def lax_friedrichs(cons_minus, cons_plus, simulation, tl): alpha = tl.grid.dx / tl.dt flux = numpy.zeros_like(cons_minus) prim_minus, aux_minus = simulation.model.cons2all(cons_minus, tl.prim) prim_plus, aux_plus = simulation.model.cons2all(cons_plus , tl.prim) f_minus = simulation.m...
[((115, 143), 'numpy.zeros_like', 'numpy.zeros_like', (['cons_minus'], {}), '(cons_minus)\n', (131, 143), False, 'import numpy\n'), ((666, 694), 'numpy.zeros_like', 'numpy.zeros_like', (['cons_minus'], {}), '(cons_minus)\n', (682, 694), False, 'import numpy\n')]
vmagamedov/pi
pi/auth.py
6ee98af69b757d96aa4eddc32513309e0fe05d1d
import re import json import base64 import codecs import os.path import asyncio import subprocess _PREFIX = 'docker-credential-' def read_config(): path = os.path.expanduser('~/.docker/config.json') if not os.path.exists(path): return {} with codecs.open(path, encoding='utf-8') as f: jso...
[((349, 370), 'json.loads', 'json.loads', (['json_data'], {}), '(json_data)\n', (359, 370), False, 'import json\n'), ((2004, 2020), 'json.dumps', 'json.dumps', (['auth'], {}), '(auth)\n', (2014, 2020), False, 'import json\n'), ((267, 302), 'codecs.open', 'codecs.open', (['path'], {'encoding': '"""utf-8"""'}), "(path, e...
ACWI-SOGW/ngwmn_monitoring_locations_etl
etl/transform.py
e9ebfebbc5fa349a58669fb1d9944786f26729c3
""" Transform the data into a form that works with the WELL_REGISTRY_STG table. """ import re def mapping_factory(mapping): def map_func(key): if key is not None: ora_val = mapping.get(key.lower()) else: ora_val = None return ora_val return map_func WELL_TYPES...
[((4934, 4985), 're.match', 're.match', (['""".*:\\\\d\\\\dZ$"""', "mapped_data['INSERT_DATE']"], {}), "('.*:\\\\d\\\\dZ$', mapped_data['INSERT_DATE'])\n", (4942, 4985), False, 'import re\n'), ((5070, 5121), 're.match', 're.match', (['""".*:\\\\d\\\\dZ$"""', "mapped_data['UPDATE_DATE']"], {}), "('.*:\\\\d\\\\dZ$', mapp...
shamilison/django-reporter-pro
django_reporter_pro/config/model_configs.py
0c6f60bbae939d318e7aafaec83613d2768a4f63
# Created by shamilsakib at 04/10/20 BASE_MODEL = None
[]
TEAlab/DPSpark
DPSparkImplementations/paf_kernels.py
4d53ee13b03e2e12119c28fe2b2241ad20231eac
__author__ = "Zafar Ahmad, Mohammad Mahdi Javanmard" __copyright__ = "Copyright (c) 2019 Tealab@SBU" __license__ = "MIT" __version__ = "1.0.0" __maintainer__ = "Zafar Ahmad" __email__ = "zafahmad@cs.stonybrook.edu" __status__ = "Development" import numpy as np import numba as nb ''' Iterative kernels ''' def up...
[((466, 487), 'numba.jit', 'nb.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (472, 487), True, 'import numba as nb\n'), ((388, 417), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['u_block'], {}), '(u_block)\n', (408, 417), True, 'import numpy as np\n'), ((419, 448), 'numpy.ascontiguousarray', 'np.asco...
terrapain/terrakg
terrakg/rates.py
90c52ca3b227d2daabd604255e793ac5f536c246
from terra_sdk.exceptions import LCDResponseError from terrakg import logger # Logging from terrakg.client import ClientContainer logger = logger.get_logger(__name__) class Rates: """ Access the most recent rates. """ def __init__(self, client: ClientContainer): self.client = client de...
[((142, 169), 'terrakg.logger.get_logger', 'logger.get_logger', (['__name__'], {}), '(__name__)\n', (159, 169), False, 'from terrakg import logger\n'), ((1272, 1318), 'terrakg.logger.warning', 'logger.warning', (['f"""Issue with price query: {e}"""'], {}), "(f'Issue with price query: {e}')\n", (1286, 1318), False, 'fro...
HonzaKlicpera/Effective-footage-processing-Blender-add-on
src/tracking_module.py
f3faae3fc56a3ef8f2eabba9af8be718e57f4d35
import bpy import os, glob from pathlib import Path from enum import Enum from abc import ABC, abstractmethod import csv from . import keying_module def export_tracking_data(self, context): clip = context.space_data.clip clip_name = os.path.splitext(clip.name)[0] tracker_name = context.scene.tracking_loca...
[((563, 594), 'csv.writer', 'csv.writer', (['file'], {'delimiter': '""","""'}), "(file, delimiter=',')\n", (573, 594), False, 'import csv\n'), ((1251, 1350), 'bpy.props.StringProperty', 'bpy.props.StringProperty', ([], {'name': '"""Track name"""', 'description': '"""Name of the tracker for data export"""'}), "(name='Tr...
andydandy74/ClockworkForDynamo
nodes/2.x/python/View.ViewTemplate.py
bd4ac2c13956a02352a458d01096a35b7258d9f2
import clr clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * def GetViewTemplate(view): if not view: return None elif hasattr(view, "ViewTemplateId"): if view.ViewTemplateId.IntegerValue == -1: return None else: return view.Document.GetElement(view.ViewTemplateId) else: return None views = UnwrapEle...
[((11, 39), 'clr.AddReference', 'clr.AddReference', (['"""RevitAPI"""'], {}), "('RevitAPI')\n", (27, 39), False, 'import clr\n')]
bohdana-kuzmenko/incubator-dlab
infrastructure-provisioning/src/general/scripts/gcp/dataengine-service_prepare.py
d052709450e7916860c7dd191708d5524cf44c1e
#!/usr/bin/python # ***************************************************************************** # # 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 A...
[((1487, 1612), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)-8s [%(asctime)s] %(message)s"""', 'level': 'logging.INFO', 'filename': 'local_log_filepath'}), "(format='%(levelname)-8s [%(asctime)s] %(message)s',\n level=logging.INFO, filename=local_log_filepath)\n", (1506, 1612), Fa...
mattias-lundell/aoc2021
02.py
32bd41446d963c5788d4614106405be65de81bcd
test = """forward 5 down 5 forward 8 up 3 down 8 forward 2 """ def part1(lines): h = 0 d = 0 for line in lines: direction, delta = line.split() delta = int(delta) if direction == 'forward': h += delta elif direction == 'down': d += delta elif...
[]
ollc-code/django-back
associations/migrations/0001_initial.py
205f3adc61f9e62c88dfcc170999cef495cebed7
# Generated by Django 3.1.3 on 2020-11-09 08:56 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Associations', fields=[ ('id', models.AutoF...
[((308, 401), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (324, 401), False, 'from django.db import migrations, models\...
seignovert/pyvims
tests/pds/test_times.py
a70b5b9b8bc5c37fa43b7db4d15407f312a31849
"""Test PDS times modules.""" from datetime import datetime as dt from pyvims.pds.times import (cassini2utc, cassini_time, dt_date, dt_doy, dt_iso, dyear, pds_folder, pds_time, utc2cassini) from pytest import approx, raises def test_dt_iso(): """Test parsing ISO time pattern.""" ...
[((640, 694), 'pyvims.pds.times.dt_iso', 'dt_iso', (['"""from 2005-02-14T18:02:29 to 2005-02-14T18:03"""'], {}), "('from 2005-02-14T18:02:29 to 2005-02-14T18:03')\n", (646, 694), False, 'from pyvims.pds.times import cassini2utc, cassini_time, dt_date, dt_doy, dt_iso, dyear, pds_folder, pds_time, utc2cassini\n'), ((1270...
zhouli121018/nodejsgm
e/mail-relay/web/apps/mail/migrations/0109_auto_20171130_1047.py
0ccbc8acf61badc812f684dd39253d55c99f08eb
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('mail', '0108_auto_20171130_1004'), ] operations = [ migrations.AlterModelOptions( name='relaysenderwhitelist', ...
[((248, 348), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""relaysenderwhitelist"""', 'options': "{'verbose_name': '中继发件人白名单'}"}), "(name='relaysenderwhitelist', options={\n 'verbose_name': '中继发件人白名单'})\n", (276, 348), False, 'from django.db import models, migrations\n')...
usegalaxy-no/usegalaxy
venv/lib/python3.6/site-packages/ansible_test/_data/sanity/code-smell/runtime-metadata.py
75dad095769fe918eb39677f2c887e681a747f3a
#!/usr/bin/env python """Schema validation of ansible-core's ansible_builtin_runtime.yml and collection's meta/runtime.yml""" from __future__ import (absolute_import, division, print_function) __metaclass__ = type import datetime import os import re import sys from distutils.version import StrictVersion, LooseVersion ...
[((1510, 1531), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (1529, 1531), False, 'import datetime\n'), ((2513, 2525), 'voluptuous.Invalid', 'Invalid', (['msg'], {}), '(msg)\n', (2520, 2525), False, 'from voluptuous import Required, Schema, Invalid\n'), ((4884, 4918), 'ansible.utils.version.SemanticV...
mitdo/o2ac-ur
catkin_ws/src/o2ac_flexbe/o2ac_flexbe_states/src/o2ac_flexbe_states/align_bearing_holes.py
74c82a54a693bf6a3fc995ff63e7c91ac1fda6fd
#!/usr/bin/env python from flexbe_core import EventState, Logger from flexbe_core.proxy import ProxyActionClient # example import of required action from o2ac_msgs.msg import AlignBearingHolesAction, AlignBearingHolesGoal class AlignBearingHolesActionState(EventState): ''' Actionlib for aligning the bearing ...
[((852, 909), 'flexbe_core.proxy.ProxyActionClient', 'ProxyActionClient', (['{self._topic: AlignBearingHolesAction}'], {}), '({self._topic: AlignBearingHolesAction})\n', (869, 909), False, 'from flexbe_core.proxy import ProxyActionClient\n'), ((1619, 1642), 'o2ac_msgs.msg.AlignBearingHolesGoal', 'AlignBearingHolesGoal'...
sebastian-philipp/find-unicode-control
find_unicode_control.py
170730aff64d17a4d9c57b0284d862c932e1565c
#!/usr/bin/env python3 """Find unicode control characters in source files By default the script takes one or more files or directories and looks for unicode control characters in all text files. To narrow down the files, provide a config file with the -c command line, defining a scan_exclude list, which should be a l...
[((2859, 2888), 'magic.detect_from_filename', 'magic.detect_from_filename', (['f'], {}), '(f)\n', (2885, 2888), False, 'import sys, os, argparse, re, unicodedata, magic\n'), ((3872, 3885), 'os.listdir', 'os.listdir', (['d'], {}), '(d)\n', (3882, 3885), False, 'import sys, os, argparse, re, unicodedata, magic\n'), ((414...
mamadbiabon/iGibson
igibson/object_states/aabb.py
d416a470240eb7ad86e04fee475ae4bd67263a7c
import numpy as np from igibson.external.pybullet_tools.utils import aabb_union, get_aabb, get_all_links from igibson.object_states.object_state_base import CachingEnabledObjectState class AABB(CachingEnabledObjectState): def _compute_value(self): body_id = self.obj.get_body_id() all_links = get_...
[((316, 338), 'igibson.external.pybullet_tools.utils.get_all_links', 'get_all_links', (['body_id'], {}), '(body_id)\n', (329, 338), False, 'from igibson.external.pybullet_tools.utils import aabb_union, get_aabb, get_all_links\n'), ((436, 453), 'igibson.external.pybullet_tools.utils.aabb_union', 'aabb_union', (['aabbs']...
fujigon/integrations-core
vsphere/tests/test_vsphere.py
256b1c138fd1bf1c71db63698737e813cfda00f8
# (C) Datadog, Inc. 2010-2017 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) from __future__ import unicode_literals import time from datetime import datetime import mock import pytest from mock import MagicMock from pyVmomi import vim from datadog_checks.vsphere import VSphereCheck from...
[((1225, 1277), 'datadog_checks.vsphere.VSphereCheck', 'VSphereCheck', (['"""vsphere"""', 'init_config', '{}', '[instance]'], {}), "('vsphere', init_config, {}, [instance])\n", (1237, 1277), False, 'from datadog_checks.vsphere import VSphereCheck\n'), ((2031, 2074), 'datadog_checks.vsphere.VSphereCheck', 'VSphereCheck'...
jp3477/curation
data_steward/constants/validation/email_notification.py
41f98d57c8273d9963ad6d466a237c99b63c74be
MANDRILL_API_KEY = 'MANDRILL_API_KEY' UNSET_MANDRILL_API_KEY_MSG = f"Mandrill API key not set in environment variable {MANDRILL_API_KEY}" CONTACT_LIST_QUERY = """ SELECT * FROM `{{project}}.{{dataset}}.{{contact_table}}` """ EHR_OPERATIONS = 'EHR Ops' EHR_OPS_ZENDESK = 'support@aou-ehr-ops.zendesk.com' DATA_CURATION_...
[]
keshav11/clip
clip/clip.py
f426dee5c3a6885ddeba20d450d85fc71951c5ca
import os import argparse from pathlib import Path CLIP_FILE = os.path.join(Path.home(), '.clip') TEMP_FILE = '.TEMP_FILE' def add_text(key, text): if os.path.exists(CLIP_FILE): open_mode = 'a' else: open_mode = 'w+' with open(CLIP_FILE, open_mode) as clip_file: clip_file.write(ke...
[((77, 88), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (86, 88), False, 'from pathlib import Path\n'), ((158, 183), 'os.path.exists', 'os.path.exists', (['CLIP_FILE'], {}), '(CLIP_FILE)\n', (172, 183), False, 'import os\n'), ((1431, 1518), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descriptio...
learsi1911/GAMA_pygmo_v4
tests/unit/test_nsga2.py
459807db352dd1c9f9c1e0e322f8c1e9b5abbca0
from typing import List, Tuple from gama.genetic_programming.nsga2 import ( NSGAMeta, fast_non_dominated_sort, crowding_distance_assignment, ) def _tuples_to_NSGAMeta(tuples: List[Tuple]) -> List[NSGAMeta]: """ Converts a list of tuples to NSGAMeta objects. """ # Can't declare it directly in a loo...
[((1348, 1384), 'gama.genetic_programming.nsga2.crowding_distance_assignment', 'crowding_distance_assignment', (['pareto'], {}), '(pareto)\n', (1376, 1384), False, 'from gama.genetic_programming.nsga2 import NSGAMeta, fast_non_dominated_sort, crowding_distance_assignment\n'), ((1682, 1718), 'gama.genetic_programming.ns...
crim-ca/stac-ingest
stac_ingest/utils/tds.py
e4cc2a66fee4b86ec238f139135d78215ec91ea4
# File taken from https://github.com/Ouranosinc/pavics-vdb/blob/master/catalog/tds.py """Utility function to parse metadata from a THREDDS Data Server catalog.""" def walk(cat, depth=1): """Return a generator walking a THREDDS data catalog for datasets. Parameters ---------- cat : TDSCatalog T...
[((1578, 1595), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1590, 1595), False, 'import requests\n')]
brunel-physics/mva_scikit
tact/util.py
b0182da89efa466461aaf2cff4387c821df1758b
# -*- coding: utf-8 -*- """ Module containing miscellaneous utility functions. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import collections import itertools import numpy as np class BinaryTree(object): def __init__(self): self.left...
[((3886, 3944), 'numpy.cov', 'np.cov', (['x', 'y', 'rowvar'], {'fweights': 'fweights', 'aweights': 'aweights'}), '(x, y, rowvar, fweights=fweights, aweights=aweights)\n', (3892, 3944), True, 'import numpy as np\n'), ((4122, 4137), 'numpy.sqrt', 'np.sqrt', (['d.real'], {}), '(d.real)\n', (4129, 4137), True, 'import nump...
DavidNKraemer/ams553-final-project
src/stochastic_tour.py
fc23fe5f126a8bd9ea593c0b339883ec71820a05
import numpy as np import random from collections import namedtuple def generate_prob_matrix(n): matrix = np.random.rand(n, n) for i in range(n): matrix[i][i] = 0 for i in range(n): matrix[i] = (1/np.sum(matrix[i]))*matrix[i] return matrix def categorical(p): return np.random...
[((357, 397), 'collections.namedtuple', 'namedtuple', (['"""Drone"""', '"""speed probability"""'], {}), "('Drone', 'speed probability')\n", (367, 397), False, 'from collections import namedtuple\n'), ((405, 435), 'collections.namedtuple', 'namedtuple', (['"""Site"""', '"""location"""'], {}), "('Site', 'location')\n", (...
mcasanova1445/models
orbit/actions/conditional_action_test.py
37be0fdb4abccca633bb3199a4e6f3f71cd174d9
# Copyright 2022 The Orbit 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 applicable l...
[((1310, 1324), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (1322, 1324), True, 'import tensorflow as tf\n'), ((966, 1052), 'orbit.actions.ConditionalAction', 'actions.ConditionalAction', ([], {'condition': "(lambda x: x['value'])", 'action': 'raise_assertion'}), "(condition=lambda x: x['value'], action=\...
phnomcobra/valarie-content
Customizations/Tagging/show_tags.task.py
b1f6242605badd2b0b2e53c4320f5d963b5e0b21
#!/usr/bin/python ################################################################################ # DOCUMENTS # # Justin Dierking # justin.l.dierking.civ@mail.mil # 614 692 2050 # # 04/22/2018 Original Construction ################################################################################ import traceback impor...
[((684, 716), 'json.dumps', 'json.dumps', (['key.object'], {'indent': '(4)'}), '(key.object, indent=4)\n', (694, 716), False, 'import json\n'), ((821, 843), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (841, 843), False, 'import traceback\n')]
DerThorsten/seglib
examples/python/masked_hist.py
4655079e390e301dd93e53f5beed6c9737d6df9f
import vigra import numpy import pylab from seglib import cgp2d from seglib.preprocessing import norm01 import seglib.edge_detectors.pixel as edp import seglib.region_descriptors.pixel as rdp from seglib.preprocessing import norm01 from seglib.histogram import jointHistogram,histogram from seglib.region_descriptors.p...
[]
helwete/simple-backup
backup/models.py
c7dd1a08d398f5b4005c187e274e192b2e024f30
from datetime import date from django.conf import settings from django.db import models # Create your models here. def user_directory_path(instance, filename): # file will be uploaded to MEDIA_ROOT/user_<id>/<filename> today = date.today() return '{0}/{2}/{1}'.format(instance.user.username, filename, toda...
[((237, 249), 'datetime.date.today', 'date.today', ([], {}), '()\n', (247, 249), False, 'from datetime import date\n'), ((395, 465), 'django.db.models.FileField', 'models.FileField', ([], {'null': '(True)', 'blank': '(True)', 'upload_to': 'user_directory_path'}), '(null=True, blank=True, upload_to=user_directory_path)\...
Jojoxiao/Machine-Learning-for-Beginner-by-Python3
Kmeans Cluster/Kmeans_Compare.py
71b91c9cba5803bd78d4d31be6dabb1d3989e968
#-*- coding:utf-8 -*- # &Author AnFany # 引入方法 import Kmeans_AnFany as K_Af # AnFany import Kmeans_Sklearn as K_Sk # Sklearn import matplotlib.pyplot as plt from pylab import mpl # 作图显示中文 mpl.rcParams['font.sans-serif'] = ['FangSong'] # 设置中文字体新宋体 mpl.rcParams['axes.unicode_minus'] = False import numpy as...
[((393, 443), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': '(600)', 'centers': '(6)', 'n_features': '(2)'}), '(n_samples=600, centers=6, n_features=2)\n', (403, 443), False, 'from sklearn.datasets import make_blobs\n'), ((964, 993), 'Kmeans_AnFany.op_kmeans', 'K_Af.op_kmeans', (['X'], {'countcen': '(...
Stayermax/5dof-bartender-robot
control_panel.py
dd04303afd2c252e6f7105e33ba35b01f3915194
#!/usr/bin/env python """ Control panel file """ import pddl_solver as pddl import ik import rospy from get_object_position import get_object_position import time from constants import * from spawn_models import reset_model_position, reset_all, spawn_model, spawn_all_models from delete_models import delete_all, de...
[((365, 401), 'ik.MoveGroupPythonIntefaceTutorial', 'ik.MoveGroupPythonIntefaceTutorial', ([], {}), '()\n', (399, 401), False, 'import ik\n'), ((533, 560), 'get_object_position.get_object_position', 'get_object_position', (['bottle'], {}), '(bottle)\n', (552, 560), False, 'from get_object_position import get_object_pos...
archanpatkar/Enigma
Enigma/Enigma.py
dbbc1fda99bf451a0284f051c724ed43915dfe2a
from Enigma.Rotor import Rotor from Enigma.Reflector import Reflector from Enigma.Plugboard import Plugboard class Enigma: def __init__(self , rotors = [ Rotor(0,"IC") , Rotor(0,"IIC") , Rotor(0,"IIIC") ] , plugboard = Plugboard() , reflector = Reflector("A")): self.rotors = rotors for i in r...
[((229, 240), 'Enigma.Plugboard.Plugboard', 'Plugboard', ([], {}), '()\n', (238, 240), False, 'from Enigma.Plugboard import Plugboard\n'), ((255, 269), 'Enigma.Reflector.Reflector', 'Reflector', (['"""A"""'], {}), "('A')\n", (264, 269), False, 'from Enigma.Reflector import Reflector\n'), ((164, 178), 'Enigma.Rotor.Roto...
xiki-tempula/spack
var/spack/repos/builtin/packages/exiv2/package.py
9d66c05e93ab8a933fc59915040c0e0c86a4aac4
# Copyright 2013-2020 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 Exiv2(CMakePackage): """Exiv2 is a Cross-platform C++ library and a command line utility ...
[]
JMIdeaMaker/django-magicauth
magicauth/send_token.py
ffca3423c46f8f3d7e49eaf374b33265d4730587
import math from django.contrib.auth import get_user_model from django.contrib.sites.shortcuts import get_current_site from django.core.mail import send_mail from django.template import loader from magicauth import settings as magicauth_settings from django.conf import settings as django_settings from magicauth.model...
[((441, 501), 'sendgrid.SendGridAPIClient', 'sendgrid.SendGridAPIClient', (['django_settings.SENDGRID_API_KEY'], {}), '(django_settings.SENDGRID_API_KEY)\n', (467, 501), False, 'import sendgrid\n'), ((678, 714), 'magicauth.models.MagicToken.objects.create', 'MagicToken.objects.create', ([], {'user': 'user'}), '(user=us...
loriab/qccddb
qcdb/util/paths.py
d9e156ef8b313ac0633211fc6b841f84a3ddde24
import os import sys ## {{{ http://code.activestate.com/recipes/52224/ (r1) def search_file(filename, search_path): """Given an os.pathsep divided `search_path`, find first occurrence of `filename`. Returns full path to file if found or None if unfound. """ file_found = False paths = search_path....
[((439, 467), 'os.path.join', 'os.path.join', (['path', 'filename'], {}), '(path, filename)\n', (451, 467), False, 'import os\n'), ((568, 596), 'os.path.join', 'os.path.join', (['path', 'filename'], {}), '(path, filename)\n', (580, 596), False, 'import os\n'), ((2003, 2026), 'sys.path.insert', 'sys.path.insert', (['(0)...
JiangBowen-master/DeepCTR
tests/models/DCN_test.py
291ffb0ff3b8322f64bd839f963d5c7a70e6b358
import pytest import tensorflow as tf from deepctr.estimator import DCNEstimator from deepctr.models import DCN from ..utils import check_model, get_test_data, SAMPLE_SIZE, get_test_data_estimator, check_estimator, \ Estimator_TEST_TF1 @pytest.mark.parametrize( 'cross_num,hidden_size,sparse_feature_num,cross...
[((244, 490), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""cross_num,hidden_size,sparse_feature_num,cross_parameterization"""', "[(0, (8,), 2, 'vector'), (1, (), 1, 'vector'), (1, (8,), 3, 'vector'), (0,\n (8,), 2, 'matrix'), (1, (), 1, 'matrix'), (1, (8,), 3, 'matrix')]"], {}), "(\n 'cross_num,hid...
jacnugent/fv3net
workflows/post_process_run/fv3post/gsutil.py
84958651bdd17784fdab98f87ad0d65414c03368
import os import subprocess import backoff class GSUtilResumableUploadException(Exception): pass def _decode_to_str_if_bytes(s, encoding="utf-8"): if isinstance(s, bytes): return s.decode(encoding) else: return s def authenticate(): try: credentials = os.environ["GOOGLE_AP...
[((518, 597), 'backoff.on_exception', 'backoff.on_exception', (['backoff.expo', 'GSUtilResumableUploadException'], {'max_tries': '(3)'}), '(backoff.expo, GSUtilResumableUploadException, max_tries=3)\n', (538, 597), False, 'import backoff\n'), ((1109, 1141), 'os.makedirs', 'os.makedirs', (['dest'], {'exist_ok': '(True)'...
rpappalax/deploy-tix
deploy_tix/__main__.py
a53c7fa7898b9f0c2f530c8abd8bab322a2eb7bc
import argparse from deploy_tix.bugzilla_rest_client import BugzillaRESTClient from deploy_tix.release_notes import ReleaseNotes from output_helper import OutputHelper def main(args=None): parser = argparse.ArgumentParser( description='Scripts for creating / updating deployment tickets in \ Bugzi...
[((205, 379), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Scripts for creating / updating deployment tickets in Bugzilla"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description=\n 'Scripts for creating / updating deployment tickets in Bugzi...
lebarsfa/vpython-wx
site-packages/visual/examples/drape.py
38df062e5532b79f632f4f2a1abae86754c264a9
from visual import * print(""" Click to place spheres under falling string. Right button drag or Ctrl-drag to rotate view. Middle button drag or Alt-drag to zoom in or out. On a two-button mouse, middle is left + right. """) # David Scherer scene.title = "Drape" restlength = 0.02 m = 0.010 * restlengt...
[]
dlee992/sdc
sdc/utilities/sdc_typing_utils.py
1ebf55c00ef38dfbd401a70b3945e352a5a38b87
# ***************************************************************************** # Copyright (c) 2020, Intel Corporation All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of sou...
[((7400, 7457), 'numpy.find_common_type', 'numpy.find_common_type', (['np_array_dtypes', 'np_scalar_dtypes'], {}), '(np_array_dtypes, np_scalar_dtypes)\n', (7422, 7457), False, 'import numpy\n'), ((7483, 7524), 'numba.np.numpy_support.from_dtype', 'numpy_support.from_dtype', (['np_common_dtype'], {}), '(np_common_dtype...
PROxZIMA/Competitive-Coding
Hackerrank/Contests/Project Euler/euler010.py
ba6b365ea130b6fcaa15c5537b530ed363bab793
from math import sqrt # Naive method: Loop through N and check if every number is prime or not. If prime add to sum. Time complexity is O(√n). Time of execution ~ 8sec for n = 1000000 def prime(n): yield 2 yield 3 for p in range(5, n+1, 2): if p % 3 == 0: continue else: ...
[((348, 355), 'math.sqrt', 'sqrt', (['p'], {}), '(p)\n', (352, 355), False, 'from math import sqrt\n')]
ckamtsikis/cmssw
DQM/L1TMonitorClient/python/L1EmulatorErrorFlagClient_cfi.py
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester l1EmulatorErrorFlagClient = DQMEDHarvester("L1EmulatorErrorFlagClient", # # for each L1 system, give: # - SystemLabel: system label # - HwValLabel: system label as used in hardware validation ...
[((816, 834), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""ECAL"""'], {}), "('ECAL')\n", (826, 834), True, 'import FWCore.ParameterSet.Config as cms\n'), ((873, 890), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""ETP"""'], {}), "('ETP')\n", (883, 890), True, 'import FWCore.ParameterSet.Config as ...
jzwang43/codalab-worksheets
codalab/model/tables.py
b1d4c6cc4b72f4dfa35a15f876e2d0ce9a03d28d
""" The SQLAlchemy table objects for the CodaLab bundle system tables. """ # TODO: Replace String and Text columns with Unicode and UnicodeText as appropriate # This way, SQLAlchemy will automatically perform conversions to and from UTF-8 # encoding, or use appropriate database engine-specific data types for Unicode # ...
[((704, 714), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (712, 714), False, 'from sqlalchemy import Column, ForeignKey, Index, MetaData, Table, UniqueConstraint\n'), ((1090, 1128), 'sqlalchemy.Column', 'Column', (['"""command"""', 'Text'], {'nullable': '(True)'}), "('command', Text, nullable=True)\n", (1096, ...
hansthienpondt/ansible-networking-collections
grpc/plugins/connection/gnmi.py
278c88fceac297693a31df3cb54c942284823fbd
# (c) 2020 Nokia # # Licensed under the BSD 3 Clause license # SPDX-License-Identifier: BSD-3-Clause # from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = """ --- author: - "Hans Thienpondt (@HansThienpondt)" - "Sven Wisotzky (@wisotzky)" connection: gnmi short_...
[((13276, 13308), 'ansible_collections.nokia.grpc.plugins.connection.pb.gnmi_pb2.gNMIStub', 'gnmi_pb2.gNMIStub', (['self._channel'], {}), '(self._channel)\n', (13293, 13308), False, 'from ansible_collections.nokia.grpc.plugins.connection.pb import gnmi_pb2\n'), ((14394, 14433), 'ansible_collections.nokia.grpc.plugins.c...
tbeckham/eutester
testcases/cloud_admin/services_up_test.py
1440187150ce284bd87147e71ac7f0fda194b4d9
#!/usr/bin/python # Software License Agreement (BSD License) # # Copyright (c) 2009-2011, Eucalyptus Systems, Inc. # All rights reserved. # # Redistribution and use of this software in source and binary forms, with or # without modification, are permitted provided that the following conditions # are met: # # Redistri...
[]
jules552/ProjetISN
intValues.py
20da3572b59af25a166022bc2f5b25d46add2650
MAP = 1 SPEED = 1.5 VELOCITYRESET = 6 WIDTH = 1280 HEIGHT = 720 X = WIDTH / 2 - 50 Y = HEIGHT / 2 - 50 MOUSER = 325 TICKRATES = 120 nfc = False raspberry = False
[]
while1618/DailyCodingProblem
April/Apr_25_2019/builder.py
187909f78281828da543439646cdf52d64c2bd0c
# This problem was asked by Facebook. # # A builder is looking to build a row of N houses that can be of K different colors. # He has a goal of minimizing cost while ensuring that no two neighboring houses are of the same color. # # Given an N by K matrix where the nth row and kth column represents the cost to build th...
[]
pfnet-research/bayesgrad
experiments/delaney/plot.py
5db613391777b20b7a367c274804f0b736991b0a
import argparse import numpy as np import os import sys import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) from saliency.visualizer.smiles_visualizer import SmilesVisualizer def visualize(dir_path): ...
[((76, 97), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (90, 97), False, 'import matplotlib\n'), ((336, 361), 'os.path.dirname', 'os.path.dirname', (['dir_path'], {}), '(dir_path)\n', (351, 361), False, 'import os\n'), ((611, 629), 'saliency.visualizer.smiles_visualizer.SmilesVisualizer', 'Smi...
btybug/main.albumbugs
public/js/tinymice/plugins/bootstrap/jquery-file-tree/connectors/jqueryFileTree.py
2343466bae7ee3d8941abc4c9684667cccc3e103
# # jQuery File Tree # Python/Django connector script # By Martin Skou # import os import urllib def dirlist(request): r=['<ul class="jqueryFileTree" style="display: none;">'] try: r=['<ul class="jqueryFileTree" style="display: none;">'] d=urllib.unquote(request.POST.get('dir','c:\\temp')) f...
[]
harvineet/gpytorch
gpytorch/lazy/chol_lazy_tensor.py
8aa8f1a4298ef61cfea9c4d11c75576a84ffcc3e
#!/usr/bin/env python3 import torch from .lazy_tensor import LazyTensor from .root_lazy_tensor import RootLazyTensor from .. import settings class CholLazyTensor(RootLazyTensor): def __init__(self, chol): if isinstance(chol, LazyTensor): # Probably is an instance of NonLazyTensor chol = cho...
[((574, 597), 'torch.equal', 'torch.equal', (['chol', 'chol'], {}), '(chol, chol)\n', (585, 597), False, 'import torch\n'), ((440, 505), 'torch.ones', 'torch.ones', (['chol.shape[-2:]'], {'dtype': 'chol.dtype', 'device': 'chol.device'}), '(chol.shape[-2:], dtype=chol.dtype, device=chol.device)\n', (450, 505), False, 'i...
ksmit799/POTCO-PS
pirates/audio/AmbientManagerBase.py
520d38935ae8df4b452c733a82c94dddac01e275
# File: A (Python 2.4) from pandac.PandaModules import AudioSound from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import LerpFunc, Sequence from direct.showbase.DirectObject import DirectObject class AmbientSound: notify = DirectNotifyGlobal.directNotify.newCategory('Ambient...
[((268, 327), 'direct.directnotify.DirectNotifyGlobal.directNotify.newCategory', 'DirectNotifyGlobal.directNotify.newCategory', (['"""AmbientSound"""'], {}), "('AmbientSound')\n", (311, 327), False, 'from direct.directnotify import DirectNotifyGlobal\n'), ((3569, 3634), 'direct.directnotify.DirectNotifyGlobal.directNot...
jmgc/pyston
test/tests/import_test.py
9f672c1bbb75710ac17dd3d9107da05c8e9e8e8f
import import_target print import_target.x import import_target import_target.foo() c = import_target.C() print import_target.import_nested_target.y import_target.import_nested_target.bar() d = import_target.import_nested_target.D() print "testing importfrom:" from import_target import x as z print z import_nested...
[]
HEXRD/hexrdgui
hexrd/ui/matrix_editor.py
d92915463f237e0521b5830655ae73bc5bcd9f80
import numpy as np from PySide2.QtCore import QSignalBlocker, Signal from PySide2.QtWidgets import QGridLayout, QWidget from hexrd.ui.scientificspinbox import ScientificDoubleSpinBox DEFAULT_ENABLED_STYLE_SHEET = 'background-color: white' DEFAULT_DISABLED_STYLE_SHEET = 'background-color: #F0F0F0' INVALID_MATRIX_STY...
[((407, 415), 'PySide2.QtCore.Signal', 'Signal', ([], {}), '()\n', (413, 415), False, 'from PySide2.QtCore import QSignalBlocker, Signal\n'), ((6248, 6269), 'numpy.ones', 'np.ones', (['(rows, cols)'], {}), '((rows, cols))\n', (6255, 6269), True, 'import numpy as np\n'), ((6281, 6303), 'PySide2.QtWidgets.QApplication', ...
harshp8l/deep-learning-lang-detection
data/train/python/990aa6cbf16ed34f5030609c03ab43c0f0ed8c2aurls.py
2a54293181c1c2b1a2b840ddee4d4d80177efb33
from django.conf.urls.defaults import * urlpatterns = patterns('pytorque.views', (r'^$', 'central_dispatch_view'), (r'^browse$', 'central_dispatch_view'), (r'^monitor$', 'central_dispatch_view'), (r'^submit$', 'central_dispatch_view'), (r'^stat$', 'central_dispatch_view'), (r'^login/$', 'login...
[]
yedivanseven/CheckerPy
checkerpy/types/all/typedtuple.py
04612086d25fecdd0b20ca0a050db8620c437b0e
from typing import Tuple, Union, Any, Sequence from collections import deque, defaultdict, OrderedDict from ...validators.one import JustLen from ...functional.mixins import CompositionClassMixin from ..one import Just dict_keys = type({}.keys()) odict_keys = type(OrderedDict({}).keys()) dict_values = type({}.values()...
[((266, 281), 'collections.OrderedDict', 'OrderedDict', (['{}'], {}), '({})\n', (277, 281), False, 'from collections import deque, defaultdict, OrderedDict\n'), ((342, 357), 'collections.OrderedDict', 'OrderedDict', (['{}'], {}), '({})\n', (353, 357), False, 'from collections import deque, defaultdict, OrderedDict\n'),...
iswenhao/Panda-Sandbox
data/analyzer/linux/lib/common/abstracts.py
a04069d404cb4326ff459e703f14625dc45759ed
# Copyright (C) 2014-2016 Cuckoo Foundation. # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org # See the file 'docs/LICENSE' for copying permission. from lib.api.process import Process from lib.exceptions.exceptions import CuckooPackageError class Package(object): """Base abstract analysis pack...
[((1077, 1086), 'lib.api.process.Process', 'Process', ([], {}), '()\n', (1084, 1086), False, 'from lib.api.process import Process\n'), ((1136, 1214), 'lib.exceptions.exceptions.CuckooPackageError', 'CuckooPackageError', (['"""Unable to execute the initial process, analysis aborted."""'], {}), "('Unable to execute the i...
Raspeanut/rdmo
rdmo/options/apps.py
9f785010a499c372a2f8368ccf76d2ea4150adcb
from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ class OptionsConfig(AppConfig): name = 'rdmo.options' verbose_name = _('Options')
[((169, 181), 'django.utils.translation.ugettext_lazy', '_', (['"""Options"""'], {}), "('Options')\n", (170, 181), True, 'from django.utils.translation import ugettext_lazy as _\n')]
sirodoht/mal
main/admin.py
82295e1b6a03cd9a7ee1357ca3f5be7a26d0ffe9
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from main import models class Admin(UserAdmin): list_display = ("id", "username", "email", "date_joined", "last_login") admin.site.register(models.User, Admin) class DocumentAdmin(admin.ModelAdmin): list_display = ("id", "ti...
[((210, 249), 'django.contrib.admin.site.register', 'admin.site.register', (['models.User', 'Admin'], {}), '(models.User, Admin)\n', (229, 249), False, 'from django.contrib import admin\n'), ((328, 379), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Document', 'DocumentAdmin'], {}), '(models.Do...
QualiSystems/cloudshell-cli
cloudshell/cli/configurator.py
9a38ff37e91e7798511e860603f5a8a79b782472
#!/usr/bin/python # -*- coding: utf-8 -*- import sys from abc import ABCMeta, abstractmethod from collections import defaultdict from cloudshell.cli.factory.session_factory import ( CloudInfoAccessKeySessionFactory, GenericSessionFactory, SessionFactory, ) from cloudshell.cli.service.cli import CLI from cl...
[((442, 486), 'abc.ABCMeta', 'ABCMeta', (['"""ABC"""', '(object,)', "{'__slots__': ()}"], {}), "('ABC', (object,), {'__slots__': ()})\n", (449, 486), False, 'from abc import ABCMeta, abstractmethod\n'), ((1796, 1807), 'functools32.lru_cache', 'lru_cache', ([], {}), '()\n', (1805, 1807), False, 'from functools32 import ...
quynhanh-ngx/pytago
examples/ingenerator.py
de976ad8d85702ae665e97978bc4a75d282c857f
def main(): n = 111 gen = (n * 7 for x in range(10)) if 777 in gen: print("Yes!") if __name__ == '__main__': main()
[]
amittkSharma/scs_predictive_maintenance
source/packages/scs-pm-server/src/python-server/app.py
105a218b47d81d02f7e799287bd1e9279db452ce
import json import logging import joblib import pandas as pd from flask import Flask, jsonify, request from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app) @app.route("/api/machinePrediction", methods=['GET']) def home(): incomingMachineId = request.args.get('machineId') modelPath = requ...
[((153, 168), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (158, 168), False, 'from flask import Flask, jsonify, request\n'), ((169, 178), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (173, 178), False, 'from flask_cors import CORS, cross_origin\n'), ((270, 299), 'flask.request.args.get', 'reques...
ess-dmsc/nexus-constructor
tests/test_remove_from_dependee_chain.py
ae0026c48f8f2d4d88d3ff00e45cb6591983853b
import pytest from PySide2.QtGui import QVector3D from nexus_constructor.model.component import Component from nexus_constructor.model.dataset import Dataset from nexus_constructor.model.instrument import Instrument from nexus_constructor.model.value_type import ValueTypes values = Dataset( name="scalar_value", ...
[((285, 382), 'nexus_constructor.model.dataset.Dataset', 'Dataset', ([], {'name': '"""scalar_value"""', 'type': 'ValueTypes.DOUBLE', 'size': '[1]', 'values': '(90.0)', 'parent_node': 'None'}), "(name='scalar_value', type=ValueTypes.DOUBLE, size=[1], values=90.0,\n parent_node=None)\n", (292, 382), False, 'from nexus...
molspace/FastMVS_experiments
fastmvsnet/train1.py
b897015d77600687ca2addf99bb6a6f0de524e5f
#!/usr/bin/env python import argparse import os.path as osp import logging import time import sys sys.path.insert(0, osp.dirname(__file__) + '/..') import torch import torch.nn as nn from fastmvsnet.config import load_cfg_from_file from fastmvsnet.utils.io import mkdir from fastmvsnet.utils.logger import setup_logger...
[((815, 882), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Fast-MVSNet Training"""'}), "(description='PyTorch Fast-MVSNet Training')\n", (838, 882), False, 'import argparse\n'), ((1643, 1680), 'logging.getLogger', 'logging.getLogger', (['"""fastmvsnet.train"""'], {}), "('fastmv...
fossabot/unifacisa-visao-computacional
modulo2/3-detectores/3.2-detector/models.py
14aef22a3e7fe10ee820d31ce12ad21a3cad7b0b
# Estrutura básica para projetos de Machine Learning e Deep Learning # Por Adriano Santos. from torch import nn, relu import torch.nn.functional as F import torch.optim as optim import torch from torchvision import models class ResNet(nn.Module): def __init__(self, saida, pretreinado=True): super(ResNet,...
[((356, 395), 'torchvision.models.resnet34', 'models.resnet34', ([], {'pretrained': 'pretreinado'}), '(pretrained=pretreinado)\n', (371, 395), False, 'from torchvision import models\n'), ((467, 493), 'torch.nn.Sequential', 'nn.Sequential', (['*layers[:6]'], {}), '(*layers[:6])\n', (480, 493), False, 'from torch import ...
sbrodeur/evert
python/setup.py
c7005ba29576145ab650144f9b9230eaf7bec460
#!/usr/bin/env python # Copyright (c) 2017, Simon Brodeur # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, th...
[((1713, 2278), 'distutils.core.Extension', 'Extension', (['"""_evert"""'], {'define_macros': "[('MAJOR_VERSION', '1'), ('MINOR_VERSION', '0')]", 'include_dirs': "['../include']", 'sources': "['../src/elBeam.cpp', '../src/elBSP.cpp', '../src/elGLUT.cpp',\n '../src/elListener.cpp', '../src/elOrientedPoint.cpp',\n ...
kodo-pp/somegame-but-not-that-one
somegame/fps_osd.py
6252d34b84fe7c83ada9e699df17688c50dd7596
import pygame from loguru import logger from somegame.osd import OSD class FpsOSD(OSD): def __init__(self, game): super().__init__(game) logger.info('Loading font') self.font = pygame.font.Font(pygame.font.get_default_font(), 32) def draw(self, surface): fps = self.game.get_a...
[((160, 187), 'loguru.logger.info', 'logger.info', (['"""Loading font"""'], {}), "('Loading font')\n", (171, 187), False, 'from loguru import logger\n'), ((225, 255), 'pygame.font.get_default_font', 'pygame.font.get_default_font', ([], {}), '()\n', (253, 255), False, 'import pygame\n')]
sgwhat/BigDL
python/chronos/test/bigdl/chronos/data/experimental/test_xshardstsdataset.py
25b402666fbb26b0bc18fc8100e9a00469844778
# # Copyright 2016 The BigDL 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 applicable law or agreed to in ...
[((1051, 1077), 'bigdl.orca.common.init_orca_context', 'init_orca_context', ([], {'cores': '(8)'}), '(cores=8)\n', (1068, 1077), False, 'from bigdl.orca.common import init_orca_context, stop_orca_context, OrcaContext\n'), ((1087, 1118), 'bigdl.orca.common.OrcaContext.get_spark_context', 'OrcaContext.get_spark_context',...
WXSD-Sales/ZoomToWebex
zoom_functions.py
16cc663620e2ef2904b0e2857d709aee96b78eb7
import json import tornado.gen import traceback from base64 import b64encode from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPError from settings import Settings from mongo_db_controller import ZoomUserDB @tornado.gen.coroutine def zoomRefresh(zoom_user): url = "https://zoom.us/oauth/token" p...
[((820, 882), 'tornado.httpclient.HTTPRequest', 'HTTPRequest', (['url'], {'method': '"""POST"""', 'headers': 'headers', 'body': 'payload'}), "(url, method='POST', headers=headers, body=payload)\n", (831, 882), False, 'from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPError\n'), ((901, 918), 'tornado.http...
gmuraru/CrypTen
crypten/mpc/__init__.py
e39a7aaf65436706321fe4e3fc055308c78b6b92
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from crypten.mpc import primitives # noqa: F401 from crypten.mpc import provider # noqa: F40 from .conte...
[((810, 856), 'os.environ.get', 'os.environ.get', (['"""CRYPTEN_PROVIDER_NAME"""', '"""TFP"""'], {}), "('CRYPTEN_PROVIDER_NAME', 'TFP')\n", (824, 856), False, 'import os\n')]
lahosken/pants
contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/pyflakes.py
1b0340987c9b2eab9411416803c75b80736716e4
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from pyflakes.checke...
[((1750, 1813), 'pyflakes.checker.Checker', 'FlakesChecker', (['self.python_file.tree', 'self.python_file.filename'], {}), '(self.python_file.tree, self.python_file.filename)\n', (1763, 1813), True, 'from pyflakes.checker import Checker as FlakesChecker\n')]
boyombo/pharmrep
pharmrep/forum/models.py
2293ceb235dec949c58fa40d1ee43fce172e0ceb
from django.db import models from django.contrib.auth.models import User from django.contrib import admin from django.utils.translation import ugettext_lazy as _ class Forum(models.Model): title = models.CharField(max_length=60) description = models.TextField(blank=True, default='') updated = models.DateTi...
[((202, 233), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(60)'}), '(max_length=60)\n', (218, 233), False, 'from django.db import models\n'), ((252, 292), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'default': '""""""'}), "(blank=True, default='')\n", (268, 292)...
jinnerbichler/home-automflashion
iri-node/fabfile.py
f93442712322ab819651f453437c11f685640e83
import time from fabric.api import run, env, task, put, cd, local, sudo env.use_ssh_config = True env.hosts = ['iota_node'] @task(default=True) def iri(): run('mkdir -p /srv/private-tangle/') with cd('/srv/private-tangle'): put('.', '.') run('docker-compose --project-name private-tangle pull'...
[((128, 146), 'fabric.api.task', 'task', ([], {'default': '(True)'}), '(default=True)\n', (132, 146), False, 'from fabric.api import run, env, task, put, cd, local, sudo\n'), ((162, 198), 'fabric.api.run', 'run', (['"""mkdir -p /srv/private-tangle/"""'], {}), "('mkdir -p /srv/private-tangle/')\n", (165, 198), False, 'f...
ptorresmanque/MachineLearning_v2.0
features.py
795e47b9cfc68f4e0fefb700d43af6c59e2f1d73
import sqlite3 from random import randint, choice import numpy as np conn = sqlite3.connect('ej.db') c = conn.cursor() #OBTENIENDO TAMAnOS MAXIMOS MINIMOS Y PROMEDIO# c.execute('SELECT MAX(alto) FROM features') resultado = c.fetchone() if resultado: altoMax = resultado[0] c.execute('SELECT MIN(alto) FROM featu...
[((78, 102), 'sqlite3.connect', 'sqlite3.connect', (['"""ej.db"""'], {}), "('ej.db')\n", (93, 102), False, 'import sqlite3\n'), ((1413, 1448), 'numpy.random.randint', 'np.random.randint', (['(1)', 'rand_alto_min'], {}), '(1, rand_alto_min)\n', (1430, 1448), True, 'import numpy as np\n'), ((1450, 1486), 'numpy.random.ra...
achilleas-k/brian2
dev/ideas/cython/playing_around.py
906563b6b1321585b082f79f74f1b4ab386347ec
from pylab import * import cython import time, timeit from brian2.codegen.runtime.cython_rt.modified_inline import modified_cython_inline import numpy from scipy import weave import numexpr import theano from theano import tensor as tt tau = 20 * 0.001 N = 1000000 b = 1.2 # constant current mean, the modul...
[]
lordmahyar/az-iranian-bank-gateways
azbankgateways/views/__init__.py
e9eb7101f2b91318847d63d783c22c4a8d430ba3
from .banks import callback_view, go_to_bank_gateway from .samples import sample_payment_view, sample_result_view
[]
PowerDNS/exabgp
dev/unittest/update.py
bbf69f25853e10432fbe588b5bc2f8d9f1e5dda2
#!/usr/bin/env python # encoding: utf-8 """ update.py Created by Thomas Mangin on 2009-09-06. Copyright (c) 2009-2013 Exa Networks. All rights reserved. """ import unittest from exabgp.configuration.environment import environment env = environment.setup('') from exabgp.bgp.message.update.update import * from exabgp...
[]
WJ-Lai/NightFusion
nuscenes/eval/detection/evaluate.py
1555692eceb6b85127d21cd43e6fc780b7f91ffd
# nuScenes dev-kit. # Code written by Holger Caesar & Oscar Beijbom, 2018. # Licensed under the Creative Commons [see licence.txt] import argparse import json import os import random import time from typing import Tuple, Dict, Any import numpy as np from nuscenes import NuScenes from nuscenes.eval.detection.algo imp...
[((9850, 9985), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluate nuScenes result submission."""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Evaluate nuScenes result submission.',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (...
aberent/api-client
tests/get_problem_atcoder.py
845e5f1daa02cc7fee5a65234a24bb59a7b71083
import unittest from onlinejudge_api.main import main class DownloadAtCoderTest(unittest.TestCase): def test_icpc2013spring_a(self): """This problem contains both words `Input` and `Output` for the headings for sample outputs. """ url = 'http://jag2013spring.contest.atcoder.jp/tasks/icpc...
[((1739, 1777), 'onlinejudge_api.main.main', 'main', (["['get-problem', url]"], {'debug': '(True)'}), "(['get-problem', url], debug=True)\n", (1743, 1777), False, 'from onlinejudge_api.main import main\n'), ((3062, 3100), 'onlinejudge_api.main.main', 'main', (["['get-problem', url]"], {'debug': '(True)'}), "(['get-prob...
UMCollab/ODM
odm/libexec/odm_tenant.py
95da49939dbcd54318a58a132aa76725fd9c0b5f
#!/usr/bin/env python3 # This file is part of ODM and distributed under the terms of the # MIT license. See COPYING. import json import sys import odm.cli def main(): cli = odm.cli.CLI(['action']) client = cli.client if cli.args.action == 'list-users': print(json.dumps(client.list_users(), ind...
[((629, 640), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (637, 640), False, 'import sys\n')]
quaresmajose/tools-python
tests/test_tag_value_parser.py
53c917a1a2491a373efa23e4ef8570b5e863fabc
# Copyright (c) 2014 Ahmed H. Ismail # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing...
[((938, 945), 'spdx.parsers.lexers.tagvalue.Lexer', 'Lexer', ([], {}), '()\n', (943, 945), False, 'from spdx.parsers.lexers.tagvalue import Lexer\n'), ((16132, 16142), 'io.StringIO', 'StringIO', ([], {}), '()\n', (16140, 16142), False, 'from io import StringIO\n'), ((13241, 13250), 'spdx.parsers.tagvaluebuilders.Builde...
DT-was-an-ET/fanshim-python-pwm
mount_drives.py
dd3e6e29251000946e34d80704c040b5bcad7f8e
# Standard library imports from subprocess import call as subprocess_call from utility import fileexists from time import sleep as time_sleep from datetime import datetime mount_try = 1 not_yet = True done = False start_time = datetime.now() if fileexists("/home/rpi4-sftp/usb/drive_present.txt"): when_usba...
[((237, 251), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (249, 251), False, 'from datetime import datetime\n'), ((256, 307), 'utility.fileexists', 'fileexists', (['"""/home/rpi4-sftp/usb/drive_present.txt"""'], {}), "('/home/rpi4-sftp/usb/drive_present.txt')\n", (266, 307), False, 'from utility import f...
Kshitij-Kumar-Singh-Chauhan/docon
home/views.py
bff0547e7bbd030e027217a2ca7800a8da529b56
from django.http.response import HttpResponse from django.shortcuts import render from django.shortcuts import redirect, render from cryptography.fernet import Fernet from .models import Book, UserDetails from .models import Contact from .models import Book from .models import Report from .models import Diagnostic from...
[((3400, 3429), 'django.shortcuts.render', 'render', (['request', '"""about.html"""'], {}), "(request, 'about.html')\n", (3406, 3429), False, 'from django.shortcuts import redirect, render\n'), ((3464, 3496), 'django.shortcuts.render', 'render', (['request', '"""services.html"""'], {}), "(request, 'services.html')\n", ...
kube-HPC/python-wrapper.hkube
hkube_python_wrapper/storage/base_storage_manager.py
74713d9fea6689c116ade7d67b7ab67373a79d3b
class BaseStorageManager(object): def __init__(self, adpter): self.adapter = adpter def put(self, options): try: return self.adapter.put(options) except Exception: raise Exception('Failed to write data to storage') def get(self, options): try: ...
[]
bigmlcom/django_compressor
compressor/tests/templatetags.py
66dfda503633018275fdb64ad46ef80dc9a3901d
from __future__ import with_statement import os import sys from mock import Mock from django.template import Template, Context, TemplateSyntaxError from django.test import TestCase from compressor.conf import settings from compressor.signals import post_compress from compressor.tests.base import css_tag, test_dir ...
[((492, 513), 'django.template.Context', 'Context', (['context_dict'], {}), '(context_dict)\n', (499, 513), False, 'from django.template import Template, Context, TemplateSyntaxError\n'), ((522, 547), 'django.template.Template', 'Template', (['template_string'], {}), '(template_string)\n', (530, 547), False, 'from djan...
Ruide/angr-dev
cle/cle/backends/relocations/generic.py
964dc80c758e25c698c2cbcc454ef5954c5fa0a0
from ...address_translator import AT from ...errors import CLEOperationError from . import Relocation import struct import logging l = logging.getLogger('cle.relocations.generic') class GenericAbsoluteReloc(Relocation): @property def value(self): return self.resolvedby.rebased_addr class GenericAbsol...
[((136, 180), 'logging.getLogger', 'logging.getLogger', (['"""cle.relocations.generic"""'], {}), "('cle.relocations.generic')\n", (153, 180), False, 'import logging\n')]
charlescayno/automation
codes/Lib/site-packages/openpyxl/writer/tests/test_style.py
a4a34d87f372d49fd69740ad3ca46ae19bf2612d
# Copyright (c) 2010-2014 openpyxl import pytest from openpyxl.styles.borders import Border, Side from openpyxl.styles.fills import GradientFill from openpyxl.styles.colors import Color from openpyxl.writer.styles import StyleWriter from openpyxl.tests.helper import get_xml, compare_xml class DummyWorkbook: st...
[((552, 573), 'openpyxl.tests.helper.get_xml', 'get_xml', (['writer._root'], {}), '(writer._root)\n', (559, 573), False, 'from openpyxl.tests.helper import get_xml, compare_xml\n'), ((910, 936), 'openpyxl.tests.helper.compare_xml', 'compare_xml', (['xml', 'expected'], {}), '(xml, expected)\n', (921, 936), False, 'from ...
rschwiebert/RingApp
ringapp/migrations/0009_auto_20150116_1759.py
35675b3dd81728d71b7dc70071be3185d7f99bf4
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('ringapp', '0008_auto_20150116_1755'), ] operations = [ migrations.AlterModelTable( name='invariance', ...
[((251, 316), 'django.db.migrations.AlterModelTable', 'migrations.AlterModelTable', ([], {'name': '"""invariance"""', 'table': '"""invariance"""'}), "(name='invariance', table='invariance')\n", (277, 316), False, 'from django.db import models, migrations\n'), ((361, 434), 'django.db.migrations.AlterModelTable', 'migrat...
MalloyPower/parsing-python
front-end/testsuite-python-lib/Python-3.1/Lib/json/tests/test_dump.py
b2bca5eed07ea2af7a2001cd4f63becdfb0570be
from unittest import TestCase from io import StringIO import json class TestDump(TestCase): def test_dump(self): sio = StringIO() json.dump({}, sio) self.assertEquals(sio.getvalue(), '{}') def test_dumps(self): self.assertEquals(json.dumps({}), '{}') def test_encode_truef...
[((133, 143), 'io.StringIO', 'StringIO', ([], {}), '()\n', (141, 143), False, 'from io import StringIO\n'), ((152, 170), 'json.dump', 'json.dump', (['{}', 'sio'], {}), '({}, sio)\n', (161, 170), False, 'import json\n'), ((272, 286), 'json.dumps', 'json.dumps', (['{}'], {}), '({})\n', (282, 286), False, 'import json\n')...
visit-dav/vis
src/resources/clients/python_client/visitstate.py
c08bc6e538ecd7d30ddc6399ec3022b9e062127e
import sys class RPCType(object): CloseRPC = 0 DetachRPC = 1 AddWindowRPC = 2 DeleteWindowRPC = 3 SetWindowLayoutRPC = 4 SetActiveWindowRPC = 5 ClearWindowRPC = 6 ClearAllWindowsRPC = 7 OpenDatabaseRPC = 8 CloseDatabaseRPC = 9 Acti...
[]
zhangyiming07/QT4C
tests/__init__.py
2d8d60efe0a4ad78a2618c5beeb0c456a63da067
# -*- coding: utf-8 -*- # # Tencent is pleased to support the open source community by making QT4C available. # Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. # QT4C is licensed under the BSD 3-Clause License, except for the third-party components listed below. # A copy of the BSD 3-Cla...
[((439, 464), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (454, 464), False, 'import os\n'), ((485, 510), 'os.path.dirname', 'os.path.dirname', (['test_dir'], {}), '(test_dir)\n', (500, 510), False, 'import os\n'), ((611, 632), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n'...