repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
nikmagini/pilot | objectstoreSiteMover.py | 1c84fcf6f7e43b669d2357326cdbe06382ac829f | #!/usr/bin/env python
# Copyright European Organization for Nuclear Research (CERN)
#
# 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
#
# Authors:
... | [] |
Miguel-mmf/Biblioteca_Dash_em-Python | codigos_videos/Exemplo_2.py | 63d268f568c02bc9b6c73e1f52ade2475ffbb3c5 | # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Esse arquivo possui algumas modificações em relação ao arquivo apresentado no vídeo do YouTube
# Não deixe de assistir o vídeo e estudar pela documentação ofical D... | [((1211, 1273), 'dash.Dash', 'dash.Dash', (['__name__'], {'external_stylesheets': 'external_stylesheets'}), '(__name__, external_stylesheets=external_stylesheets)\n', (1220, 1273), False, 'import dash\n'), ((1629, 1640), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (1638, 1640), True, 'import plotly.gr... |
tochanenko/MetaProgramming | Lab 2/javaccflab/formatter.py | d37f21432483e39e135fd0dc4f8767836eea1609 | import re
import datetime
from javaccflab.lexer import parse
from javaccflab.java_token import TokenType, Token, update_token_value
class Formatter:
def __init__(self, files):
self.__files = files
self.__file = None
self.__tokens = []
self.__to_fix = dict()
def process(self):
... | [((26009, 26054), 're.sub', 're.sub', (['"""(.)([A-Z][a-z]+)"""', '"""\\\\1_\\\\2"""', 'naming'], {}), "('(.)([A-Z][a-z]+)', '\\\\1_\\\\2', naming)\n", (26015, 26054), False, 'import re\n'), ((9361, 9391), 'javaccflab.java_token.Token', 'Token', (['None', 'TokenType.COMMENT'], {}), '(None, TokenType.COMMENT)\n', (9366,... |
zangobot/secml | src/secml/adv/attacks/evasion/c_attack_evasion_pgd_exp.py | 95a293e1201c24256eb7fe2f1d2125cd5f318c8c | """
.. module:: CAttackEvasionPGDExp
:synopsis: Evasion attack using Projected Gradient Descent.
.. moduleauthor:: Battista Biggio <battista.biggio@unica.it>
"""
from secml.adv.attacks.evasion import CAttackEvasionPGDLS
class CAttackEvasionPGDExp(CAttackEvasionPGDLS):
"""Evasion attacks using Projected Gradi... | [] |
kinteriq/mail-log-parser | mail_log_parser/data_manager.py | e4242387c1767db611e266d463c817aeb8a74377 | import sqlite3
class ManageData:
def __init__(self, queue_tracker_db, email_tracker_db, delivery_tracker_db):
self.queue_tracker_db = queue_tracker_db
self.email_tracker_db = email_tracker_db
self.delivery_tracker_db = delivery_tracker_db
def manage_queue_tracker(self, fields):
... | [((2551, 2577), 'sqlite3.connect', 'sqlite3.connect', (['self.path'], {}), '(self.path)\n', (2566, 2577), False, 'import sqlite3\n')] |
lychenyoko/content-aware-gan-compression | Util/training_util.py | fa4193df630dd7b0e7fc52dd60669d8e1aefc39d | import math
def g_path_regularize(fake_img, latents, mean_path_length, decay=0.01):
noise = torch.randn_like(fake_img) / math.sqrt(
fake_img.shape[2] * fake_img.shape[3]
)
grad, = autograd.grad(
outputs=(fake_img * noise).sum(), inputs=latents, create_graph=True
)
path_lengths = tor... | [((126, 174), 'math.sqrt', 'math.sqrt', (['(fake_img.shape[2] * fake_img.shape[3])'], {}), '(fake_img.shape[2] * fake_img.shape[3])\n', (135, 174), False, 'import math\n')] |
DIS-SIN/FlaskShell | app/configs/development_settings.py | 5f6d0cfeac8bea0b274d16a497e3a20cd00b155a | ######################################################## FLASK SETTINGS ##############################################################
#Variable used to securly sign cookies
##THIS IS SET IN DEV ENVIRONMENT FOR CONVENIENCE BUT SHOULD BE SET AS AN ENVIRONMENT VARIABLE IN PROD
SECRET_KEY = "dev"
########################... | [] |
caoxiaoyue/PyAutoArray | autoarray/structures/grids/two_d/grid_2d_util.py | e10d3d6a5b8dd031f2ad277486bd539bd5858b2a | import numpy as np
from typing import Tuple, Union, Optional
from autoarray.structures.arrays.two_d import array_2d_util
from autoarray.geometry import geometry_util
from autoarray import numba_util
from autoarray.mask import mask_2d_util
@numba_util.jit()
def grid_2d_centre_from(grid_2d_slim: np.ndarray) ... | [((252, 268), 'autoarray.numba_util.jit', 'numba_util.jit', ([], {}), '()\n', (266, 268), False, 'from autoarray import numba_util\n'), ((824, 840), 'autoarray.numba_util.jit', 'numba_util.jit', ([], {}), '()\n', (838, 840), False, 'from autoarray import numba_util\n'), ((11036, 11052), 'autoarray.numba_util.jit', 'num... |
crown-prince/proxies | Proxies/Proxies.py | a3342d414675dbc89cdf1b953b46ea518f451166 | # coding: utf-8
import requests, math
import gevent
from gevent.queue import Queue
from gevent import monkey; monkey.patch_all()
from pyquery import PyQuery
class Proxies():
def __init__(self):
self.domestic_gn_url = 'http://www.kuaidaili.com/free/inha/{0}/'
self.domestic_pt_url = 'http://www.kuai... | [((111, 129), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {}), '()\n', (127, 129), False, 'from gevent import monkey\n'), ((536, 554), 'requests.Session', 'requests.Session', ([], {}), '()\n', (552, 554), False, 'import requests, math\n'), ((1726, 1733), 'gevent.queue.Queue', 'Queue', ([], {}), '()\n', (1731, 1... |
Oaklight/parallelformers | parallelformers/policies/base/auto.py | 57fc36f81734c29aaf814e092ce13681d3c28ede | # Copyright 2021 TUNiB 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 agreed to in writing, softw... | [((883, 902), 'contextlib.suppress', 'suppress', (['Exception'], {}), '(Exception)\n', (891, 902), False, 'from contextlib import suppress\n'), ((1219, 1238), 'contextlib.suppress', 'suppress', (['Exception'], {}), '(Exception)\n', (1227, 1238), False, 'from contextlib import suppress\n'), ((1538, 1557), 'contextlib.su... |
RyosukeDTomita/gcmPlot | main/upper_air_humidity.py | 430f8af353daf464b5c5566f1c163d5bef63f584 | # coding: utf-8
"""
Name: upper_air_humidity.py
Make upper level weather chart.
Usage: python3 upper_air_humidity.py --file <ncfile>
Author: Ryosuke Tomita
Date: 2022/01/07
"""
import argparse
from ncmagics import fetchtime, japanmap, meteotool
def parse_args() -> dict:
"""parse_args.
set file path.
A... | [((374, 399), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (397, 399), False, 'import argparse\n'), ((764, 792), 'ncmagics.fetchtime.fetch_time', 'fetchtime.fetch_time', (['ncfile'], {}), '(ncfile)\n', (784, 792), False, 'from ncmagics import fetchtime, japanmap, meteotool\n'), ((945, 979), '... |
amCharlie/hive | serde/src/gen/thrift/gen-py/megastruct/ttypes.py | e1870c190188a3b706849059969c8bec2220b6d2 | #
# Autogenerated by Thrift Compiler (0.13.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive impo... | [((22938, 22959), 'thrift.TRecursive.fix_spec', 'fix_spec', (['all_structs'], {}), '(all_structs)\n', (22946, 22959), False, 'from thrift.TRecursive import fix_spec\n')] |
Tylarb/gpdb | gpMgmt/bin/gpload_test/gpload2/TEST.py | 15e1341cfbac7f70d2086a9a1d46149a82765b5e | #!/usr/bin/env python
import unittest
import sys
import os
import string
import time
import socket
import fileinput
import platform
import re
try:
import subprocess32 as subprocess
except:
import subprocess
import pg
def get_port_from_conf():
file = os.environ.get('MASTER_DATA_DIRECTORY')+'/postgresql.con... | [] |
dylanlee101/leetcode | code_week19_831_96/biao_shi_shu_zi.py | b059afdadb83d504e62afd1227107de0b59557af | '''
请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。例如,字符串"+100"、"5e2"、"-123"、"3.1416"、"-1E-16"、"0123"都表示数值,但"12e"、"1a3.14"、"1.2.3"、"+-5"及"12e+5.4"都不是。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/biao-shi-shu-zhi-de-zi-fu-chuan-lcof
'''
class Solution:
def isNumber(self, s: str) -> bool:
states = [
{ ' ... | [] |
rackerlabs/teeth-overlord | teeth_overlord/tests/unit/networks/neutron.py | d76f6a03853d964b556aa1aa0f7011b4d1a6f208 | """
Copyright 2013 Rackspace, 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 agreed to in writing, software... | [((4728, 4968), 'collections.OrderedDict', 'collections.OrderedDict', (["[('id', u'PORT1'), ('name', u''), ('status', u'ACTIVE'), ('mac_address',\n u'fa:16:3e:e0:d4:63'), ('fixed_ips', [{u'subnet_id': u'SUBNET1',\n u'ip_address': u'10.0.0.3'}]), ('network', SERIALIZED_NETWORK1)]"], {}), "([('id', u'PORT1'), ('nam... |
johnyburd/glucometer | classes/settings.py | 075a48cff38e0570960fc2b8968bcb8b5ddd647f | def init():
global brightness
global calibration_mode
brightness = 500
calibration_mode = False
| [] |
Phoenix-sy/typeidea | typeidea/blog/views.py | e913218872c7f4e9afc290eb42b4ca8c8e4523be | from datetime import date
from django.core.cache import cache
from django.db.models import Q, F
from django.shortcuts import render
from django.shortcuts import get_object_or_404
from django.views.generic import ListView, DetailView
#from silk.profiling.profiler import silk_profile
from config.models import SideBar
f... | [((653, 703), 'config.models.SideBar.objects.filter', 'SideBar.objects.filter', ([], {'status': 'SideBar.STATUS_SHOW'}), '(status=SideBar.STATUS_SHOW)\n', (675, 703), False, 'from config.models import SideBar\n'), ((1387, 1430), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Category'], {'pk': 'category_... |
thomasbarillot/DAQ | VMI/VMItest.py | 20126655f74194757d25380680af9429ff27784e | # -*- coding: utf-8 -*-
"""
Created on Sat May 7 11:38:18 2016
@author: thomasbarillot
VMI control
"""
from ctypes import cdll
#slib="VMIcrtl_ext.dll"
#hlib=cdll('VMIcrtl.dll')
import VMIcrtl_ext
test=VMIcrtl_ext.VMIcrtl()
#%%
print test.GetFilename()
#%%
test.setFilename('20161115_1841.dat')
print test.GetFilen... | [] |
vitodb/spack | var/spack/repos/builtin/packages/openssl/package.py | b9ab1de4c5f7b21d9f9cb88b7251820a48e82d27 | # 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)
import llnl.util.tty as tty
from spack import *
import spack.architecture
import os
class Openssl(Package): # Uses F... | [((5138, 5337), 'llnl.util.tty.warn', 'tty.warn', (['"""Fetching OpenSSL failed. This may indicate that OpenSSL has been updated, and the version in your instance of Spack is insecure. Consider updating to the latest OpenSSL version."""'], {}), "(\n 'Fetching OpenSSL failed. This may indicate that OpenSSL has been u... |
izaid/vispy | vispy/util/profiler.py | 402cf95bfef88d70c9c45bb27c532ed72944e14a | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# Adapted from PyQtGraph
import sys
from . import ptime
from .. import config
class Profiler(object):
"""Simple profiler allowing directed, hierarchical measurement of ti... | [((2435, 2451), 'sys._getframe', 'sys._getframe', (['(1)'], {}), '(1)\n', (2448, 2451), False, 'import sys\n')] |
vijithv/djangosaml2idp | tests/test_processor.py | 8a238063da55bf4823bdc2192168171767c4e056 | from django.contrib.auth import get_user_model
from djangosaml2idp.processors import BaseProcessor
User = get_user_model()
class TestBaseProcessor:
def test_extract_user_id_configure_by_user_class(self):
user = User()
user.USERNAME_FIELD = 'email'
user.email = 'test_email'
asse... | [((107, 123), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (121, 123), False, 'from django.contrib.auth import get_user_model\n'), ((323, 349), 'djangosaml2idp.processors.BaseProcessor', 'BaseProcessor', (['"""entity-id"""'], {}), "('entity-id')\n", (336, 349), False, 'from djangosaml2idp.p... |
sasikrishna/python-programs | com/ds/SingleLinkedList.py | 937002f37c86efc5c876b37c7b42634ca629fffc |
class Node:
def __init__(self, data):
self.data = data
self.prev = None
self.next = None
class SingleLinkedList:
def __init__(self):
self.head = None
def add(self, ele):
new_node = Node(ele)
if self.head is None:
self.head = new_node
... | [] |
data-stories/chart-experiment | src/data_setup/__init__.py | f4d7c86c32edca8bcb474cce5f6312138acf5cc9 | __all__ = ["data_setup", "chart_params", "base_params"] | [] |
rudaporto/aiocomcrawl | src/aiocomcrawl/models.py | 9f76097d9f82c5790f968d26a6f1c3908084569b | from datetime import datetime
from typing import Any, List, Optional, Union
from pydantic import BaseModel, Field, HttpUrl, validator
from pydantic.dataclasses import dataclass
class Index(BaseModel):
id: str
name: str
time_gate: HttpUrl = Field(alias="timegate")
cdx_api: HttpUrl = Field(alias="cdx-a... | [((328, 350), 'pydantic.dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (337, 350), False, 'from pydantic.dataclasses import dataclass\n'), ((459, 481), 'pydantic.dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (468, 481), False, 'from pydantic.dat... |
EnjoyLifeFund/macHighSierra-py36-pkgs | fs/error_tools.py | 5668b5785296b314ea1321057420bcd077dba9ea | """Tools for managing OS errors.
"""
from __future__ import print_function
from __future__ import unicode_literals
import errno
from contextlib import contextmanager
import sys
import platform
from . import errors
from six import reraise
_WINDOWS_PLATFORM = platform.system() == 'Windows'
class _ConvertOSErrors(... | [((264, 281), 'platform.system', 'platform.system', ([], {}), '()\n', (279, 281), False, 'import platform\n')] |
gaberger/pysdn | samples/samplenetconf/demos/vr_demo3.py | 67442e1c259d8ca8620ada95b95977e3852463c5 | #!/usr/bin/python
# Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC
# 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 n... | [] |
stijnvanhulle/EscapeGame | python/index.py | ae3e35334d64394a0f696149bfd56c1fd7a97681 | # @Author: Stijn Van Hulle <stijnvanhulle>
# @Date: 2016-11-28T13:51:38+01:00
# @Email: me@stijnvanhulle.be
# @Last modified by: stijnvanhulle
# @Last modified time: 2016-12-20T12:51:07+01:00
# @License: stijnvanhulle.be
#!/usr/bin/env python
import time
import datetime
import math
import sys
import json
impor... | [((508, 521), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {}), '()\n', (519, 521), True, 'import paho.mqtt.client as mqtt\n'), ((1932, 1962), 'json.dumps', 'json.dumps', (["{'device': device}"], {}), "({'device': device})\n", (1942, 1962), False, 'import json\n'), ((2124, 2139), 'time.sleep', 'time.sleep', (['(0.2)'... |
ajeet1308/code_problems | Codility/python/tape_equilibrium.py | 5d99839b6319295c6d81dd86775c46a536e7a1ca | def solution(A):
total = sum(A)
m = float('inf')
left_sum = 0
for n in A[:-1]:
left_sum += n
v = abs(total - 2*left_sum)
if v < m:
m = v
return m
| [] |
idjaw/pythondotorg | peps/converters.py | 8e4babbc7ad15ed52b4f66fdd4ab43c2dd3bd649 | import re
import os
from bs4 import BeautifulSoup
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files import File
from pages.models import Page, Image
PEP_TEMPLATE = 'pages/pep-page.html'
pep_url = lambda num: 'dev/peps/pep-{}/'.format(num)
def check_pat... | [((854, 907), 'os.path.join', 'os.path.join', (['settings.PEP_REPO_PATH', '"""pep-0000.html"""'], {}), "(settings.PEP_REPO_PATH, 'pep-0000.html')\n", (866, 907), False, 'import os\n'), ((962, 989), 'bs4.BeautifulSoup', 'BeautifulSoup', (['pep0_content'], {}), '(pep0_content)\n', (975, 989), False, 'from bs4 import Beau... |
ajayiagbebaku/NFL-Model | venv/Lib/site-packages/toolz/sandbox/__init__.py | afcc67a85ca7138c58c3334d45988ada2da158ed | from .core import EqualityHashKey, unzip
from .parallel import fold
| [] |
caglorithm/accel | interface/app/__init__.py | 7fe5c13ea9559565c599633bdb3318c8fbc57088 | from flask import Flask
app = Flask(__name__, static_folder='static')
from app import routes
| [((31, 70), 'flask.Flask', 'Flask', (['__name__'], {'static_folder': '"""static"""'}), "(__name__, static_folder='static')\n", (36, 70), False, 'from flask import Flask\n')] |
sebastien-riou/SATL | implementations/python3/tests/CAPDU.py | b95d0e784d2e8e1384381d4d5b8b448d3d1798cf | import os
import pysatl
from pysatl import CAPDU
if __name__ == "__main__":
def check(hexstr, expected):
capdu = CAPDU.from_hexstr(hexstr)
if capdu != expected:
raise Exception("Mismatch for input '"+hexstr+"'\nActual: "+str(capdu)+"\nExpected: "+str(expected))
def gencase(* ... | [((129, 154), 'pysatl.CAPDU.from_hexstr', 'CAPDU.from_hexstr', (['hexstr'], {}), '(hexstr)\n', (146, 154), False, 'from pysatl import CAPDU\n'), ((405, 421), 'os.getrandom', 'os.getrandom', (['LC'], {}), '(LC)\n', (417, 421), False, 'import os\n'), ((1200, 1252), 'pysatl.CAPDU', 'CAPDU', ([], {'CLA': '(0)', 'INS': '(17... |
rosich/mgls | src/mgls_bootstrapping.py | 64c924f59adba2dddf44bb70a84868173f0b7120 | #!/usr/bin/python
from math import sin, cos, tan, atan, pi, acos, sqrt, exp, log10
import sys, os
import copy
import random
import numpy as np
import multiprocessing as mp
import ConfigParser
sys.path.append('./bin')
import mGLS, mMGLS
sys.path.append('./src')
from EnvGlobals import Globals
import mgls_io
import mgls_m... | [] |
pcaruana/sombrio | mgmt/src/constants.py | 3b669fc83e0227a69b673b5555d88e15b55c397c | #! /usr/bin/env python3
"""
constants.py - Contains all constants used by the device manager
Author:
- Pablo Caruana (pablo dot caruana at gmail dot com)
Date: 12/3/2016
"""
number_of_rows = 3 # total number rows of Index Servers
number_of_links = 5 # number of links to be ... | [] |
STomoya/sketchify | XDoG/XDoG.py | 93c068042f02172505457cc15cb0bef673666be3 |
import cv2
import numpy as np
def DoG(image, size, sigma, k=1.6, gamma=1.):
g1 = cv2.GaussianBlur(image, (size, size), sigma)
g2 = cv2.GaussianBlur(image, (size, size), sigma*k)
return g1 - gamma * g2
def XDoG(image, size, sigma, eps, phi, k=1.6, gamma=1.):
eps /= 255
d = DoG(image, size, sigma, ... | [((87, 131), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['image', '(size, size)', 'sigma'], {}), '(image, (size, size), sigma)\n', (103, 131), False, 'import cv2\n'), ((141, 189), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['image', '(size, size)', '(sigma * k)'], {}), '(image, (size, size), sigma * k)\n', (157, 189), Fals... |
ericlin8545/grover | lm/validate.py | 3ac6e506f2e1a859d98cc2c3fb57ba251be31484 | # Original work Copyright 2018 The Google AI Language Team Authors.
# Modified work Copyright 2019 Rowan Zellers
#
# 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/... | [((4327, 4368), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (4351, 4368), True, 'import tensorflow as tf\n'), ((4388, 4434), 'lm.modeling.GroverConfig.from_json_file', 'GroverConfig.from_json_file', (['FLAGS.config_file'], {}), '(FLAGS.config_file)\n... |
fuhuifang/RoBo | robo/fmin/entropy_search.py | 036bbaa0e59032577e2611d8ba304384b397c7f6 | import logging
import george
import numpy as np
from robo.priors.default_priors import DefaultPrior
from robo.models.gaussian_process import GaussianProcess
from robo.models.gaussian_process_mcmc import GaussianProcessMCMC
from robo.maximizers.random_sampling import RandomSampling
from robo.maximizers.scipy_optimizer ... | [((748, 775), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (765, 775), False, 'import logging\n'), ((2358, 2379), 'numpy.all', 'np.all', (['(lower < upper)'], {}), '(lower < upper)\n', (2364, 2379), True, 'import numpy as np\n'), ((2672, 2689), 'numpy.ones', 'np.ones', (['[n_dims]'], {}... |
ck-tm/biserici-inlemnite | biserici_inlemnite/app/migrations/0096_bisericapage_datare_an.py | c9d12127b92f25d3ab2fcc7b4c386419fe308a4e | # Generated by Django 3.1.13 on 2021-10-29 11:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0095_bisericapage_utitle'),
]
operations = [
migrations.AddField(
model_name='bisericapage',
name='datare_an... | [((341, 383), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (360, 383), False, 'from django.db import migrations, models\n')] |
bcgov/mds | services/core-api/app/api/mms_now_submissions/models/surface_bulk_sample_activity.py | 6c427a66a5edb4196222607291adef8fd6677038 | from app.api.utils.models_mixins import Base
from app.extensions import db
class MMSSurfaceBulkSampleActivity(Base):
__tablename__ = "surface_bulk_sample_activity"
__table_args__ = {"schema": "mms_now_submissions"}
id = db.Column(db.Integer, primary_key=True)
messageid = db.Column(db.Integer, db.Forei... | [((234, 273), 'app.extensions.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (243, 273), False, 'from app.extensions import db\n'), ((386, 407), 'app.extensions.db.Column', 'db.Column', (['db.Integer'], {}), '(db.Integer)\n', (395, 407), False, 'from app.extens... |
davo22/lgtv_rs232 | lgtv_rs232/commands/remote_control/remote_control_lock.py | 40562cddf7acdf6fa95124029595e3838dd9e7b0 | from enum import Enum
class RemoteControlLock(Enum):
OFF = 0
ON = 1
def map_to_state(data: int):
return RemoteControlLock(data)
class RemoteControlLockCommands(object):
_command = "km"
def __init__(self, send_command):
self._send_command = send_command
async def get_state(self):
... | [] |
aashishogale/FunctionalPrograms-Python- | com/bridgelabz/programs/powerof2.py | d297bdb78112ef03274a10a58efc90da27f51b14 | import sys
from com.bridgelabz.utility.Utility import Utility
class PowerOf2:
def start(self):
number=int(sys.argv[1])
print(number)
for i in Utility().powerof2(number):
print(i)
return
PowerOf2().start() | [((170, 179), 'com.bridgelabz.utility.Utility.Utility', 'Utility', ([], {}), '()\n', (177, 179), False, 'from com.bridgelabz.utility.Utility import Utility\n')] |
MichaelLeeman/Job_Web_Scraper | app/main.py | 29205d84f1190830a77174ce8272f4f79bb3468b | # This program scraps data from job postings on the website workinstartups.com and appends it to an excel worksheet.
import os
from datetime import datetime, timedelta
from selenium import webdriver
from app import web_scraper
from app import excel
job_list, last_date = [], None
file_path = os.path.abspath("main.py")... | [((680, 705), 'os.path.isfile', 'os.path.isfile', (['file_path'], {}), '(file_path)\n', (694, 705), False, 'import os\n'), ((1643, 1699), 'app.web_scraper.soup_creator', 'web_scraper.soup_creator', (['URL'], {'max_retry': '(1)', 'sleep_time': '(0)'}), '(URL, max_retry=1, sleep_time=0)\n', (1667, 1699), False, 'from app... |
kapkic/native_client | src/trusted/validator_arm/dgen_output.py | 51c8bc8c249d55606232ae011bdfc8b4cab3d794 | #!/usr/bin/python2
#
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""
Some common boilerplates and helper functions for source code generation
in files dgen_test_output.py and dgen_decode_out... | [] |
ChristopherBrix/Debona | src/data_loader/input_data_loader.py | f000f3d483b2cc592233d0ba2a1a0327210562c8 |
"""
Functions for loading input data.
Author: Patrick Henriksen <patrick@henriksen.as>
"""
import os
import numpy as np
def load_img(path: str, img_nums: list, shape: tuple) -> np.array:
"""
Loads a image in the human-readable format.
Args:
path:
The path to the to the folder with... | [((2156, 2187), 'numpy.zeros', 'np.zeros', (['num_images'], {'dtype': 'int'}), '(num_images, dtype=int)\n', (2164, 2187), True, 'import numpy as np\n'), ((2095, 2115), 'numpy.prod', 'np.prod', (['image_shape'], {}), '(image_shape)\n', (2102, 2115), True, 'import numpy as np\n'), ((845, 859), 'numpy.array', 'np.array', ... |
hirokiyaginuma/scriptspinner-software | ui_splash_screen.py | 87185f237f76feeee33a2b74a4d05be088bde011 | # -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'splash_screen.ui'
##
## Created by: Qt User Interface Compiler version 5.15.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
############... | [] |
tedye/leetcode | tools/leetcode.112.Path Sum/leetcode.112.Path Sum.submission10.py | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param {TreeNode} root
# @param {integer} sum
# @return {boolean}
def hasPathSum(self, root, sum):
if not root: ret... | [] |
danbirken/pandas | pandas/io/sql.py | fa8a5ca1dd27c4169727070ddbdcb248002fddb4 | """
Collection of query wrappers / abstractions to both facilitate data
retrieval and to reduce dependency on DB-specific API.
"""
from __future__ import print_function, division
from datetime import datetime, date, timedelta
import warnings
import traceback
import itertools
import re
import numpy as np
import pandas... | [((4112, 4265), 'warnings.warn', 'warnings.warn', (['"""tquery is depreciated, and will be removed in future versions. You can use ``execute(...).fetchall()`` instead."""', 'FutureWarning'], {}), "(\n 'tquery is depreciated, and will be removed in future versions. You can use ``execute(...).fetchall()`` instead.'\n ... |
kkcookies99/UAST | Dataset/Leetcode/train/58/28.py | fff81885aa07901786141a71e5600a08d7cb4868 | class Solution:
def XXX(self, s):
"""
:type s: str
:rtype: int
"""
cnt, tail = 0, len(s) - 1
while tail >= 0 and s[tail] == ' ':
tail -= 1
while tail >= 0 and s[tail] != ' ':
cnt += 1
tail -= 1
return cnt
| [] |
ZytroCode/Systerm | Systerm/meta.py | 688b1a9eab51ec2d2fcc8e921d57ae4ae585a1b7 | """Meta is a module contains objects that will customize the behavior of python."""
from abc import ABC
from abc import ABCMeta
from abc import abstractmethod
from typing import Any
from typing import Callable
import Systerm
# Metaclass
class Metaclass(ABCMeta):
"""A metaclass to customize the behavior of all cla... | [((4295, 4308), 'Systerm._setup.init_module', 'init_module', ([], {}), '()\n', (4306, 4308), False, 'from Systerm._setup import init_module\n')] |
iqsarv/CCF | samples/apps/txregulator/tests/txregulatorclient.py | 5cc33a1f0e06eb2a25dc1ebd0e2153881962b889 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
import infra.e2e_args
import infra.ccf
import infra.jsonrpc
import logging
from time import gmtime, strftime
import csv
import random
from loguru import logger as LOG
class AppUser:
def __init__(self, network, n... | [((8939, 9005), 'loguru.logger.success', 'LOG.success', (['f"""{tx_id} transactions have been successfully issued"""'], {}), "(f'{tx_id} transactions have been successfully issued')\n", (8950, 9005), True, 'from loguru import logger as LOG\n'), ((1723, 1740), 'csv.DictReader', 'csv.DictReader', (['f'], {}), '(f)\n', (1... |
davidcortesortuno/finmag | src/finmag/sim/hysteresis.py | 9ac0268d2c0e45faf1284cee52a73525aa589e2b | import os
import re
import glob
import logging
import textwrap
import fileinput
import numpy as np
from finmag.energies import Zeeman
from finmag.util.helpers import norm
log = logging.getLogger(name="finmag")
def hysteresis(sim, H_ext_list, fun=None, **kwargs):
"""
Set the applied field to the first value i... | [((178, 210), 'logging.getLogger', 'logging.getLogger', ([], {'name': '"""finmag"""'}), "(name='finmag')\n", (195, 210), False, 'import logging\n'), ((2339, 2356), 'finmag.energies.Zeeman', 'Zeeman', (['(0, 0, 0)'], {}), '((0, 0, 0))\n', (2345, 2356), False, 'from finmag.energies import Zeeman\n'), ((4498, 4517), 'nump... |
smokedpirate/Encryption-hash-generator | uiSetup.py | 47bf3f1f6b6b24ca3e9078fefe46b1e6409d59e5 |
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5 import QtGui, QtCore
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(577, 341)
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(255, 255... | [((39511, 39543), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (39533, 39543), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((39562, 39585), 'PyQt5.QtWidgets.QMainWindow', 'QtWidgets.QMainWindow', ([], {}), '()\n', (39583, 39585), False, 'from PyQt5 import QtC... |
wjh112233/yxtx | yxtx/myApp/migrations/0017_chat.py | f118c2b9983ca48b099f2c328487e23f5430303f | # Generated by Django 3.0.2 on 2020-03-17 08:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myApp', '0016_usergroup_buyer'),
]
operations = [
migrations.CreateModel(
name='Chat',
fields=[
('id... | [((323, 389), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(31)', 'primary_key': '(True)', 'serialize': '(False)'}), '(max_length=31, primary_key=True, serialize=False)\n', (339, 389), False, 'from django.db import migrations, models\n'), ((421, 455), 'django.db.models.CharField', 'models.Char... |
willingc/oh-missions-oppia-beta | core/controllers/services.py | 3d97903a5155ec67f135b1aa2c02f3bb39eb02e7 | # Copyright 2012 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 ... | [((960, 994), 'base64.b64encode', 'base64.b64encode', (['raw_file_content'], {}), '(raw_file_content)\n', (976, 994), False, 'import base64\n'), ((1178, 1198), 'json.dumps', 'json.dumps', (['response'], {}), '(response)\n', (1188, 1198), False, 'import json\n')] |
hebinhuang/batch-shipyard | convoy/crypto.py | f87d94850380bee273eb51c5c35381952a5722b8 | # Copyright (c) Microsoft Corporation
#
# All rights reserved.
#
# MIT License
#
# 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... | [((1701, 1728), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1718, 1728), False, 'import logging\n'), ((1902, 1975), 'collections.namedtuple', 'collections.namedtuple', (['"""PfxSettings"""', "['filename', 'passphrase', 'sha1']"], {}), "('PfxSettings', ['filename', 'passphrase', 'sha1'... |
lj-ecjtu/Cascade_FPN_Tensorflow-master | libs/configs/COCO/cfgs_res50_1x_coco_v3.py | 40fcd2c10f057b3f015ca1380d7db102e967391f | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import tensorflow as tf
'''
gluoncv backbone + multi_gpu
'''
# ------------------------------------------------
VERSION = 'Cascade_FPN_Res50_COCO_1x_20190421_v3'
NET_NAME = 'resnet50_v1d'
ADD_BOX_IN_TENSORBOARD = True
... | [((389, 411), 'os.path.abspath', 'os.path.abspath', (['"""../"""'], {}), "('../')\n", (404, 411), False, 'import os\n'), ((1096, 1145), 'os.path.join', 'os.path.join', (['ROOT_PATH', '"""output/trained_weights"""'], {}), "(ROOT_PATH, 'output/trained_weights')\n", (1108, 1145), False, 'import os\n'), ((2554, 2605), 'ten... |
vibhaska/delta | python/delta/tests/test_exceptions.py | 0e16356ff46520404e2376d048f002ca74f6dc0c | #
# Copyright (2020) The Delta Lake Project 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 ag... | [((3005, 3054), 'unittest.main', 'unittest.main', ([], {'testRunner': 'testRunner', 'verbosity': '(4)'}), '(testRunner=testRunner, verbosity=4)\n', (3018, 3054), False, 'import unittest\n'), ((2884, 2950), 'xmlrunner.XMLTestRunner', 'xmlrunner.XMLTestRunner', ([], {'output': '"""target/test-reports"""', 'verbosity': '(... |
nikhilsamninan/python-files | day10/samematrix.py | 15198459081097058a939b40b5e8ef754e578fe0 | def matrix_form():
r = int(input("Enter the no of rows"))
c = int(input("Enter the no of columns"))
matrix=[]
print("Enter the enteries")
for i in range(r):
a = []
for j in range(c):
a.append(int(input()))
matrix.append(a)
return(matrix)
def check_matrix(fi... | [] |
PatrickJReed/Longboard | extractFeatures.py | f6ca4a6e51c91296894aee2e02b86f83b38c080a | #!/home/ubuntu/miniconda2/bin/python
from __future__ import division
import sys
import glob, os, gc
import uuid
import os.path
import csv
import numpy as np
from time import time
from subprocess import (call, Popen, PIPE)
from itertools import product
import shutil
import re
import pickle
from boto3.session import Ses... | [] |
mdbernard/astrodynamics | kepler.py | cf98df6cd17086e3675c1f7c2fce342d5322ee51 | import numpy as np
from stumpff import C, S
from CelestialBody import BODIES
from numerical import newton, laguerre
from lagrange import calc_f, calc_fd, calc_g, calc_gd
def kepler_chi(chi, alpha, r0, vr0, mu, dt):
''' Kepler's Equation of the universal anomaly, modified
for use in numerical solvers. '''
... | [((953, 957), 'stumpff.S', 'S', (['z'], {}), '(z)\n', (954, 957), False, 'from stumpff import C, S\n'), ((2171, 2190), 'numpy.linalg.norm', 'np.linalg.norm', (['r_0'], {}), '(r_0)\n', (2185, 2190), True, 'import numpy as np\n'), ((2235, 2254), 'numpy.linalg.norm', 'np.linalg.norm', (['v_0'], {}), '(v_0)\n', (2249, 2254... |
jkrueger1/nicos | nicos_demo/vpgaa/setups/pgai.py | 5f4ce66c312dedd78995f9d91e8a6e3c891b262b | description = 'PGAA setup with XYZOmega sample table'
group = 'basic'
sysconfig = dict(
datasinks = ['mcasink', 'chnsink', 'csvsink', 'livesink']
)
includes = [
'system',
'reactor',
'nl4b',
'pressure',
'sampletable',
'pilz',
'detector',
'collimation',
]
devices = dict(
mcasin... | [] |
ravikumarvc/incubator-tvm | tests/python/relay/test_op_level2.py | 9826947ffce0ed40e9d47a0db2abb033e394279e | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [((1217, 1231), 'tvm.relay.var', 'relay.var', (['"""w"""'], {}), "('w')\n", (1226, 1231), False, 'from tvm import relay\n'), ((1240, 1304), 'tvm.relay.nn.conv1d', 'relay.nn.conv1d', (['x', 'w'], {'kernel_size': '(3)', 'padding': '(1, 1)', 'channels': '(2)'}), '(x, w, kernel_size=3, padding=(1, 1), channels=2)\n', (1255... |
hjkim-haga/TF-OD-API | official/nlp/transformer/utils/tokenizer_test.py | 22ac477ff4dfb93fe7a32c94b5f0b1e74330902b | # Copyright 2021 The TensorFlow 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... | [((6843, 6857), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (6855, 6857), True, 'import tensorflow as tf\n'), ((907, 948), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)'}), '(delete=False)\n', (934, 948), False, 'import tempfile\n'), ((1110, 1168), 'official.nlp.tr... |
bcgov/court-of-appeal | api/api/form7_searching_utils/__init__.py | ef773b1baa80d3aff1ac807ed01f59266d885955 | from .form7_search import Form7Search
from .parse_form7 import Form7Parsing
| [] |
JackDan9/soil | soil/build/lib/soil/openstack/snapshot.py | ae612a4634634aace834491fbdefbc69e6167674 | # Copyright 2020 Soil, Inc.
from soil.openstack.base import DataBase
from soil.openstack.base import SourceBase
class SnapshotData(DataBase):
"""A class for openstack snapshot data"""
def __init__(self, data):
self.data = data['snapshot']
class Snapshot(SourceBase):
"""A class for openstac... | [] |
dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | Z - Tool Box/LaZagne/Windows/lazagne/softwares/windows/ppypykatz.py | 1dcf54522e9d20711ff1114550dc2893ed3e9ed0 | # -*- coding: utf-8 -*-
# Thanks to @skelsec for his awesome tool Pypykatz
# Checks his project here: https://github.com/skelsec/pypykatz
import codecs
import traceback
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import constant
from pypykatz.pypykatz import pypykatz
... | [((579, 647), 'lazagne.config.module_info.ModuleInfo.__init__', 'ModuleInfo.__init__', (['self', '"""pypykatz"""', '"""windows"""'], {'system_module': '(True)'}), "(self, 'pypykatz', 'windows', system_module=True)\n", (598, 647), False, 'from lazagne.config.module_info import ModuleInfo\n'), ((725, 743), 'pypykatz.pypy... |
mglukhovsky/beets | test/test_discogs.py | 889e30c056a609cf71c8c8200259520230545222 | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | [((14946, 14980), 'unittest.main', 'unittest.main', ([], {'defaultTest': '"""suite"""'}), "(defaultTest='suite')\n", (14959, 14980), False, 'import unittest\n'), ((7139, 7154), 'beetsplug.discogs.DiscogsPlugin', 'DiscogsPlugin', ([], {}), '()\n', (7152, 7154), False, 'from beetsplug.discogs import DiscogsPlugin\n'), ((... |
hank-chou/python | data_structures/queue/queue_on_pseudo_stack.py | a9f729fa263bce599d2774f3f6afb5a18bcc9862 | """Queue represented by a pseudo stack (represented by a list with pop and append)"""
class Queue:
def __init__(self):
self.stack = []
self.length = 0
def __str__(self):
printed = "<" + str(self.stack)[1:-1] + ">"
return printed
"""Enqueues {@code item}
@param item
... | [] |
nihui/gen-ncnn-models | darknet2ncnn.py | 18523f1920d9afc44ce3058087c07e09f28aa151 | #! /usr/bin/env python
# coding: utf-8
import configparser
import numpy as np
import re,sys,os
from graph import MyGraph
from collections import OrderedDict
def unique_config_sections(config_file):
"""Convert all config sections to have unique names.
Adds unique suffixes to config sections for compability wi... | [((422, 438), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (433, 438), False, 'from collections import defaultdict\n'), ((459, 472), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (470, 472), False, 'import io\n'), ((1364, 1391), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {})... |
anirudha-bs/Django_music_app | music/models.py | 1b80bd4299a35fb707c32307dd115074a8ecba9f | from django.contrib.auth.models import Permission, User
from django.db import models
class Album(models.Model):
user = models.ForeignKey(User, default=1,on_delete=models.CASCADE)
artist = models.CharField(max_length=250)
album_title = models.CharField(max_length=500)
genre = models.CharField(max_lengt... | [((125, 185), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'default': '(1)', 'on_delete': 'models.CASCADE'}), '(User, default=1, on_delete=models.CASCADE)\n', (142, 185), False, 'from django.db import models\n'), ((198, 230), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250... |
yihming/gdax-data | finex_history.py | 7e562f314e9ef12eb6be2df3b97190af632c4530 | import datetime
import calendar
import requests
import pandas as pd
import json
import os.path
import time
import MySQLdb as M
from gdax_history import timestamp_to_utcstr
def connect_to_db():
config = json.load(open('dbconn.json'))["mysql"]
db = M.connect(host = config["host"],
user = conf... | [] |
cvelas31/public_transportation_streaming | src/producers/connector.py | 903a1a147645e1b0783555db4bfc02098f7941ae | """Configures a Kafka Connector for Postgres Station data"""
import json
import logging
import requests
from settings import Settings
logger = logging.getLogger(__name__)
KAFKA_CONNECT_URL = f"{Settings.URLs.KAFKA_CONNECT_URL}/connectors"
CONNECTOR_NAME = "stations"
def configure_connector():
"""Starts and co... | [((145, 172), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (162, 172), False, 'import logging\n'), ((364, 428), 'logging.debug', 'logging.debug', (['"""Creating or updating kafka connect connector..."""'], {}), "('Creating or updating kafka connect connector...')\n", (377, 428), False, ... |
wasiahmad/GATE | liuetal2019/utils.py | 1e48504a3641f00265a271a19eb6b6449fdc33bd | import io
import logging
import json
import numpy
import torch
import numpy as np
from tqdm import tqdm
from clie.inputters import constant
from clie.objects import Sentence
from torch.utils.data import Dataset
from torch.utils.data.sampler import Sampler
logger = logging.getLogger(__name__)
def load_word_embeddings... | [((266, 293), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (283, 293), False, 'import logging\n'), ((364, 431), 'io.open', 'io.open', (['file', '"""r"""'], {'encoding': '"""utf-8"""', 'newline': '"""\n"""', 'errors': '"""ignore"""'}), "(file, 'r', encoding='utf-8', newline='\\n', errors... |
dnanexus/IndexTools | build.py | 0392b3be92ff50b401290b59e9ca6c7767fa5a96 | from distutils.extension import Extension
cmdclass = {}
try:
# with Cython
from Cython.Build import build_ext
cmdclass["build_ext"] = build_ext
module_src = "cgranges/python/cgranges.pyx"
except ImportError: # without Cython
module_src = "cgranges/python/cgranges.c"
def build(setup_kwargs):
... | [((479, 666), 'distutils.extension.Extension', 'Extension', (['"""cgranges"""'], {'sources': "[module_src, 'cgranges/cgranges.c']", 'depends': "['cgranges/cgranges.h', 'cgranges/khash.h', 'cgranges/python/cgranges.pyx']", 'include_dirs': "['cgranges']"}), "('cgranges', sources=[module_src, 'cgranges/cgranges.c'], depen... |
oascigil/icarus_edge_comp | icarus/models/service/__init__.py | b7bb9f9b8d0f27b4b01469dcba9cfc0c4949d64b | # -*- coding: utf-8 -*-
from .compSpot import *
| [] |
YvetteGuo/gluon-cv | gluoncv/data/kinetics400/classification.py | 123af8cf9f15a879c16a5c7d12f01ce1471d85b6 | # pylint: disable=line-too-long,too-many-lines,missing-docstring
"""Kinetics400 action classification dataset."""
import os
import random
import numpy as np
from mxnet import nd
from mxnet.gluon.data import dataset
__all__ = ['Kinetics400']
class Kinetics400(dataset.Dataset):
"""Load the Kinetics400 action recogn... | [((2448, 2541), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.mxnet/datasets/kinetics400/kinetics400_train_list_rawframes.txt"""'], {}), "(\n '~/.mxnet/datasets/kinetics400/kinetics400_train_list_rawframes.txt')\n", (2466, 2541), False, 'import os\n'), ((2560, 2627), 'os.path.expanduser', 'os.path.expanduser'... |
webclinic017/qf-lib | qf_lib/containers/futures/future_contract.py | 96463876719bba8a76c8269cef76addf3a2d836d | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | [] |
ajaytikoo/watcher | watcher/api/controllers/v1/action_plan.py | 6dbac1f6ae7f3e10dfdcef5721fa4af7af54e159 | # -*- encoding: utf-8 -*-
# Copyright 2013 Red Hat, 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 re... | [((3265, 3288), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (3278, 3288), False, 'from oslo_log import log\n'), ((7961, 8001), 'wsme.types.wsattr', 'wtypes.wsattr', (['types.uuid'], {'readonly': '(True)'}), '(types.uuid, readonly=True)\n', (7974, 8001), True, 'from wsme import types a... |
jeonginlee/groove_scheduler | controllers/albums.py | 84e61834e940e2ff138ffeeea61fd301f3c2a244 | from flask import *
albums = Blueprint('albums', __name__, template_folder='templates')
@albums.route('/albums/edit')
def albums_edit_route():
options = {
"edit": True
}
return render_template("albums.html", **options)
@albums.route('/albums')
def albums_route():
options = {
"edit": False
}
return render_... | [] |
sn0b4ll/Incident-Playbook | Incident-Response/Tools/dfirtrack/dfirtrack_main/views/division_views.py | cf519f58fcd4255674662b3620ea97c1091c1efb | from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import redirect, render
from django.urls import reverse
from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, UpdateView
from dfirtrack_main.forms import ... | [((757, 799), 'dfirtrack_main.models.Division.objects.order_by', 'Division.objects.order_by', (['"""division_name"""'], {}), "('division_name')\n", (782, 799), False, 'from dfirtrack_main.models import Division\n'), ((1548, 1599), 'django.shortcuts.render', 'render', (['request', 'self.template_name', "{'form': form}"]... |
shark803/Torch_serve_example_NLP | run.py | 7f7984a1668f21aced3a7a1e8ddac3c8e0ff0105 | # coding: UTF-8
import time
import torch
import numpy as np
from train_eval import train, init_network
from importlib import import_module
import argparse
parser = argparse.ArgumentParser(description='Chinese Text Classification')
parser.add_argument('--model', type=str, required=True, help='choose a model: TextCNN')
... | [((165, 231), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Chinese Text Classification"""'}), "(description='Chinese Text Classification')\n", (188, 231), False, 'import argparse\n'), ((820, 857), 'importlib.import_module', 'import_module', (["('models.' + model_name)"], {}), "('models... |
xhub/pretalx | src/tests/cfp/views/test_cfp_user.py | 33bd07ec98ddeb5b7ff35fe7e30c4d38bef57d7e | import pytest
from django.conf import settings
from django.core import mail as djmail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse
from django_scopes import scope
from rest_framework.authtoken.models import Token
from pretalx.submission.models import SubmissionStates
... | [((18623, 18685), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""request_availability"""', '(True, False)'], {}), "('request_availability', (True, False))\n", (18646, 18685), False, 'import pytest\n'), ((13683, 13734), 'django.core.files.uploadedfile.SimpleUploadedFile', 'SimpleUploadedFile', (['"""testfil... |
vasilydenisenko/modbus_rtu_slave | tests/mb_util.py | 8a531b776ab82c60b5d335f0565468f19a7801f5 | # MIT License
# Copyright (c) 2021 Vasily Denisenko, Sergey Kuznetsov
# 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
# t... | [((1630, 1663), 'mb_bsp.wait_master_status', 'mb_bsp.wait_master_status', (['status'], {}), '(status)\n', (1655, 1663), False, 'import mb_bsp\n'), ((4129, 4153), 'mb_bsp.get_error_count', 'mb_bsp.get_error_count', ([], {}), '()\n', (4151, 4153), False, 'import mb_bsp\n'), ((4498, 4522), 'mb_bsp.get_error_count', 'mb_bs... |
tjsavage/polymer-dashboard | modules/stackoverflow/models.py | 19bc467f1206613f8eec646b6f2bc43cc319ef75 | import fix_path
import json
import datetime
from google.appengine.ext import ndb
# Taken from http://stackoverflow.com/questions/455580/json-datetime-between-python-and-javascript
dthandler = lambda obj: (
obj.isoformat()
if isinstance(obj, datetime.datetime)
or isinstance(obj, datetime.date)
else Non... | [((409, 463), 'google.appengine.ext.ndb.DateTimeProperty', 'ndb.DateTimeProperty', ([], {'required': '(True)', 'auto_now_add': '(True)'}), '(required=True, auto_now_add=True)\n', (429, 463), False, 'from google.appengine.ext import ndb\n'), ((485, 520), 'google.appengine.ext.ndb.DateTimeProperty', 'ndb.DateTimeProperty... |
sonymoon/algorithm | src/main/java/com/bailei/study/beautyOfCoding/cpu50.py | cc2a9e0125fc64bdbf6549034bad6482d2027ea2 | #!/usr/bin/python3
# -*- coding: UTF-8 -*-
import time
busyTime = 10
idleTime = busyTime
while True:
start = time.clock()
while time.clock() - start < busyTime:
pass
time.sleep(busyTime / 1000)
| [((117, 129), 'time.clock', 'time.clock', ([], {}), '()\n', (127, 129), False, 'import time\n'), ((190, 217), 'time.sleep', 'time.sleep', (['(busyTime / 1000)'], {}), '(busyTime / 1000)\n', (200, 217), False, 'import time\n'), ((140, 152), 'time.clock', 'time.clock', ([], {}), '()\n', (150, 152), False, 'import time\n'... |
danicarrion/carto-python | carto/maps.py | 631b018f065960baa35473e2087ce598560b9e17 | """
Module for working with named and anonymous maps
.. module:: carto.maps
:platform: Unix, Windows
:synopsis: Module for working with named and anonymous maps
.. moduleauthor:: Daniel Carrion <daniel@carto.com>
.. moduleauthor:: Alberto Romeu <alrocar@carto.com>
"""
try:
from urllib.parse import urljoi... | [((2425, 2491), 'urlparse.urljoin', 'urljoin', (['base_url', '"""{template_id}/{layer}/attributes/{feature_id}"""'], {}), "(base_url, '{template_id}/{layer}/attributes/{feature_id}')\n", (2432, 2491), False, 'from urlparse import urljoin\n'), ((3836, 3876), 'urlparse.urljoin', 'urljoin', (['url', '"""?auth_token={auth_... |
tlagore/kv_store | client_driver.py | e3f139eabaa14d0e001193e21baf7e5c96e0358d | from kv_client.kv_client import KVClient
def main():
kvSlave = KVClient(1, "127.0.0.1", 3456)
kvSlave.start()
if __name__ == "__main__":
main() | [((68, 98), 'kv_client.kv_client.KVClient', 'KVClient', (['(1)', '"""127.0.0.1"""', '(3456)'], {}), "(1, '127.0.0.1', 3456)\n", (76, 98), False, 'from kv_client.kv_client import KVClient\n')] |
AndreasKaratzas/stonne | pytorch-frontend/benchmarks/operator_benchmark/pt/embeddingbag_test.py | 2915fcc46cc94196303d81abbd1d79a56d6dd4a9 | import operator_benchmark as op_bench
import torch
import numpy
from . import configs
"""EmbeddingBag Operator Benchmark"""
class EmbeddingBagBenchmark(op_bench.TorchBenchmarkBase):
def init(self, embeddingbags, dim, mode, input_size, offset, sparse, include_last_offset, device):
self.embedding = torch.nn... | [((963, 1051), 'operator_benchmark.generate_pt_test', 'op_bench.generate_pt_test', (['configs.embeddingbag_short_configs', 'EmbeddingBagBenchmark'], {}), '(configs.embeddingbag_short_configs,\n EmbeddingBagBenchmark)\n', (988, 1051), True, 'import operator_benchmark as op_bench\n'), ((1048, 1145), 'operator_benchmar... |
lfchener/dgl | python/dgl/geometry/capi.py | 77f4287a4118db64c46f4f413a426e1419a09d53 | """Python interfaces to DGL farthest point sampler."""
from dgl._ffi.base import DGLError
import numpy as np
from .._ffi.function import _init_api
from .. import backend as F
from .. import ndarray as nd
def _farthest_point_sampler(data, batch_size, sample_points, dist, start_idx, result):
r"""Farthest Point Samp... | [((3538, 3569), 'dgl._ffi.base.DGLError', 'DGLError', (['"""Find unmatched node"""'], {}), "('Find unmatched node')\n", (3546, 3569), False, 'from dgl._ffi.base import DGLError\n'), ((3813, 3858), 'numpy.unique', 'np.unique', (['node_label_np'], {'return_inverse': '(True)'}), '(node_label_np, return_inverse=True)\n', (... |
oxdc/sci.db | scidb/core/data.py | 0a751a0e05e7ad4c83c350e32e32ea9ce5831cbb | import shutil
import hashlib
from pathlib import Path
from typing import TextIO, BinaryIO, IO, Union
from datetime import datetime
from os.path import getmtime
from .low import ObservableDict
class Data:
def __init__(self, data_name: str, parent, bucket,
protected_parent_methods: Union[None, dict... | [((4878, 4891), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (4889, 4891), False, 'import hashlib\n'), ((5555, 5569), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (5567, 5569), False, 'import hashlib\n'), ((6244, 6260), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (6258, 6260), False, 'import hashlib\n... |
PaulWang1905/tensorflow | tensorflow/python/keras/optimizer_v2/optimizer_v2.py | ebf12d22b4801fb8dab5034cc94562bf7cc33fa0 | # Copyright 2018 The TensorFlow 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 applica... | [((2908, 2938), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (2925, 2938), False, 'import six\n'), ((2940, 2982), 'tensorflow.python.util.tf_export.keras_export', 'keras_export', (['"""keras.optimizers.Optimizer"""'], {}), "('keras.optimizers.Optimizer')\n", (2952, 2982), False, '... |
danielrosendos/djangoRestFramework | escola/teste_get.py | 946bb95b8dd9976d1920302ce724572ffd9f98cf | import requests
headers = {
'content-type': 'application/json',
'Authorization': 'Token 80ca9f249b80e7226cdc7fcaada8d7297352f0f9'
}
url_base_cursos = 'http://127.0.0.1:8000/api/v2/cursos'
url_base_avaliacoes = 'http://127.0.0.1:8000/api/v2/avaliacoes'
resultado = requests.get(url=url_base_cursos, headers=hea... | [((275, 325), 'requests.get', 'requests.get', ([], {'url': 'url_base_cursos', 'headers': 'headers'}), '(url=url_base_cursos, headers=headers)\n', (287, 325), False, 'import requests\n')] |
aaronjwood/alb-sdk | python/avi/sdk/utils/waf_policy/vdi_waf_policy.py | ae4c47b2228651d3f5095e7c14f081aa4adbb732 | # Copyright 2021 VMware, Inc.
import argparse
import json
import re
import logging
import os
import sys
from avi.sdk.avi_api import ApiSession
API_VERSION = "18.2.13"
SYSTEM_WAF_POLICY_VDI='System-WAF-Policy-VDI'
logger = logging.getLogger(__name__)
def add_allowlist_rule(waf_policy_obj):
#add a allowlist rule... | [((226, 253), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (243, 253), False, 'import logging\n'), ((1465, 1509), 're.compile', 're.compile', (['"""[^\\\\d]*(?P<group_id>\\\\d\\\\d\\\\d)"""'], {}), "('[^\\\\d]*(?P<group_id>\\\\d\\\\d\\\\d)')\n", (1475, 1509), False, 'import re\n'), ((51... |
Chace-wang/bk-user | src/api/bkuser_core/tests/bkiam/test_constants.py | 057f270d66a1834312306c9fba1f4e95521f10b1 | # -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the Lic... | [((978, 1404), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""is_leaf, path, f, v"""', "[(True, '/category,5/department,3440/department,3443/', 'parent_id', 3443),\n (False, '/category,5/department,3440/department,3443/', 'id', 3443), (\n True, '/category,5/', 'category_id', 5), (False, '/category,5/... |
johnh865/election_sim | votesim/benchmarks/__init__.py | b73b7e65f1bb22abb82cbe8442fcf02b0c20894e | # from votesim.benchmarks.benchrunner import (
# run_benchmark,
# get_benchmarks,
# post_benchmark,
# plot_benchmark,
# )
from votesim.benchmarks import runtools, simple | [] |
MrIgumnov96/ETL-CloudDeployment | src/handler.py | 666b85a9350460fba49f82ec90f5cddc0bdd0235 | import boto3
import src.app as app
import csv
import psycopg2 as ps
import os
from dotenv import load_dotenv
load_dotenv()
dbname = os.environ["db"]
host = os.environ["host"]
port = os.environ["port"]
user = os.environ["user"]
password = os.environ["pass"]
connection = ps.connect(dbname=dbname,
... | [((111, 124), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (122, 124), False, 'from dotenv import load_dotenv\n'), ((273, 350), 'psycopg2.connect', 'ps.connect', ([], {'dbname': 'dbname', 'host': 'host', 'port': 'port', 'user': 'user', 'password': 'password'}), '(dbname=dbname, host=host, port=port, user=user... |
cpelley/improver | improver_tests/precipitation_type/test_utilities.py | ebf77fe2adc85ed7aec74c26671872a2e4388ded | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | [((2118, 2141), 'numpy.arange', 'np.arange', (['n_thresholds'], {}), '(n_thresholds)\n', (2127, 2141), True, 'import numpy as np\n'), ((2238, 2271), 'numpy.ones', 'np.ones', (['shape'], {'dtype': 'FLOAT_DTYPE'}), '(shape, dtype=FLOAT_DTYPE)\n', (2245, 2271), True, 'import numpy as np\n'), ((2283, 2427), 'improver.synth... |
bryan-munene/Store-Manager-DB | app/api/v1/models/items.py | 40b24039189aea6854d7fcf33ccb648bb6642231 | from .db_conn import ModelSetup
class ItemsModel(ModelSetup):
'''Handles the data logic of the items section'''
def __init__(
self,
name=None,
price=None,
quantity=None,
category_id=None,
reorder_point=None,
auth=None):
... | [] |
linxGnu/armeria | site/src/sphinx/_extensions/api.py | 7f4b10e66acc377dd16929157aeb417b729ce55a | from docutils.parsers.rst.roles import register_canonical_role, set_classes
from docutils.parsers.rst import directives
from docutils import nodes
from sphinx.writers.html import HTMLTranslator
from sphinx.errors import ExtensionError
import os
import re
def api_role(role, rawtext, text, lineno, inliner, options={},... | [((694, 714), 'docutils.parsers.rst.roles.set_classes', 'set_classes', (['options'], {}), '(options)\n', (705, 714), False, 'from docutils.parsers.rst.roles import register_canonical_role, set_classes\n'), ((841, 929), 'docutils.nodes.literal', 'nodes.literal', (['rawtext', 'text'], {'classes': 'classes', 'api_referenc... |
tsuru/varnishapi | feaas/runners/__init__.py | d63a8c8c5f9c837855509fc5af59d8213c1c91d6 | # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import time
from feaas import storage
class Base(object):
def __init__(self, manager, interval, *locks):
self.manager = manager
self.st... | [((440, 473), 'feaas.storage.MultiLocker', 'storage.MultiLocker', (['self.storage'], {}), '(self.storage)\n', (459, 473), False, 'from feaas import storage\n'), ((663, 688), 'time.sleep', 'time.sleep', (['self.interval'], {}), '(self.interval)\n', (673, 688), False, 'import time\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.