repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
GonzaloAlvarez/py-ga-sysadmin | lib/fmdplugins/list_records.py | fbbbbcad36df9f1b3e40328ff48c22bad13a56f4 | from lib.fmd.namedentity import NamedEntity
from lib.fmd.decorators import Action, ListStage, GetStage
from lib.exceptions.workflow import EntryException
@Action(ListStage.DATAGATHERING)
def list_records(context, output):
output = []
if hasattr(context, 'filter'):
context.log.debug('Using filter [%s]'... | [((156, 187), 'lib.fmd.decorators.Action', 'Action', (['ListStage.DATAGATHERING'], {}), '(ListStage.DATAGATHERING)\n', (162, 187), False, 'from lib.fmd.decorators import Action, ListStage, GetStage\n'), ((449, 480), 'lib.fmd.namedentity.NamedEntity', 'NamedEntity', (['"""records"""', 'entries'], {}), "('records', entri... |
zetahernandez/pysoa | pysoa/server/action/switched.py | 006e55ba877196a42c64f2ff453583d366082d55 | from __future__ import (
absolute_import,
unicode_literals,
)
import abc
import six
from pysoa.server.internal.types import is_switch
__all__ = (
'SwitchedAction',
)
def _len(item):
# Safe length that won't raise an error on values that don't support length
return getattr(item, '__len__', lam... | [((1797, 1840), 'six.add_metaclass', 'six.add_metaclass', (['_SwitchedActionMetaClass'], {}), '(_SwitchedActionMetaClass)\n', (1814, 1840), False, 'import six\n'), ((1406, 1421), 'pysoa.server.internal.types.is_switch', 'is_switch', (['i[0]'], {}), '(i[0])\n', (1415, 1421), False, 'from pysoa.server.internal.types impo... |
WebarchivCZ/Seeder | Seeder/settings/tests.py | 1958c5d3f6bdcbbdb2c81dcb6abc7f689125b6a8 | from .base import *
SECRET_KEY = 'test'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'sqlite3.db',
'USER': '',
'PASSWO... | [] |
odeke-em/resty | blobStore.py | 838934033e7eeca521e8c6d8cb2e99778beaa4b9 | #!/usr/bin/env python3
# Author: Emmanuel Odeke <odeke@ualberta.ca>
# This example steps you through using resty & restAssured to save pickled/serialized
# data as a blob and then later re-using it in after deserialization.
# Sample usage might be in collaborative computing ie publish results from an expensive
# compu... | [((445, 474), 'Serializer.BinarySerializer', 'Serializer.BinarySerializer', ([], {}), '()\n', (472, 474), False, 'import Serializer\n'), ((484, 511), 'Serializer.JSONSerializer', 'Serializer.JSONSerializer', ([], {}), '()\n', (509, 511), False, 'import Serializer\n'), ((934, 955), 'entrails.cloudPassage.CloudPassageHan... |
kavanAdeshara/Expense_Tracker | venv/Lib/site-packages/dataframe/_dataframe_column_set.py | b3e4810e858a7786e05cda6b91ba674b73b87981 | # dataframe: a data-frame implementation using method piping
#
# Copyright (C) 2016 Simon Dirmeier
#
# This file is part of dataframe.
#
# dataframe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either versi... | [((1566, 1599), 'itertools.chain', 'chain', (['vals[:3]', '"""..."""', 'vals[-3:]'], {}), "(vals[:3], '...', vals[-3:])\n", (1571, 1599), False, 'from itertools import chain\n')] |
Springworks/rules_docker | java/image.bzl | b943cd1fe3bf1c6c5fdac1889e952408599cffff | # Copyright 2017 Google Inc. 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 law or a... | [] |
khushi-411/cupy | cupyx/jit/_builtin_funcs.py | b5221a478c800c5e60eef65545467de9eb00c0d9 | import warnings
import cupy
from cupy_backends.cuda.api import runtime
from cupy.cuda import device
from cupyx.jit import _cuda_types
from cupyx.jit._internal_types import BuiltinFunc
from cupyx.jit._internal_types import Data
from cupyx.jit._internal_types import Constant
from cupyx.jit._internal_types import Range
... | [((3099, 3119), 'cupyx.jit._internal_types.Data.init', 'Data.init', (['stop', 'env'], {}), '(stop, env)\n', (3108, 3119), False, 'from cupyx.jit._internal_types import Data\n'), ((3136, 3157), 'cupyx.jit._internal_types.Data.init', 'Data.init', (['start', 'env'], {}), '(start, env)\n', (3145, 3157), False, 'from cupyx.... |
jinrunheng/base-of-python | python-basic-grammer/python-basic/02-python-variables-and-string/string_strip_demo.py | 595bdbc8bfaf2136d8f1f9ea82c03b84aeaf0a39 | # 字符串删除空白
str1 = " hello "
print(str1)
print(len(str1))
# 去除两端的空格
print(str1.strip())
print(len(str1.strip()))
# 去除左侧的空格
print(str1.lstrip())
print(len(str1.lstrip()))
# 去除右侧的空格
print(str1.rstrip())
print(len(str1.rstrip())) | [] |
hyperiongeo/bruges | bruges/util/__init__.py | 6d9a3aae86aaa53107caaa20e9aafa390358b0f8 | # -*- coding: utf-8 -*-
from .util import rms
from .util import moving_average
from .util import moving_avg_conv
from .util import moving_avg_fft
from .util import normalize
from .util import next_pow2
from .util import top_and_tail
from .util import extrapolate
from .util import nearest
from .util import deprecated
fr... | [] |
CrankySupertoon01/Toontown-2 | toontown/estate/DistributedHouseDoor.py | 60893d104528a8e7eb4aced5d0015f22e203466d | from toontown.toonbase.ToonBaseGlobal import *
from panda3d.core import *
from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import *
from direct.distributed import DistributedObject
from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlobal
from direct... | [((752, 802), 'toontown.building.DistributedDoor.DistributedDoor.__init__', 'DistributedDoor.DistributedDoor.__init__', (['self', 'cr'], {}), '(self, cr)\n', (792, 802), False, 'from toontown.building import DistributedDoor\n'), ((835, 880), 'toontown.building.DistributedDoor.DistributedDoor.disable', 'DistributedDoor.... |
AGhaderi/spatial_attenNCM | Neuro-Cognitive Models/Runs/Nonhier_run/res_nonhier.py | 1f7edf17f55d804d2ae3360d23623c9ab5035518 | #!/home/a.ghaderi/.conda/envs/envjm/bin/python
# Model 2
import pystan
import pandas as pd
import numpy as np
import sys
sys.path.append('../../')
import utils
parts = 1
data = utils.get_data() #loading dateset
data = data[data['participant']==parts]
mis = np.where((data['n200lat']<.101)|(data['n200lat']>.... | [((122, 147), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (137, 147), False, 'import sys\n'), ((180, 196), 'utils.get_data', 'utils.get_data', ([], {}), '()\n', (194, 196), False, 'import utils\n'), ((683, 724), 'pystan.StanModel', 'pystan.StanModel', ([], {'model_code': 'model_wiener'... |
refgenomics/rq-dashboard | rq_dashboard/dashboard.py | cdfadd2b9aa9a66b0594fd5573e3c45fa8643f05 | from redis import Redis
from redis import from_url
from rq import push_connection, pop_connection
from rq.job import Job
from functools import wraps
import times
from flask import Blueprint
from flask import current_app, url_for, abort
from flask import render_template
from rq import Queue, Worker
from rq import cancel... | [((406, 498), 'flask.Blueprint', 'Blueprint', (['"""rq_dashboard"""', '__name__'], {'template_folder': '"""templates"""', 'static_folder': '"""static"""'}), "('rq_dashboard', __name__, template_folder='templates',\n static_folder='static')\n", (415, 498), False, 'from flask import Blueprint\n'), ((939, 974), 'flask.... |
moas/mfdata | layers/layer1_python3/0300_acquisition/acquisition/__init__.py | ca9460c3783ddfd6ad022c96a0a8bf0e65fa36b2 | from acquisition.step import AcquisitionStep
from acquisition.stats import AcquisitionStatsDClient
from acquisition.move_step import AcquisitionMoveStep
from acquisition.delete_step import AcquisitionDeleteStep
from acquisition.batch_step import AcquisitionBatchStep
from acquisition.reinject_step import AcquisitionRein... | [] |
Semicheche/foa_frappe_docker | frappe-bench/apps/erpnext/erpnext/non_profit/doctype/member/member.py | a186b65d5e807dd4caf049e8aeb3620a799c1225 | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
from frappe.contacts.address_and_contact import load_address_and_contact
class Member(Docum... | [((395, 425), 'frappe.contacts.address_and_contact.load_address_and_contact', 'load_address_and_contact', (['self'], {}), '(self)\n', (419, 425), False, 'from frappe.contacts.address_and_contact import load_address_and_contact\n')] |
ayyuriss/TRHPO | networks/networks.py | 56a06d3593504647b75589ab87b5c96bdab74c9f | from torch import nn
import numpy as np
import base.basenetwork as BaseN
from networks.cholesky import CholeskyBlock
class FCNet(BaseN.BaseNetwork):
name ="FCNet"
def __init__(self,input_shape,output_shape,owner_name=""):
super(FCNet,self).__init__(input_shape,output_shape,owner_name)
... | [((2877, 2922), 'base.basenetwork.output_shape', 'BaseN.output_shape', (['self.conv[0]', 'input_shape'], {}), '(self.conv[0], input_shape)\n', (2895, 2922), True, 'import base.basenetwork as BaseN\n'), ((3776, 3821), 'base.basenetwork.output_shape', 'BaseN.output_shape', (['self.conv[0]', 'input_shape'], {}), '(self.co... |
sverrirab/icenews | icenews/api_important_words.py | 10a5e13d4dcd5e95f746c4fec9821b4b48fa440e | import logging
from pydantic import BaseModel, Field
from typing import List
from .similar import important_words
from .server import app
_MAX_LENGTH = 2000
logger = logging.getLogger(__name__)
class ImportantWordsResponse(BaseModel):
important_words: List[str] = Field(..., description="List of lemmas")
cla... | [((170, 197), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (187, 197), False, 'import logging\n'), ((274, 314), 'pydantic.Field', 'Field', (['...'], {'description': '"""List of lemmas"""'}), "(..., description='List of lemmas')\n", (279, 314), False, 'from pydantic import BaseModel, Fie... |
kmarcini/Learn-Python---Full-Course-for-Beginners-Tutorial- | try-except.py | 8ea4ef004d86fdf393980fd356edcf5b769bfeac |
try:
# num = 10 / 0
number = int(input("Enter a number: "))
print(number)
# catch specific errors
except ZeroDivisionError as err:
print(err)
except ValueError:
print("Invalid input")
| [] |
Gattocrucco/sipmfilter | peaksampl.py | 74215d6c53b998808fc6c677b46030234d996bdf | import numpy as np
def _adddims(a, b):
n = max(a.ndim, b.ndim)
a = np.expand_dims(a, tuple(range(n - a.ndim)))
b = np.expand_dims(b, tuple(range(n - b.ndim)))
return a, b
def _yz(y, z, t, yout):
"""
Shared implementation of peaksampl and sumpeaks.
"""
y = np.asarray(y)
z = np.asarr... | [((290, 303), 'numpy.asarray', 'np.asarray', (['y'], {}), '(y)\n', (300, 303), True, 'import numpy as np\n'), ((312, 325), 'numpy.asarray', 'np.asarray', (['z'], {}), '(z)\n', (322, 325), True, 'import numpy as np\n'), ((334, 347), 'numpy.asarray', 'np.asarray', (['t'], {}), '(t)\n', (344, 347), True, 'import numpy as ... |
shrine-maiden-heavy-industries/arachne | arachne/hdl/xilinx/ps8/resources/pmu.py | 1d0320bf6e77653656f8ce1874900743452dbac4 | # SPDX-License-Identifier: BSD-3-Clause
from amaranth import *
from amaranth.build import *
from .common import PS8Resource, MIOSet
__all__ = (
'PMUResource',
)
class PMUResource(PS8Resource):
name = 'pmu'
claimable_mio = [ ]
def __init__(self):
super().__init__(0, 0, None, False)
def used_mio(... | [] |
henrikhorluck/tdt4140-washlists | backend/Washlist/tests.py | a75c3bc38a3f915eb48cf3e9ecba848f46a2bcaa | from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from Dormroom.models import Dormroom
from SIFUser.mixins import AuthTestMixin
from StudentVillage.models import StudentVillage
from Washlist.jobs import reset_washlists
from Washlist.models.Templates import TemplateList... | [((545, 589), 'StudentVillage.models.StudentVillage.objects.create', 'StudentVillage.objects.create', ([], {'name': '"""Moholt"""'}), "(name='Moholt')\n", (574, 589), False, 'from StudentVillage.models import StudentVillage\n'), ((610, 660), 'Dormroom.models.Dormroom.objects.create', 'Dormroom.objects.create', ([], {'n... |
piyush01123/vision | torchvision/prototype/models/mobilenetv3.py | c6722307e6860057b4855483d237fe00a213dcf6 | from functools import partial
from typing import Any, Optional, List
from torchvision.prototype.transforms import ImageNetEval
from torchvision.transforms.functional import InterpolationMode
from ...models.mobilenetv3 import MobileNetV3, _mobilenet_v3_conf, InvertedResidualConfig
from ._api import WeightsEnum, Weight... | [((1531, 1567), 'functools.partial', 'partial', (['ImageNetEval'], {'crop_size': '(224)'}), '(ImageNetEval, crop_size=224)\n', (1538, 1567), False, 'from functools import partial\n'), ((1973, 2026), 'functools.partial', 'partial', (['ImageNetEval'], {'crop_size': '(224)', 'resize_size': '(232)'}), '(ImageNetEval, crop_... |
soul4code/django-rest-auth | rest_auth/registration/urls.py | b7a2e06e7736865b18f6aab79dcd42210e06c28b | from django.urls import re_path
from django.views.generic import TemplateView
from .views import RegisterView, VerifyEmailView
urlpatterns = [
re_path(r'^$', RegisterView.as_view(), name='rest_register'),
re_path(r'^verify-email/$', VerifyEmailView.as_view(), name='rest_verify_email'),
# This url is use... | [((971, 993), 'django.views.generic.TemplateView.as_view', 'TemplateView.as_view', ([], {}), '()\n', (991, 993), False, 'from django.views.generic import TemplateView\n')] |
mental689/paddict | crawler/tests.py | 493268b62531c698687d42416edf61c602250133 | from django.test import TestCase
# Create your tests here.
from crawler.download import *
from crawler.models import *
class AnimalDownloadTestCase(TestCase):
def setUp(self):
self.stopWords = ["CVPR 2019", "Computer Vision Foundation."]
self.url = "/Users/tuannguyenanh/Desktop/cvpr2019.html"#"htt... | [] |
petervdb/testrep1 | test_scripts/xml_example.py | 76b6eb3de2deb9596c055f252191e28587d5520c | #!/usr/bin/python3
from urllib.request import urlopen
from xml.etree.ElementTree import parse
# Download the RSS feed and parse it
u = urlopen('http://planet.python.org/rss20.xml')
doc = parse(u)
# Extract and output tags of interest
for item in doc.iterfind('channel/item'):
title = item.findtext('title')
date = i... | [((137, 182), 'urllib.request.urlopen', 'urlopen', (['"""http://planet.python.org/rss20.xml"""'], {}), "('http://planet.python.org/rss20.xml')\n", (144, 182), False, 'from urllib.request import urlopen\n'), ((189, 197), 'xml.etree.ElementTree.parse', 'parse', (['u'], {}), '(u)\n', (194, 197), False, 'from xml.etree.Ele... |
anthowen/duplify | contacts/urls.py | 846d01c1b21230937fdf0281b0cf8c0b08a8c24e | """dedupper_app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-... | [((727, 747), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (745, 747), False, 'from django.contrib import admin\n'), ((769, 812), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""contact_index"""'}), "('', views.index, name='contact_index')\n", (773, 812), False, 'fro... |
klauer/pydm | pydm/PyQt/uic.py | e26aad58a7a0eb6f7321c61aa1dace646ff652bd | from . import qtlib
QT_LIB = qtlib.QT_LIB
if QT_LIB == 'PyQt5':
from PyQt5.uic import *
| [] |
pranaynanda/training-data-analyst | CPB100/lab2b/scheduled/ingestapp.py | f10ab778589129239fd5b277cfdefb41638eded5 | #!/usr/bin/env python
# Copyright 2016 Google 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 or ... | [((727, 748), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (738, 748), False, 'import flask\n'), ((860, 936), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s: %(message)s"""', 'level': 'logging.INFO'}), "(format='%(levelname)s: %(message)s', level=logging.INFO)\n", (... |
StarSky1/microsoft-python-study | index.py | 7fdc1ad87ac0eeb497013d7792f499416aac32d9 | name=input('input your name:');
print('hello');
print(name.capitalize()); | [] |
Machel54/-pass-locker- | credentials.py | 8ddf14cf755924ca903919177f9f878f65a08042 | import pyperclip
import random
import string
class Credential:
'''
class that generates new credentials
'''
credential_list = []
def __init__(self,username,sitename,password):
self.username = username
self.password = password
self.sitename = sitename
def save_credential(self):
'''
sav... | [((2094, 2134), 'pyperclip.copy', 'pyperclip.copy', (['find_credential.password'], {}), '(find_credential.password)\n', (2108, 2134), False, 'import pyperclip\n'), ((1419, 1439), 'random.choice', 'random.choice', (['chars'], {}), '(chars)\n', (1432, 1439), False, 'import random\n')] |
mehulsatardekar/dice-on-demand | tests/test_dice.py | fa1ce1214975ba70c5d61390408a4de2418cf997 | import unittest
import app
def test_test():
assert app.test() == "Works!"
| [((57, 67), 'app.test', 'app.test', ([], {}), '()\n', (65, 67), False, 'import app\n')] |
ChristopherWilks/snaptron | annotations/rip_annotated_junctions.py | 82ea3c5c5f2fbb726bba6d8c2bd0f7713291833a | #!/usr/bin/env python
"""
rip_annotated_junctions.py
Non-reference/species verson of this script, no lift-over
Rips junctions from annotation files contained in
jan_24_2016_annotations.tar.gz, as described in annotation_definition.md.
Junctions are dumped to stdout, which we record as annotated_junctions.tsv.gz
in ru... | [] |
Genlovy-Hoo/dramkit | dramkit/_tmp/VMD.py | fa3d2f35ebe9effea88a19e49d876b43d3c5c4c7 | # -*- coding: utf-8 -*-
import numpy as np
def vmd( signal, alpha, tau, K, DC, init, tol):
'''
用VMD分解算法时只要把信号输入进行分解就行了,只是对信号进行分解,和采样频率没有关系,
VMD的输入参数也没有采样频率。
VMD分解出的各分量在输出量 u 中,这个和信号的长度、信号的采样频率没有关系。
迭代时各分量的中心频率在输出量omega,可以用2*pi/fs*omega求出中心频率,
但迭代时的频率是变化的。
Input and Parameters:
signal ... | [((1687, 1727), 'numpy.array', 'np.array', (['[(i - 0.5 - 1 / T) for i in t]'], {}), '([(i - 0.5 - 1 / T) for i in t])\n', (1695, 1727), True, 'import numpy as np\n'), ((1968, 1981), 'numpy.fft.fft', 'np.fft.fft', (['f'], {}), '(f)\n', (1978, 1981), True, 'import numpy as np\n'), ((2018, 2046), 'numpy.fft.fftshift', 'n... |
AoWangPhilly/PyDS | src/PyDS/Queue/Deque.py | d79f92d0d2e7c005ebb8fa9f631d5f01e590625e | class Deque:
def add_first(self, value):
...
def add_last(self, value):
...
def delete_first(self):
...
def delete_last(self):
...
def first(self):
...
def last(self):
...
def is_empty(self):
...
def __len__(self):
..... | [] |
asmaasalih/my_project | forum/main.py | 89183d7a2578fa302e94ea29570ab527e9ca47b5 | import models
import stores
member1 =models.Member("ahmed",33)
member2 =models.Member("mohamed",30)
post1=models.Post("Post1", "Content1")
post2= models.Post("Post2", "Content2")
post3= models.Post("Post3", "Content3")
#member store
member_store=stores.MemberStore()
member_store.add(member1)
member_store.add(member... | [((39, 65), 'models.Member', 'models.Member', (['"""ahmed"""', '(33)'], {}), "('ahmed', 33)\n", (52, 65), False, 'import models\n'), ((74, 102), 'models.Member', 'models.Member', (['"""mohamed"""', '(30)'], {}), "('mohamed', 30)\n", (87, 102), False, 'import models\n'), ((109, 141), 'models.Post', 'models.Post', (['"""... |
bhavyanshu/Shell-Finder | shellfind.py | 308b3ba7f1a53b8a6cc738d69c01f4b7108d0860 | #!/usr/bin/env python
'''
Author : Bhavyanshu Parasher
Email : bhavyanshu@codershangout.org
Description : shellfind.py is a Python command line utility which lets you look for shells on a site that the hacker must have uploaded. It considers all the shells available and tries all possibilities via dictionary match.
'''... | [] |
nosisky/algo-solution | question3.py | a9276f73ba63b1a0965c194885aea6cadfab0e0b | # A string S consisting of N characters is considered to be properly nested if any of the following conditions is true:
# S is empty;
# S has the form "(U)" or "[U]" or "{U}" where U is a properly nested string; S has the form "VW" where V and W are properly nested strings.
# For example, the string "{[()()]}" is prope... | [] |
chrMenzel/A-beautiful-code-in-Python | Teil_27_Game_of_Life_3d.py | 92ee43c1fb03c299384d4de8bebb590c5ba1b623 | import bpy
import random as rnd
from collections import Counter
import itertools as iter
feld_von, feld_bis = -4, 4
spielfeld_von, spielfeld_bis = feld_von-6, feld_bis+6
anz = int((feld_bis-feld_von)**3*.3)
spielfeld = {(rnd.randint(feld_von, feld_bis), rnd.randint(
feld_von, feld_bis), rnd.randint(feld_von, fe... | [((950, 1013), 'bpy.ops.mesh.primitive_cube_add', 'bpy.ops.mesh.primitive_cube_add', ([], {'size': '(0.001)', 'location': '(0, 0, 0)'}), '(size=0.001, location=(0, 0, 0))\n', (981, 1013), False, 'import bpy\n'), ((1182, 1208), 'bpy.data.objects.new', 'bpy.data.objects.new', (['n', 'm'], {}), '(n, m)\n', (1202, 1208), F... |
openclimatefix/power_perceiver | power_perceiver/xr_batch_processor/reduce_num_pv_systems.py | bafcdfaf6abf42fbab09da641479f74709ddd395 | from dataclasses import dataclass
import numpy as np
import xarray as xr
from power_perceiver.load_prepared_batches.data_sources import PV
from power_perceiver.load_prepared_batches.data_sources.prepared_data_source import XarrayBatch
@dataclass
class ReduceNumPVSystems:
"""Reduce the number of PV systems per e... | [((713, 736), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (734, 736), True, 'import numpy as np\n'), ((942, 1019), 'numpy.zeros', 'np.zeros', ([], {'shape': '(num_examples, self.requested_num_pv_systems)', 'dtype': 'np.int32'}), '(shape=(num_examples, self.requested_num_pv_systems), dtype=np.... |
wang153723482/HelloWorld_my | HelloWorld_python/log/demo_log_3.py | b8642ad9742f95cfebafc61f25b00e917485e50c | #encoding=utf8
# 按天生成文件
import logging
import time
from logging.handlers import TimedRotatingFileHandler
#----------------------------------------------------------------------
if __name__ == "__main__":
logFilePath = "timed_test.log"
logger = logging.getLogger("YouLoggerName")
logger.setLevel(logging.... | [((257, 291), 'logging.getLogger', 'logging.getLogger', (['"""YouLoggerName"""'], {}), "('YouLoggerName')\n", (274, 291), False, 'import logging\n'), ((341, 415), 'logging.handlers.TimedRotatingFileHandler', 'TimedRotatingFileHandler', (['logFilePath'], {'when': '"""d"""', 'interval': '(1)', 'backupCount': '(7)'}), "(l... |
Atsocs/bot-da-os | bot_da_os/statemachine/person/person_action.py | e6d54057f4a3b703f303e9944a39e291ac87c40f | from operator import eq
class PersonAction:
def __init__(self, action):
self.action = action
def __str__(self): return self.action
def __eq__(self, other):
return eq(self.action, other.action)
# Necessary when __cmp__ or __eq__ is defined
# in order to make this class usable as ... | [((195, 224), 'operator.eq', 'eq', (['self.action', 'other.action'], {}), '(self.action, other.action)\n', (197, 224), False, 'from operator import eq\n')] |
bisw1jit/MyServer | MyServer.py | cbd7bc4015482ce8f24314894148f7e20ef66b21 | # Tool Name :- MyServer
# Author :- LordReaper
# Date :- 13/11/2018 - 9/11/2019
# Powered By :- H1ckPro Software's
import sys
import os
from time import sleep
from core.system import *
if len(sys.argv)>1:
pass
else:
print ("error : invalid arguments !!")
print ("use : myserver --help for more information")
s... | [((319, 329), 'sys.exit', 'sys.exit', ([], {}), '()\n', (327, 329), False, 'import sys\n'), ((408, 458), 'os.system', 'os.system', (["('sudo python3 core/s.py ' + sys.argv[1])"], {}), "('sudo python3 core/s.py ' + sys.argv[1])\n", (417, 458), False, 'import os\n'), ((473, 518), 'os.system', 'os.system', (["('python3 co... |
ffreemt/tmx2epub | tests/test_gen_epub.py | 55a59cb2a9b7f42031a65f64c29e5c43fdb487ea | """ test gen_epub. """
from tmx2epub.gen_epub import gen_epub
def test_gen_epub2():
""" test_gen_epub2. """
from pathlib import Path
infile = r"tests\2.tmx"
stem = Path(infile).absolute().stem
outfile = f"{Path(infile).absolute().parent / stem}.epub"
assert gen_epub(infile, debug=True) == out... | [((285, 313), 'tmx2epub.gen_epub.gen_epub', 'gen_epub', (['infile'], {'debug': '(True)'}), '(infile, debug=True)\n', (293, 313), False, 'from tmx2epub.gen_epub import gen_epub\n'), ((183, 195), 'pathlib.Path', 'Path', (['infile'], {}), '(infile)\n', (187, 195), False, 'from pathlib import Path\n'), ((229, 241), 'pathli... |
amulyavarote/quickstarts | pub_sub/python/http/checkout/app.py | c21a8f58d515b28eaa8a3680388fa06995c2331b | import json
import time
import random
import logging
import requests
import os
logging.basicConfig(level=logging.INFO)
base_url = os.getenv('BASE_URL', 'http://localhost') + ':' + os.getenv(
'DAPR_HTTP_PORT', '3500')
PUBSUB_NAME = 'order_pub_sub'
TOPIC = 'orders'
logging.info('Publishing to baseUR... | [((80, 119), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (99, 119), False, 'import logging\n'), ((286, 393), 'logging.info', 'logging.info', (["('Publishing to baseURL: %s, Pubsub Name: %s, Topic: %s' % (base_url,\n PUBSUB_NAME, TOPIC))"], {}), "('Publishi... |
smailedge/pro | jj.py | f86347d4368bc97aa860b37caa9ba10e84a93738 | # -*- coding: utf-8 -*-
from linepy import *
from datetime import datetime
from time import sleep
from humanfriendly import format_timespan, format_size, format_number, format_length
import time, random, sys, json, codecs, threading, glob, re, string, os, requests, subprocess, six, ast, pytz, urllib, urllib.parse
#===... | [((408, 419), 'time.time', 'time.time', ([], {}), '()\n', (417, 419), False, 'import time, random, sys, json, codecs, threading, glob, re, string, os, requests, subprocess, six, ast, pytz, urllib, urllib.parse\n'), ((813, 851), 'codecs.open', 'codecs.open', (['"""read.json"""', '"""r"""', '"""utf-8"""'], {}), "('read.j... |
datadealer/dd_app | dd_app/messaging/backend.py | 3806b9b9df165a49f0fca8a249170b4ccd4d0177 | class RedisBackend(object):
def __init__(self, settings={}, *args, **kwargs):
self.settings = settings
@property
def connection(self):
# cached redis connection
if not hasattr(self, '_connection'):
self._connection = self.settings.get('redis.connector').get()
re... | [] |
bitfag/bt-macd-binance | fetch_data.py | eeffe52f8e561ff521629839078ff886e7bf700e | #!/usr/bin/env python
from btmacd.binance_fetcher import BinanceFetcher
def main():
fetcher = BinanceFetcher("BTCUSDT", filename="binance_ohlc.csv", start_date="01.01.2018")
fetcher.fetch()
if __name__ == "__main__":
main()
| [((101, 180), 'btmacd.binance_fetcher.BinanceFetcher', 'BinanceFetcher', (['"""BTCUSDT"""'], {'filename': '"""binance_ohlc.csv"""', 'start_date': '"""01.01.2018"""'}), "('BTCUSDT', filename='binance_ohlc.csv', start_date='01.01.2018')\n", (115, 180), False, 'from btmacd.binance_fetcher import BinanceFetcher\n')] |
Frightera/probability | tensorflow_probability/python/mcmc/diagnostic.py | deac4562cbc1056e6abebc7450218d38444fe65d | # Copyright 2018 The TensorFlow Probability 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 o... | [((8327, 8383), 'tensorflow_probability.python.internal.nest_util.broadcast_structure', 'nest_util.broadcast_structure', (['states', 'filter_beyond_lag'], {}), '(states, filter_beyond_lag)\n', (8356, 8383), False, 'from tensorflow_probability.python.internal import nest_util\n'), ((8405, 8460), 'tensorflow_probability.... |
jiangyuang/ModelPruningLibrary | mpl/models/leaf.py | 9c8ba5a3c5d118f37768d5d42254711f48d88745 | from torch import nn as nn
from .base_model import BaseModel
from ..nn.conv2d import DenseConv2d
from ..nn.linear import DenseLinear
__all__ = ["Conv2", "conv2", "Conv4", "conv4"]
class Conv2(BaseModel):
def __init__(self):
super(Conv2, self).__init__()
self.features = nn.Sequential(DenseConv2d(... | [((404, 425), 'torch.nn.ReLU', 'nn.ReLU', ([], {'inplace': '(True)'}), '(inplace=True)\n', (411, 425), True, 'from torch import nn as nn\n'), ((465, 490), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['(2)'], {'stride': '(2)'}), '(2, stride=2)\n', (477, 490), True, 'from torch import nn as nn\n'), ((639, 660), 'torch.nn.ReLU... |
quimaguirre/NetworkAnalysis | scripts/generate_network_interactomix.py | c7a4da3ba5696800738b4767065ce29fa0020d79 | import argparse
import ConfigParser
import sys, os, re
import biana
try: from biana import *
except: sys.exit(10)
import methods_dictionaries as methods_dicts
def main():
options = parse_user_arguments()
generate_network(options)
def parse_user_arguments(*args, **kwds):
parser = arg... | [] |
kids-first/kf-api-study-creator | tests/data/s3_scrape_config.py | 93a79b108b6474f9b4135ace06c89ddcf63dd257 | """
This is an extract config intended for S3 object manifests produced by TBD.
To use it, you must import it in another extract config and override at least
the `source_data_url`. You may also append additional operations to the
`operations` list as well.
For example you could have the following in your extract conf... | [((3891, 3949), 'kf_lib_data_ingest.etl.extract.operations.keep_map', 'keep_map', ([], {'in_col': '"""Size"""', 'out_col': 'CONCEPT.GENOMIC_FILE.SIZE'}), "(in_col='Size', out_col=CONCEPT.GENOMIC_FILE.SIZE)\n", (3899, 3949), False, 'from kf_lib_data_ingest.etl.extract.operations import keep_map, row_map, value_map, cons... |
jjhenkel/dockerizeme | hard-gists/5c973ec1b5ab2e387646/snippet.py | eaa4fe5366f6b9adf74399eab01c712cacaeb279 | import bpy
from bpy.app.handlers import persistent
bl_info = {
"name": "Playback Once",
"author": "Adhi Hargo",
"version": (1, 0, 0),
"blender": (2, 67, 3),
"location": "",
"description": "Playback once.",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Animation"... | [((475, 534), 'bpy.app.handlers.frame_change_pre.append', 'bpy.app.handlers.frame_change_pre.append', (['stopPlaybackAtEnd'], {}), '(stopPlaybackAtEnd)\n', (515, 534), False, 'import bpy\n'), ((558, 617), 'bpy.app.handlers.frame_change_pre.remove', 'bpy.app.handlers.frame_change_pre.remove', (['stopPlaybackAtEnd'], {})... |
AlbertUnruh/Py3Challenges | Py3Challenges/saves/challenges/c6_min.py | 52f03f157860f6464f0c1710bf051a8099c29ea2 | """
To master this you should consider using the builtin-``min``-function.
"""
from ...challenge import Challenge
from random import randint
x = []
for _ in range(randint(2, 10)):
x.append(randint(1, 100))
intro = f"You have to print the lowest value of {', '.join(str(_) for _ in x[:-1])} and {x[-1]}. (values: x... | [((165, 179), 'random.randint', 'randint', (['(2)', '(10)'], {}), '(2, 10)\n', (172, 179), False, 'from random import randint\n'), ((195, 210), 'random.randint', 'randint', (['(1)', '(100)'], {}), '(1, 100)\n', (202, 210), False, 'from random import randint\n')] |
mrnicegyu11/osparc-simcore | services/web/server/tests/unit/with_dbs/01/test_director_v2.py | b6fa6c245dbfbc18cc74a387111a52de9b05d1f4 | # pylint:disable=unused-variable
# pylint:disable=unused-argument
# pylint:disable=redefined-outer-name
from typing import AsyncIterator
import pytest
from aioresponses import aioresponses
from faker import Faker
from hypothesis import HealthCheck, given, settings
from hypothesis import strategies as st
from models_... | [((728, 744), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (742, 744), False, 'import pytest\n'), ((2065, 2134), 'hypothesis.settings', 'settings', ([], {'suppress_health_check': '[HealthCheck.function_scoped_fixture]'}), '(suppress_health_check=[HealthCheck.function_scoped_fixture])\n', (2073, 2134), False, '... |
sriramreddyM/pLitter | tools/py/heatmap.py | e506777af0b8bbae411b474f5eacee91e8efea59 | '''
converts video to frames and saves images by different interval, or overlap, etc
'''
import folium
from folium import plugins
from folium.plugins import HeatMap
import csv
# class plitterMap():
# def __int__(self, file_path):
# self.data = file_path
# df = []
# with open(self.data) as f... | [] |
Geoalert/emergency-mapping | generator.py | 96668e4e5aa2b520e5727536f7a8f4c262ee3da6 | import numpy as np
def random_augmentation(img, mask):
#you can add any augmentations you need
return img, mask
def batch_generator(image, mask,
batch_size=1,
crop_size=0,
patch_size=256,
bbox= None,
augment... | [((1181, 1194), 'numpy.max', 'np.max', (['image'], {}), '(image)\n', (1187, 1194), True, 'import numpy as np\n'), ((950, 963), 'numpy.ndim', 'np.ndim', (['mask'], {}), '(mask)\n', (957, 963), True, 'import numpy as np\n'), ((972, 986), 'numpy.ndim', 'np.ndim', (['image'], {}), '(image)\n', (979, 986), True, 'import num... |
Avinesh/awx | awx/api/metadata.py | 6310a2edd890d6062a9f6bcdeb2b46c4b876c2bf | # Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
from collections import OrderedDict
# Django
from django.core.exceptions import PermissionDenied
from django.db.models.fields import PositiveIntegerField, BooleanField
from django.db.models.fields.related import ForeignKey
from django.http import Http404
from ... | [((1028, 1041), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1039, 1041), False, 'from collections import OrderedDict\n'), ((8352, 8382), 'rest_framework.request.clone_request', 'clone_request', (['request', 'method'], {}), '(request, method)\n', (8365, 8382), False, 'from rest_framework.request import ... |
BBVA/deeptracy | plugins/python/tasks.py | 40f4b6bba2bdd345e95e42d474c05fa90f15c3e9 | import json
from washer.worker.actions import AppendStdout, AppendStderr
from washer.worker.actions import CreateNamedLog, AppendToLog
from washer.worker.actions import SetProperty
from washer.worker.commands import washertask
def pipenv_graph2deps(rawgraph):
graph = json.loads(rawgraph)
def build_entry(dat... | [((275, 295), 'json.loads', 'json.loads', (['rawgraph'], {}), '(rawgraph)\n', (285, 295), False, 'import json\n'), ((1174, 1190), 'invoke.Context', 'invoke.Context', ([], {}), '()\n', (1188, 1190), False, 'import invoke\n'), ((1643, 1659), 'invoke.Context', 'invoke.Context', ([], {}), '()\n', (1657, 1659), False, 'impo... |
pkokkinos/senity | senity/utils/getSiteProfile.py | c6e41678620bef558cc3600929a8320ff2a285cf | import json
import os
# get site profile
def getSiteProfile(site_file):
with open(site_file) as json_file:
json_data = json.load(json_file)
return json_data
# get all site profile
def getAllSiteProfiles(site_folder):
allSiteProfiles = {}
allSiteFiles = os.listdir(site_folder)
for ... | [((283, 306), 'os.listdir', 'os.listdir', (['site_folder'], {}), '(site_folder)\n', (293, 306), False, 'import os\n'), ((133, 153), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (142, 153), False, 'import json\n')] |
QingXinHu123/Lane_change_RL | ppo_new/baseline.py | 06c70e6f58d3478669b56800028e320ca03f5222 | import os, sys
from env.LaneChangeEnv import LaneChangeEnv
import random
import numpy as np
if 'SUMO_HOME' in os.environ:
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
sys.path.append(tools)
print('success')
else:
sys.exit("please declare environment variable 'SUMO_HOME'")
import traci
def ep... | [((134, 180), 'os.path.join', 'os.path.join', (["os.environ['SUMO_HOME']", '"""tools"""'], {}), "(os.environ['SUMO_HOME'], 'tools')\n", (146, 180), False, 'import os, sys\n'), ((185, 207), 'sys.path.append', 'sys.path.append', (['tools'], {}), '(tools)\n', (200, 207), False, 'import os, sys\n'), ((239, 298), 'sys.exit'... |
toogy/pendigits-hmm | clean_data.py | 03382e1457941714439d40b67e53eaf117fe4d08 | import numpy as np
import pickle
from collections import defaultdict
from parsing import parser
from analysis import training
def main():
parse = parser.Parser();
train_digits = parse.parse_file('data/pendigits-train');
test_digits = parse.parse_file('data/pendigits-test')
centroids = training.get_d... | [((152, 167), 'parsing.parser.Parser', 'parser.Parser', ([], {}), '()\n', (165, 167), False, 'from parsing import parser\n'), ((306, 364), 'analysis.training.get_digit_kmeans_centroids', 'training.get_digit_kmeans_centroids', (['train_digits', '(256 - 3)'], {}), '(train_digits, 256 - 3)\n', (341, 364), False, 'from ana... |
cypherdotXd/o3de | scripts/commit_validation/commit_validation/commit_validation.py | bb90c4ddfe2d495e9c00ebf1e2650c6d603a5676 | #
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
import abc
import importlib
import os
import pkgutil
import re
import time
from typing import Dict, List, ... | [((1834, 1845), 'time.time', 'time.time', ([], {}), '()\n', (1843, 1845), False, 'import time\n'), ((2057, 2095), 'pkgutil.iter_modules', 'pkgutil.iter_modules', (['[validators_dir]'], {}), '([validators_dir])\n', (2077, 2095), False, 'import pkgutil\n'), ((3045, 3056), 'time.time', 'time.time', ([], {}), '()\n', (3054... |
KSaiRahul21/matrixprofile | matrixprofile/algorithms/snippets.py | d8250e30d90ed0453bb7c35bb34ab0c04ae7b334 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'xrange', range)
# end of py2 compatability boilerplate
import numpy as np
from matrixprofil... | [((2228, 2247), 'numpy.array', 'np.array', (['distances'], {}), '(distances)\n', (2236, 2247), True, 'import numpy as np\n'), ((1921, 1940), 'numpy.zeros', 'np.zeros', (['num_zeros'], {}), '(num_zeros)\n', (1929, 1940), True, 'import numpy as np\n'), ((2584, 2624), 'numpy.minimum', 'np.minimum', (['distances[(index), :... |
yk/jina | jina/logging/formatter.py | ab66e233e74b956390f266881ff5dc4e0110d3ff | import json
import re
from copy import copy
from logging import Formatter
from .profile import used_memory
from ..helper import colored
class ColorFormatter(Formatter):
"""Format the log into colored logs based on the log-level. """
MAPPING = {
'DEBUG': dict(color='white', on_color=None), # white
... | [((749, 761), 'copy.copy', 'copy', (['record'], {}), '(record)\n', (753, 761), False, 'from copy import copy\n'), ((1128, 1140), 'copy.copy', 'copy', (['record'], {}), '(record)\n', (1132, 1140), False, 'from copy import copy\n'), ((1701, 1713), 'copy.copy', 'copy', (['record'], {}), '(record)\n', (1705, 1713), False, ... |
sugitanishi/competitive-programming | atcoder/abc191/b.py | 51af65fdce514ece12f8afbf142b809d63eefb5d | import sys
sys.setrecursionlimit(10000000)
input=lambda : sys.stdin.readline().rstrip()
n,x=map(int,input().split())
a=list(map(int,input().split()))
aa=list(filter(lambda b:b!=x,a))
print(*aa) | [((11, 42), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10000000)'], {}), '(10000000)\n', (32, 42), False, 'import sys\n'), ((58, 78), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (76, 78), False, 'import sys\n')] |
cfogg/python-client | tests/integration/test_streaming_e2e.py | 40e6891c8240e6b2acd5df538e622e9f15de43d6 | """Streaming integration tests."""
# pylint:disable=no-self-use,invalid-name,too-many-arguments,too-few-public-methods,line-too-long
# pylint:disable=too-many-statements,too-many-locals,too-many-lines
import threading
import time
import json
from queue import Queue
from splitio.client.factory import get_factory
from te... | [((1977, 1984), 'queue.Queue', 'Queue', ([], {}), '()\n', (1982, 1984), False, 'from queue import Queue\n'), ((2009, 2106), 'tests.helpers.mockserver.SplitMockServer', 'SplitMockServer', (['split_changes', 'segment_changes', 'split_backend_requests', 'auth_server_response'], {}), '(split_changes, segment_changes, split... |
weezel/BandEventNotifier | venues/abstract_venue.py | 55824ba26aba9882f46d1770ec5df592a5dc32bc | import re
from abc import ABC, abstractmethod
from typing import Any, Dict, Generator
class IncorrectVenueImplementation(Exception):
pass
# class AbstractVenue(metaclass=ABC):
class AbstractVenue(ABC):
def __init__(self):
self.url = ""
self.name = ""
self.city = ""
self.count... | [((362, 386), 're.compile', 're.compile', (['"""[0-9.,]+.€"""'], {}), "('[0-9.,]+.€')\n", (372, 386), False, 'import re\n'), ((417, 439), 're.compile', 're.compile', (['"""[0-9.,]+"""'], {}), "('[0-9.,]+')\n", (427, 439), False, 'import re\n')] |
vandurme/TFMTL | mtl/util/pipeline.py | 5958187900bdf67089a237c523b6caa899f63ac1 | # Copyright 2018 Johns Hopkins University. 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... | [((3882, 3920), 'collections.namedtuple', 'namedtuple', (['"""bucket_info"""', '"""func pads"""'], {}), "('bucket_info', 'func pads')\n", (3892, 3920), False, 'from collections import namedtuple\n'), ((1446, 1484), 'tensorflow.data.TFRecordDataset', 'tf.data.TFRecordDataset', (['tfrecord_file'], {}), '(tfrecord_file)\n... |
dabeaz/py65 | src/py65/devices/mpu65c02.py | 62d790445018f0616508022912b67d8d64935a29 | from py65.devices import mpu6502
from py65.utils.devices import make_instruction_decorator
class MPU(mpu6502.MPU):
def __init__(self, *args, **kwargs):
mpu6502.MPU.__init__(self, *args, **kwargs)
self.name = '65C02'
self.waiting = False
def step(self):
if self.waiting:
... | [((646, 719), 'py65.utils.devices.make_instruction_decorator', 'make_instruction_decorator', (['instruct', 'disassemble', 'cycletime', 'extracycles'], {}), '(instruct, disassemble, cycletime, extracycles)\n', (672, 719), False, 'from py65.utils.devices import make_instruction_decorator\n'), ((166, 209), 'py65.devices.m... |
soerendip/ms-mint | tests/test__io.py | bf5f5d87d07a0d2108c6cd0d92c278f2ea762e58 | import pandas as pd
import shutil
import os
import io
from ms_mint.Mint import Mint
from pathlib import Path as P
from ms_mint.io import (
ms_file_to_df,
mzml_to_pandas_df_pyteomics,
convert_ms_file_to_feather,
convert_ms_file_to_parquet,
MZMLB_AVAILABLE,
)
from paths import (
TEST_MZML,
... | [((459, 483), 'ms_mint.io.ms_file_to_df', 'ms_file_to_df', (['TEST_MZML'], {}), '(TEST_MZML)\n', (472, 483), False, 'from ms_mint.io import ms_file_to_df, mzml_to_pandas_df_pyteomics, convert_ms_file_to_feather, convert_ms_file_to_parquet, MZMLB_AVAILABLE\n'), ((847, 892), 'ms_mint.io.ms_file_to_df', 'ms_file_to_df', (... |
moiyad/image | core/views.py | d4515ef3057794f38268a6887bfff157115f26f7 | from django.core.files.storage import FileSystemStorage
from django.shortcuts import render, redirect
from core.forms import DocumentForm
from core.models import Document
from media import image_cv2
def home(request):
documents = Document.objects.all()
number = len(image_cv2.myList)
return render(request... | [((237, 259), 'core.models.Document.objects.all', 'Document.objects.all', ([], {}), '()\n', (257, 259), False, 'from core.models import Document\n'), ((306, 383), 'django.shortcuts.render', 'render', (['request', '"""core/home.html"""', "{'documents': documents, 'number': number}"], {}), "(request, 'core/home.html', {'... |
obastani/verifair | python/verifair/benchmarks/fairsquare/M_BN_F_SVM_A_Q.py | 1d5efea041330fa9fe8d59d976bdd3ef97aff417 | from .helper import *
def sample(flag):
sex = step([(0,1,0.3307), (1,2,0.6693)])
if sex < 1:
capital_gain = gaussian(568.4105, 24248365.5428)
if capital_gain < 7298.0000:
age = gaussian(38.4208, 184.9151)
capital_loss = gaussian(86.5949, 157731.9553)
else:
... | [] |
muammar/mlchem | ml4chem/atomistic/models/neuralnetwork.py | 365487c23ea3386657e178e56ab31adfe8d5d073 | import dask
import datetime
import logging
import time
import torch
import numpy as np
import pandas as pd
from collections import OrderedDict
from ml4chem.metrics import compute_rmse
from ml4chem.atomistic.models.base import DeepLearningModel, DeepLearningTrainer
from ml4chem.atomistic.models.loss import AtomicMSELos... | [((557, 593), 'torch.set_printoptions', 'torch.set_printoptions', ([], {'precision': '(10)'}), '(precision=10)\n', (579, 593), False, 'import torch\n'), ((603, 622), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (620, 622), False, 'import logging\n'), ((5473, 5511), 'torch.nn.ModuleDict', 'torch.nn.Module... |
EntySec/HatSploit | hatsploit/core/db/db.py | 8e445804c252cc24e87888be2c2efc02750ce5ee | #!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020-2022 EntySec
#
# 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... | [((1316, 1324), 'hatsploit.core.cli.badges.Badges', 'Badges', ([], {}), '()\n', (1322, 1324), False, 'from hatsploit.core.cli.badges import Badges\n'), ((1338, 1346), 'hatsploit.lib.config.Config', 'Config', ([], {}), '()\n', (1344, 1346), False, 'from hatsploit.lib.config import Config\n'), ((1367, 1381), 'hatsploit.l... |
NSLS-II/bluesky | bluesky/tests/test_simulators.py | b7d666e65cf4ef556fb46b744c33264c8e3f7507 | from bluesky.plans import scan
from bluesky.simulators import (print_summary, print_summary_wrapper,
summarize_plan,
check_limits,
plot_raster_path)
import pytest
from bluesky.plans import grid_scan
def test_print_summary(... | [((2359, 2419), 'bluesky.plans.grid_scan', 'grid_scan', (['[det]', 'motor1', '(-5)', '(5)', '(10)', 'motor2', '(-7)', '(7)', '(15)', '(True)'], {}), '([det], motor1, -5, 5, 10, motor2, -7, 7, 15, True)\n', (2368, 2419), False, 'from bluesky.plans import grid_scan\n'), ((2424, 2482), 'bluesky.plan_tools.plot_raster_path... |
robi1467/shut-the-box | shutTheBox/main.py | ed1a8f13bc74caa63361453e723768a9cbe1dac4 | import random
numbers_list = [1,2,3,4,5,6,7,8,9,10]
game_won = False
game_completed = False
#Stats
games_played = 0
games_won = 0
games_lost = 0
average_score = 0
total_score = 0
def welcome():
welcome_message = "Welcome to shut the box"
print(welcome_message)
i = 0
result = ""
while i < len(number... | [((589, 609), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (603, 609), False, 'import random\n')] |
sm00th/leapp-repository | repos/system_upgrade/common/actors/systemfacts/tests/test_systemfacts_selinux.py | 1c171ec3a5f9260a3c6f84a9b15cad78a875ac61 | import warnings
import pytest
from leapp.libraries.actor.systemfacts import get_selinux_status
from leapp.models import SELinuxFacts
no_selinux = False
try:
import selinux
except ImportError:
no_selinux = True
warnings.warn(
'Tests which uses `selinux` will be skipped'
' due to library un... | [((436, 493), 'pytest.mark.skipif', 'pytest.mark.skipif', (['no_selinux'], {'reason': 'reason_to_skip_msg'}), '(no_selinux, reason=reason_to_skip_msg)\n', (454, 493), False, 'import pytest\n'), ((1261, 1318), 'pytest.mark.skipif', 'pytest.mark.skipif', (['no_selinux'], {'reason': 'reason_to_skip_msg'}), '(no_selinux, r... |
emetowinner/python-challenges | Phase-1/Python Basic 2/Day-24.py | 520da69da0f2632deb1e81136d2b62d40555a4aa | """
1. Write a Python program to reverse only the vowels of a given string.
Sample Output:
w3resuorce
Python
Perl
ASU
2. Write a Python program to check whether a given integer is a palindrome or not.
Note: An integer is a palindrome when it reads the same backward as forward. Negative numbers are not palindromic.
Sa... | [] |
IMULMUL/etl-parser | etl/parsers/etw/Microsoft_Windows_IPxlatCfg.py | 76b7c046866ce0469cd129ee3f7bb3799b34e271 | # -*- coding: utf-8 -*-
"""
Microsoft-Windows-IPxlatCfg
GUID : 3e5ac668-af52-4c15-b99b-a3e7a6616ebd
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from etl.p... | [((511, 565), 'construct.Struct', 'Struct', (["('ErrorString' / CString)", "('ErrorCode' / Int32ul)"], {}), "('ErrorString' / CString, 'ErrorCode' / Int32ul)\n", (517, 565), False, 'from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct\n'), ((737, 82... |
Levakin/sanic-test-app | microservices/users/config.py | d96a54a21f6d0d3b262bbc7bc75f5fa3b12c3b61 | # -*- coding: utf-8 -*-
import os
from distutils.util import strtobool
class Config:
DEBUG = bool(strtobool(os.getenv('DEBUG', "False")))
DATABASE_URI = os.getenv('DATABASE_URI', '127.0.0.1:27017')
WORKERS = int(os.getenv('WORKERS', 2))
LOGO = os.getenv('LOGO', None)
HOST = os.getenv('HOST', '127... | [((164, 208), 'os.getenv', 'os.getenv', (['"""DATABASE_URI"""', '"""127.0.0.1:27017"""'], {}), "('DATABASE_URI', '127.0.0.1:27017')\n", (173, 208), False, 'import os\n'), ((263, 286), 'os.getenv', 'os.getenv', (['"""LOGO"""', 'None'], {}), "('LOGO', None)\n", (272, 286), False, 'import os\n'), ((298, 328), 'os.getenv',... |
Temurson/semantic | semantic-python/test/fixtures/4-01-lambda-literals.py | 2e9cd2c006cec9a0328791e47d8c6d60af6d5a1b | # CHECK-TREE: { const <- \x -> \y -> x; y <- const #true #true; z <- const #false #false; #record { const: const, y : y, z: z, }}
const = lambda x, y: x
y = const(True, True)
z = const(False, False)
| [] |
mithi/semantic-segmentation | main.py | 85e9df04397745e0c6ab252e30991fa9b514ec1a | import tensorflow as tf
import os.path
import warnings
from distutils.version import LooseVersion
import glob
import helper
import project_tests as tests
#--------------------------
# USER-SPECIFIED DATA
#--------------------------
# Tune these parameters
NUMBER_OF_CLASSES = 2
IMAGE_SHAPE = (160, 576)
EPOCHS = 20
... | [((1326, 1415), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, IMAGE_SHAPE[0], IMAGE_SHAPE[1], NUMBER_OF_CLASSES]'], {}), '(tf.float32, [None, IMAGE_SHAPE[0], IMAGE_SHAPE[1],\n NUMBER_OF_CLASSES])\n', (1340, 1415), True, 'import tensorflow as tf\n'), ((1428, 1454), 'tensorflow.placeholder', 'tf.... |
BrunoReboul/forseti-security | tests/scanner/audit/log_sink_rules_engine_test.py | 9d4a61b3e5a5d22a4330d15ddf61063fc9079071 | # Copyright 2018 The Forseti Security 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 ap... | [((22340, 22355), 'unittest.main', 'unittest.main', ([], {}), '()\n', (22353, 22355), False, 'import unittest\n'), ((1497, 1513), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (1511, 1513), False, 'import mock\n'), ((1950, 2064), 'google.cloud.forseti.common.gcp_type.organization.Organization', 'Organization', ... |
agupta54/ulca | backend/api/ulca-ums-service/user-management/utilities/orgUtils.py | c1f570ac254ce2ac73f40c49716458f4f7cbaee2 | import uuid
from config import USR_ORG_MONGO_COLLECTION, USR_MONGO_COLLECTION
import db
from models.response import post_error
import logging
log = logging.getLogger('file')
class OrgUtils:
def __init__(self):
pass
#orgId generation
@staticmethod
def generate_org_id():
"""UUID gener... | [((150, 175), 'logging.getLogger', 'logging.getLogger', (['"""file"""'], {}), "('file')\n", (167, 175), False, 'import logging\n'), ((366, 378), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (376, 378), False, 'import uuid\n'), ((1643, 1693), 'models.response.post_error', 'post_error', (['"""Data Missing"""', '"""code ... |
AntonBiryukovUofC/diffvg | setup.py | e081098f52b82bfd0b7e91114d289d65ef969a60 | # Adapted from https://github.com/pybind/cmake_example/blob/master/setup.py
import os
import re
import sys
import platform
import subprocess
import importlib
from sysconfig import get_paths
import importlib
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from setuptools.comma... | [((3168, 3201), 'importlib.util.find_spec', 'importlib.util.find_spec', (['"""torch"""'], {}), "('torch')\n", (3192, 3201), False, 'import importlib\n'), ((3212, 3250), 'importlib.util.find_spec', 'importlib.util.find_spec', (['"""tensorflow"""'], {}), "('tensorflow')\n", (3236, 3250), False, 'import importlib\n'), ((3... |
twinters007/robotpy-wpilib-utilities | robotpy_ext/common_drivers/navx/registerio.py | d2e18c16fc97a469e0621521e0fbed0093610d6e | # validated: 2017-02-19 DS c5e3a8a9b642 roborio/java/navx_frc/src/com/kauailabs/navx/frc/RegisterIO.java
#----------------------------------------------------------------------------
# Copyright (c) Kauai Labs 2015. All Rights Reserved.
#
# Created in support of Team 2465 (Kauaibots). Go Purple Wave!
#
# Open Source S... | [((683, 708), 'logging.getLogger', 'logging.getLogger', (['"""navx"""'], {}), "('navx')\n", (700, 708), False, 'import logging\n'), ((13456, 13480), 'wpilib.timer.Timer.getFPGATimestamp', 'Timer.getFPGATimestamp', ([], {}), '()\n', (13478, 13480), False, 'from wpilib.timer import Timer\n'), ((13623, 13647), 'wpilib.tim... |
wvdv2002/RigolWFM | RigolWFM/channel.py | 849a1130c9194f052eaf5582dfa67e7a5708a3a3 | #pylint: disable=invalid-name
#pylint: disable=too-many-instance-attributes
#pylint: disable=too-many-return-statements
#pylint: disable=too-many-statements
"""
Class structure and methods for an oscilloscope channel.
The idea is to collect all the relevant information from all the Rigol
scope waveforms into a single ... | [((2293, 2334), 'numpy.frombuffer', 'np.frombuffer', (['w.data.raw'], {'dtype': 'np.uint8'}), '(w.data.raw, dtype=np.uint8)\n', (2306, 2334), True, 'import numpy as np\n'), ((6716, 6747), 'numpy.linspace', 'np.linspace', (['(-h)', 'h', 'self.points'], {}), '(-h, h, self.points)\n', (6727, 6747), True, 'import numpy as ... |
esf-bt2020/mmdetection | configs/raubtierv2a/faster_rcnn_x101_64x4d_fpn_1x_raubtierv2a_nofreeze_4gpu.py | abc5fe060e0fcb716f845c85441be3741b22d3cf | _base_ = '../faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco.py'
model = dict(
backbone=dict(
num_stages=4,
#frozen_stages=4
),
roi_head=dict(
bbox_head=dict(
num_classes=3
)
)
)
dataset_type = 'COCODataset'
classes = ('luchs', 'rotfuchs', 'wolf')
data = dict... | [] |
wbaweto/QConf | driver/python/setup.py | 977a53d601eab2055fd8fb344b92f4026d178ad5 | from distutils.core import setup, Extension
setup(name = 'qconf_py', version = '1.2.2', ext_modules = [Extension('qconf_py', ['lib/python_qconf.cc'],
include_dirs=['/usr/local/include/qconf'],
extra_objects=['/usr/local/qconf/lib/libqconf.a']
)])
| [((103, 253), 'distutils.core.Extension', 'Extension', (['"""qconf_py"""', "['lib/python_qconf.cc']"], {'include_dirs': "['/usr/local/include/qconf']", 'extra_objects': "['/usr/local/qconf/lib/libqconf.a']"}), "('qconf_py', ['lib/python_qconf.cc'], include_dirs=[\n '/usr/local/include/qconf'], extra_objects=[\n '... |
Lockdef/kyopro-code | abc153/d.py | 2d943a87987af05122c556e173e5108a0c1c77c8 | h = int(input())
i = 1
a = 1
b = 1
c = 1
while h >= a:
a = 2 ** i
i += 1
s = 0
t = True
for j in range(1, i-1):
c += 2 ** j
print(c)
| [] |
Natureshadow/OpenGoPro | demos/python/sdk_wireless_camera_control/open_gopro/demos/log_battery.py | 05110123cfbf6584288b813f2d4896d3a091480e | # log_battery.py/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:45 PM
"""Example to continuously read the battery (with no Wifi connection)"""
import csv
import time
import logging
import argparse
import threading
fro... | [((633, 660), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (650, 660), False, 'import logging\n'), ((671, 680), 'rich.console.Console', 'Console', ([], {}), '()\n', (678, 680), False, 'from rich.console import Console\n'), ((3195, 3230), 'open_gopro.util.setup_logging', 'setup_logging',... |
mcroydon/django-tumbleweed | tumbleweed/models.py | 3f1eab2bf12350a91ca38165efec0c221a1fe69a | # These are not the droids you are looking for. | [] |
wathsalav/xos | xos/hpc_observer/steps/sync_originserver.py | f6bcaa37a948ee41729236afe7fce0802e002404 | import os
import sys
import base64
from django.db.models import F, Q
from xos.config import Config
from observer.syncstep import SyncStep
from core.models import Service
from hpc.models import ServiceProvider, ContentProvider, CDNPrefix, OriginServer
from util.logger import Logger, logging
# hpclibrary will be in ste... | [((383, 412), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (398, 412), False, 'import sys\n'), ((453, 479), 'util.logger.Logger', 'Logger', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (459, 479), False, 'from util.logger import Logger, logging\n'), ((351, 376), 'o... |
aroxby/pixel-processor | main.py | 9cfe260a085ced0883ce8b0a35c28020f4aa8737 | #!/usr/bin/env python3
from PIL import Image
def tranform(r, g, b):
tmp = b
b = g // 2
g = tmp
r = r // 2
return r, g, b
def main():
im = Image.open('blue-flames.jpg')
input_pixels = im.getdata()
output_pixels = tuple(tranform(*pixel) for pixel in input_pixels)
im.putdata(output_... | [((166, 195), 'PIL.Image.open', 'Image.open', (['"""blue-flames.jpg"""'], {}), "('blue-flames.jpg')\n", (176, 195), False, 'from PIL import Image\n')] |
lesserwhirls/scipy-cwt | scipy/weave/examples/swig2_example.py | ee673656d879d9356892621e23ed0ced3d358621 | """Simple example to show how to use weave.inline on SWIG2 wrapped
objects. SWIG2 refers to SWIG versions >= 1.3.
To run this example you must build the trivial SWIG2 extension called
swig2_ext. To do this you need to do something like this::
$ swig -c++ -python -I. -o swig2_ext_wrap.cxx swig2_ext.i
$ g++ -Wall ... | [((1053, 1081), 'scipy.weave.swig2_spec.swig2_converter', 'swig2_spec.swig2_converter', ([], {}), '()\n', (1079, 1081), False, 'from scipy.weave import swig2_spec, converters\n'), ((1213, 1226), 'swig2_ext.A', 'swig2_ext.A', ([], {}), '()\n', (1224, 1226), False, 'import swig2_ext\n'), ((1235, 1250), 'swig2_ext.foo', '... |
denghz/Probabilistic-Programming | src/simplify.py | fa505a75c4558e507fd3effd2737c63537bfe50d | from wolframclient.language.expression import WLSymbol
from nnDiff import *
def parseGlobalSymbol(s):
if isinstance(s, numbers.Number):
return s
if isinstance(s, WLSymbol):
if s.name == 'E':
return 'E'
else:
return s.name[7:]
def parse(exp):
symbol =... | [] |
EdWard680/python-firetv | setup.py | 4c02f79a1c8ae60a489297178d010a31545a3b5d | from setuptools import setup
setup(
name='firetv',
version='1.0.7',
description='Communicate with an Amazon Fire TV device via ADB over a network.',
url='https://github.com/happyleavesaoc/python-firetv/',
license='MIT',
author='happyleaves',
author_email='happyleaves.tfr@gmail.com',
pac... | [((30, 764), 'setuptools.setup', 'setup', ([], {'name': '"""firetv"""', 'version': '"""1.0.7"""', 'description': '"""Communicate with an Amazon Fire TV device via ADB over a network."""', 'url': '"""https://github.com/happyleavesaoc/python-firetv/"""', 'license': '"""MIT"""', 'author': '"""happyleaves"""', 'author_emai... |
Mario-Kart-Felix/python-neo | neo/io/exampleio.py | 951c97cf9eb56f5489da88940de920329e0f4c1b | """
neo.io have been split in 2 level API:
* neo.io: this API give neo object
* neo.rawio: this API give raw data as they are in files.
Developper are encourage to use neo.rawio.
When this is done the neo.io is done automagically with
this king of following code.
Author: sgarcia
"""
from neo.io.basefromrawio i... | [((801, 847), 'neo.rawio.examplerawio.ExampleRawIO.__init__', 'ExampleRawIO.__init__', (['self'], {'filename': 'filename'}), '(self, filename=filename)\n', (822, 847), False, 'from neo.rawio.examplerawio import ExampleRawIO\n'), ((856, 892), 'neo.io.basefromrawio.BaseFromRaw.__init__', 'BaseFromRaw.__init__', (['self',... |
sap9433/Distributed-Multi-User-Scrapy-System-with-a-Web-UI | scrapyproject/migrations/0003_auto_20170209_1025.py | 0676f7599f288409d0faf7b6211c171ce8c46a7a | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scrapyproject', '0002_auto_20170208_1738'),
]
operations = [
migrations.AlterField(
model_name='project',
... | [((367, 395), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (383, 395), False, 'from django.db import migrations, models\n'), ((528, 556), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (544, 556), False, 'from django.db im... |
cbsBiram/xarala__ssr | src/cart/forms.py | 863e1362c786daa752b942b796f7a015211d2f1b | from django import forms
from django.utils.translation import gettext_lazy as _
COURSE_QUANTITY_CHOICES = [(i, str(i)) for i in range(1, 21)]
class CartAddCourseForm(forms.Form):
quantity = forms.TypedChoiceField(
choices=COURSE_QUANTITY_CHOICES, coerce=int, label=_("Quantité")
)
override = form... | [((316, 391), 'django.forms.BooleanField', 'forms.BooleanField', ([], {'required': '(False)', 'initial': '(False)', 'widget': 'forms.HiddenInput'}), '(required=False, initial=False, widget=forms.HiddenInput)\n', (334, 391), False, 'from django import forms\n'), ((281, 294), 'django.utils.translation.gettext_lazy', '_',... |
sflippl/patches | patches/datasets/__init__.py | c19889e676e231af44669a01c61854e9e5791227 | """Datasets of latent predictability tasks.
"""
from .pilgrimm import *
| [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.