repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
zuhalcakir/simone | simone/person/management.py | 88e04e6a228570d7d2a4c8bbf683e4903eeb592b | #from django.dispatch import dispatcher
#def UserProfilePostInsert(sender, instance, signal, *args, **kwargs):
#"""
#Inserts a blank imap server entry (if necessary) and associates it with the user
#"""
#user = instance
#i = user.get_profile().imap_servers.create()
#user.get_profile().about = '... | [] |
cog-isa/htm-rl | watcher/fly.py | baf5b67a11283d37165bf6a29d6808a234d6d98c | from utils.drawer import Drawer
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("name", help="the name of the datafile")
parser.add_argument("--size", help="width,height")
args = parser.parse_args()
if args.size is None:
width, height = 128... | [((90, 115), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (113, 115), False, 'import argparse\n')] |
ourobouros/aws-encryption-sdk-python | test/unit/test_structures.py | 1d0e40de7fef1b1131127a6f8626ef6a60739289 | # Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | [((3184, 3207), 'aws_encryption_sdk.structures.MasterKeyInfo', 'MasterKeyInfo', ([], {}), '(**kwargs)\n', (3197, 3207), False, 'from aws_encryption_sdk.structures import DataKey, EncryptedDataKey, MasterKeyInfo, MessageHeader, RawDataKey\n'), ((2590, 2614), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeE... |
CristianLazoQuispe/Datathon-Interbank-2020 | codes/utils/mygraph.py | 54f5d11fe83eb5a8ea8284be13d96e9e12978354 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
path_results = '../results/images/'
# this function receives a dataset with binary target and it will graph a hist of values
def graph_target(data,name="target",figsize=(6,4),title_name=None,color_text="white",save=False,name... | [((354, 381), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (364, 381), True, 'import matplotlib.pyplot as plt\n'), ((583, 615), 'seaborn.countplot', 'sns.countplot', ([], {'x': 'name', 'data': 'data'}), '(x=name, data=data)\n', (596, 615), True, 'import seaborn as sns\n... |
td00/pretix | src/pretix/base/validators.py | e31bd7600c85598de135f2eb5012e2f33fdb1d11 | from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _
class BlacklistValidator:
blacklist = []
def __call__(self, value):
# Validation logic
if value in self.blacklist:
raise... | [((354, 401), 'django.utils.translation.ugettext_lazy', '_', (['"""This slug has an invalid value: %(value)s."""'], {}), "('This slug has an invalid value: %(value)s.')\n", (355, 401), True, 'from django.utils.translation import ugettext_lazy as _\n')] |
gfdb/fortnitepy | fortnitepy/ext/commands/bot.py | 1cedbddee1f81c96fc60b586cd2c16398bc2d45f | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merg... | [((1860, 1887), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1877, 1887), False, 'import logging\n'), ((6699, 6723), 'inspect.getmembers', 'inspect.getmembers', (['self'], {}), '(self)\n', (6717, 6723), False, 'import inspect\n'), ((15769, 15804), 'types.MappingProxyType', 'types.Mappi... |
ChuanleiGuo/AlgorithmsPlayground | LeetCodeSolutions/python/64_Minimum_Path_Sum.py | 90b6287b742c8bfd3797540c408d679be2821a40 | class Solution(object):
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
m, n = len(grid), len(grid[0])
dp = [[0] * n for _ in range(m)]
for i in range(m):
for j in range(n):
if i == 0 and j == 0:
... | [] |
tankbusta/rescache | paths_win.py | 86ca7f3fb66e28a8761f0995a300f57a73a9561d | import _winreg
import os
def get_shared_cache_folder():
"""
Look in the registry for the configured cache folder.
If there is no entry, then we create one.
:return:
"""
_winreg.aReg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
try:
key = _winreg.OpenKey(_winreg.aReg, ... | [((210, 266), '_winreg.ConnectRegistry', '_winreg.ConnectRegistry', (['None', '_winreg.HKEY_CURRENT_USER'], {}), '(None, _winreg.HKEY_CURRENT_USER)\n', (233, 266), False, 'import _winreg\n'), ((779, 838), '_winreg.CreateKey', '_winreg.CreateKey', (['_winreg.aReg', '"""SOFTWARE\\\\CCP\\\\EVEONLINE"""'], {}), "(_winreg.a... |
yuta-komura/vishnu | venv/lib/python3.8/site-packages/dateparser/data/date_translation_data/ebu.py | 67173b674d5f4f3be189474103612447ef69ab44 | # -*- coding: utf-8 -*-
info = {
"name": "ebu",
"date_order": "DMY",
"january": [
"mweri wa mbere",
"mbe"
],
"february": [
"mweri wa kaĩri",
"kai"
],
"march": [
"mweri wa kathatũ",
"kat"
],
"april": [
"mweri wa kana",
"k... | [] |
debatelab/deepa2 | deepa2/preptrain/__init__.py | 1a9e8c357d7e3924808c703ec9f4a6611a4b5f93 | """Preprocessing DeepA2 datasets for LM training"""
# flake8: noqa
from deepa2.preptrain.t2tpreprocessor import T2TPreprocessor
| [] |
martinfarrow/awspk | setup.py | c3b5f8ede44ca96473b95f52ddb2291a45828565 | #!/usr/bin/env python3
from setuptools import setup, find_packages
setup(name='awspk',
version='0.1',
description='A aws cli pen knife with loads of interested stuff',
author='Martin Farrow',
author_email='awspk@dibley.net',
py_modules=['awspk'],
license='LICENSE',
)
| [((69, 281), 'setuptools.setup', 'setup', ([], {'name': '"""awspk"""', 'version': '"""0.1"""', 'description': '"""A aws cli pen knife with loads of interested stuff"""', 'author': '"""Martin Farrow"""', 'author_email': '"""awspk@dibley.net"""', 'py_modules': "['awspk']", 'license': '"""LICENSE"""'}), "(name='awspk', ve... |
JayRovacsek/pyautoclick | pyclicker/lib/python3.7/site-packages/Xlib/display.py | e136a58c129332933eb8455dd7c8e16222d54fb2 | # Xlib.display -- high level display object
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the ... | [((8132, 8164), 'types.MethodType', 'types.MethodType', (['function', 'self'], {}), '(function, self)\n', (8148, 8164), False, 'import types\n'), ((9995, 10031), 'six.create_unbound_method', 'create_unbound_method', (['function', 'cls'], {}), '(function, cls)\n', (10016, 10031), False, 'from six import create_unbound_m... |
KATO-Hiro/AtCoder | Others/qupc/qupc2014/c/main.py | cbbdb18e95110b604728a54aed83a6ed6b993fde | # -*- coding: utf-8 -*-
def main():
from string import ascii_uppercase
n, m, q_large = map(int, input().split())
s = [list(input()) for _ in range(n)]
q = [input() for _ in range(q_large)]
pos = [None for _ in range(26)]
for i in range(n):
for j in range(m):
sij = s[i][j]... | [((477, 502), 'string.ascii_uppercase.index', 'ascii_uppercase.index', (['qi'], {}), '(qi)\n', (498, 502), False, 'from string import ascii_uppercase\n'), ((372, 398), 'string.ascii_uppercase.index', 'ascii_uppercase.index', (['sij'], {}), '(sij)\n', (393, 398), False, 'from string import ascii_uppercase\n')] |
dimddev/NetCatKS-CP | NetCatKS/DProtocol/api/interfaces/subscribers/__init__.py | 2d9e72b2422e344569fd4eb154866b98e9707561 | __author__ = 'dimd'
from zope.interface import Interface, Attribute
class IBaseResourceSubscriber(Interface):
"""
IBaseResourceSubscriber provides functionality for comparison of the signature on
a incoming request against a candidate DProtocol implementation registered as
IJSONResource
The `a... | [((709, 785), 'zope.interface.Attribute', 'Attribute', (['"""The implementer have to provide implementation of IJSONResource"""'], {}), "('The implementer have to provide implementation of IJSONResource')\n", (718, 785), False, 'from zope.interface import Interface, Attribute\n'), ((801, 832), 'zope.interface.Attribute... |
dpedrosac/DBSgait | analysis/notebooks/helper/anova.py | 6df44cf975d43f9e932ef10144bfb7c1b5390b7b | import numpy as np
import pandas as pd
from scipy.stats import f_oneway
from typing import Dict, Tuple, Set
def extract_significant_p(df: pd.DataFrame, p_value_limit: float):
"""Return a df, which replaces values that are above p_value_limit with `None`"""
return (
df.loc(axis=1)[f"p-value"]
... | [((781, 797), 'scipy.stats.f_oneway', 'f_oneway', (['*data_'], {}), '(*data_)\n', (789, 797), False, 'from scipy.stats import f_oneway\n'), ((1924, 1938), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1936, 1938), True, 'import pandas as pd\n'), ((3927, 3941), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\... |
roaldarbol/bux | bux_recorder/utils.py | 356817bbc7139c972d640c64fb8fcba27b70b3f7 | import os
import platform
import time
import csv
import serial
import cv2
import tkinter as tk
from tkinter.filedialog import askdirectory
from serial.tools import list_ports
# From https://raspberrypi.stackexchange.com/a/118473
def is_raspberrypi():
try:
with io.open('/sys/firmware/devicetree/base/model',... | [((495, 512), 'platform.system', 'platform.system', ([], {}), '()\n', (510, 512), False, 'import platform\n'), ((1555, 1581), 'cv2.VideoCapture', 'cv2.VideoCapture', (['dev_port'], {}), '(dev_port)\n', (1571, 1581), False, 'import cv2\n')] |
maechler/a2e | a2e/optimizer/hpbandster/_model_worker.py | c28f546ca5fc3fdb9c740ea5f0f85d2aca044a00 | from hpbandster.core.worker import Worker
from a2e.model import AbstractModel
from a2e.optimizer import EvaluationResultAggregator
from a2e.utility import inf_nan_to_float_max
class ModelWorker(Worker):
def __init__(
self,
model: AbstractModel,
evaluation_result_aggregator: EvaluationResul... | [((1612, 1656), 'a2e.utility.inf_nan_to_float_max', 'inf_nan_to_float_max', (['evaluation_result.cost'], {}), '(evaluation_result.cost)\n', (1632, 1656), False, 'from a2e.utility import inf_nan_to_float_max\n')] |
schissmantics/xagents | xagents/__init__.py | 04f1b96f767903c62138b7d63986f16edfe5f240 | from xagents import a2c, acer, ddpg, dqn, ppo, td3, trpo
from xagents.a2c.agent import A2C
from xagents.acer.agent import ACER
from xagents.base import OffPolicy
from xagents.ddpg.agent import DDPG
from xagents.dqn.agent import DQN
from xagents.ppo.agent import PPO
from xagents.td3.agent import TD3
from xagents.trpo.ag... | [((877, 900), 'xagents.utils.common.register_models', 'register_models', (['agents'], {}), '(agents)\n', (892, 900), False, 'from xagents.utils.common import register_models\n')] |
YonLiud/Israeli-Queue | IsraeliQueue/__init__.py | 53e14e68701c06efdd23ba6584a2e8a561e60cd9 | from .IsraeliQueue import IsraeliQueue, Item, IsraeliQueueByType
| [] |
Este1le/fairseq | examples/MMPT/mmpt_cli/localjob.py | 0fa073e0e0ddd90ff6850588e655c9566bb222ff | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from mmpt.utils import recursive_config
class BaseJob(object):
def __init__(self, yaml_file, dryrun=False):
self.yaml_... | [((359, 386), 'mmpt.utils.recursive_config', 'recursive_config', (['yaml_file'], {}), '(yaml_file)\n', (375, 386), False, 'from mmpt.utils import recursive_config\n'), ((2216, 2255), 'mmpt.utils.load_config', 'load_config', ([], {'config_file': 'self.yaml_file'}), '(config_file=self.yaml_file)\n', (2227, 2255), False, ... |
sdss/tron | tron/Nubs/deprecated/tcc25m-old.py | 886c5c5fb6341ad85e4a9f5d6f5ecb6bbc0d8322 | import os.path
from tron import g, hub
from tron.Hub.Command.Encoders.ASCIICmdEncoder import ASCIICmdEncoder
from tron.Hub.Nub.TCCShellNub import TCCShellNub
from tron.Hub.Reply.Decoders.ASCIIReplyDecoder import ASCIIReplyDecoder
name = 'tcc'
def start(poller):
stop()
initCmds = ('show version', 'show us... | [((547, 616), 'tron.Hub.Reply.Decoders.ASCIIReplyDecoder.ASCIIReplyDecoder', 'ASCIIReplyDecoder', ([], {'EOL': "'\\r'", 'stripChars': '"""\n"""', 'CIDfirst': '(False)', 'debug': '(1)'}), "(EOL='\\r', stripChars='\\n', CIDfirst=False, debug=1)\n", (564, 616), False, 'from tron.Hub.Reply.Decoders.ASCIIReplyDecoder import... |
ptphp/PyLib | src/PtDb/test.py | 07ac99cf2deb725475f5771b123b9ea1375f5e65 | #!/usr/bin/env python
# -*- coding=utf-8 -*-
'''
Created on 2013-3-31
@author: Joseph
'''
import PtDb
if __name__ == '__main__':
PtDb.config = {
'sqlite':{
'type':'sqlite',
'dbname':"data1.db"
},
... | [] |
honzajavorek/oci-cli | services/object_storage/tests/integ/test_object_storage_bulk_operations.py | 6ea058afba323c6b3b70e98212ffaebb0d31985e | # coding: utf-8
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
import filecmp
import json
import pytest
import oci
import services.object_storage.src.oci_cli_object_storage as oci_cli_object_storage
import os
import random
import shutil
import six
import string
from tests import util
fr... | [((1582, 1626), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (1596, 1626), False, 'import pytest\n'), ((1882, 1929), 'oci.object_storage.models.CreateBucketDetails', 'oci.object_storage.models.CreateBucketDetails', ([], {}), '()\n', (1927,... |
yunhaom94/redis-writeanywhere | Extras/benchmark/simple-benchmark.py | 1fefed820811fb89585b2b153d916c3b0fa507a6 | #!/usr/bin/python3
import random
import string
import time
import subprocess
import os
import redis
import threading
def generate_string(string_size, size, dict):
'''
https://stackoverflow.com/questions/16308989/fastest-method-to-generate-big-random-string-with-lower-latin-letters
'''
for i in ran... | [((934, 1009), 'threading.Thread', 'threading.Thread', ([], {'target': 'generate_string', 'args': '(string_size, partition, d1)'}), '(target=generate_string, args=(string_size, partition, d1))\n', (950, 1009), False, 'import threading\n'), ((1021, 1096), 'threading.Thread', 'threading.Thread', ([], {'target': 'generate... |
Widdershin/CodeEval | challenges/015-setintersection.py | c1c769363763d6f7e1ac5bf3707de2731c3bd926 | """
https://www.codeeval.com/browse/30/
Set Intersection
Challenge Description:
You are given two sorted list of numbers (ascending order). The lists
themselves are comma delimited and the two lists are semicolon
delimited. Print out the intersection of these two sets.
Input Sample:
File containin... | [] |
GentleWang1011/eggroll | python/arch/api/table/session.py | 417b029958e0e0ec6f0e1eb03d9ecdf4d5cff47c | #
# Copyright 2019 The FATE 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 appli... | [((2291, 2321), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (2308, 2321), False, 'import six\n'), ((2398, 2414), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (2412, 2414), False, 'import threading\n'), ((1208, 1278), 'arch.api.table.eggroll_util.build_eggroll_session', '... |
Asap7772/rail-rl-franka-eval | experiments/vitchyr/vaes/learn_swirl_vae.py | 4bf99072376828193d05b53cf83c7e8f4efbd3ba | """
VAE on the swirl task.
Basically, VAEs don't work. It's probably because the prior isn't very good
and/or because the learning signal is pretty weak when both the encoder and
decoder change quickly. However, I tried also alternating between the two,
and that didn't seem to help.
"""
from torch.distributions import... | [((621, 670), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': 'batch_size', 'low': '(0)', 'high': 'T'}), '(size=batch_size, low=0, high=T)\n', (638, 670), True, 'import numpy as np\n'), ((3240, 3260), 'railrl.torch.pytorch_util.np_to_var', 'ptu.np_to_var', (['batch'], {}), '(batch)\n', (3253, 3260), True, 'i... |
JosephBushagour/litex | litex/build/openfpgaloader.py | 2b49430f2c53c4a8caa66b678af4660127b546e4 | #
# This file is part of LiteX.
#
# Copyright (c) 2020 Florent Kermarrec <florent@enjoy-digital.fr>
# SPDX-License-Identifier: BSD-2-Clause
from litex.build.tools import write_to_file
from litex.build.generic_programmer import GenericProgrammer
# openFPGAloader --------------------------------------------------------... | [] |
NutriBuddi/NutriBuddi | NutriBuddiAPIServices/ImageClassifier/NutriBuddiClassifier/Classifier/FoodClassifier.py | b4343216cbc99b17a1faf4df50b681465418291f | class FoodClassifier:
#Class Attributes:
#model - the underlying keras model
#labels - the labels to be associated with the activation of each output neuron.
#Labels must be the same size as the output layer of the neural network.
def __init__(self, modelpath, labels, min_confidence =... | [((3487, 3507), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '()\n', (3505, 3507), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((3656, 3673), 'os.listdir', 'listdir', (['location'], {}), '(location)\n', (3663, 3673), False, 'from os import listdir\n'), ((5158... |
freehackquest/libfhqcli-py | freehackquest_libclient_py/__init__.py | 382242943047b63861aad0f41bb89c82e755963c | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 FreeHackQuest Team <freehackquest@gmail.com>
"""This file was automatically generated by fhq-server
Version: v0.2.47
Date: 2022-01-01 07:15:35
"""
from freehackquest_libclient_py.freehackquest_client import FreeHackQuestClient
| [] |
SpiralDevelopment/crypto-hft-data | exchange_sockets/bitstamp_websocket.py | 205f01fd555eab4f636ffbb701dfcde53d27becc | from exchange_sockets.exchange_websocket import ExchangeWebSocket
from singletones.custom_logger import MyLogger
import websocket
import threading
from time import sleep
from time import time
import json
import ssl
logger = MyLogger()
class BitstampWebsocket(ExchangeWebSocket):
def __init__(self, pairs_n_stream... | [((225, 235), 'singletones.custom_logger.MyLogger', 'MyLogger', ([], {}), '()\n', (233, 235), False, 'from singletones.custom_logger import MyLogger\n'), ((1003, 1030), 'websocket.enableTrace', 'websocket.enableTrace', (['(True)'], {}), '(True)\n', (1024, 1030), False, 'import websocket\n'), ((1050, 1212), 'websocket.W... |
katerakelly/pytorch-maml | src/data_loading.py | 75907aca148ad053dfaf75fc138319f0d89534a8 | import numpy as np
import random
import torch
from torch.utils.data import DataLoader
from torch.utils.data.sampler import Sampler
import torchvision.transforms as transforms
from dataset import Omniglot, MNIST
'''
Helpers for loading class-balanced few-shot tasks
from datasets
'''
class ClassBalancedSampler(Sample... | [((2390, 2496), 'torch.utils.data.DataLoader', 'DataLoader', (['dset'], {'batch_size': '(batch_size * task.num_cl)', 'sampler': 'sampler', 'num_workers': '(1)', 'pin_memory': '(True)'}), '(dset, batch_size=batch_size * task.num_cl, sampler=sampler,\n num_workers=1, pin_memory=True)\n', (2400, 2496), False, 'from tor... |
Tal-Shay-Group/DoChaP | DoChaP-db/UnusedScripts/main.py | e721c6742fdff5f771bb947d92fa6cf66831939a | #!/usr/bin/python
import sys
import os
sys.path.append(os.getcwd())
from Director import Director
from OrthologsBuilder import *
from SpeciesDB import *
if __name__ == "__main__":
inputDict = {}
for inarg in sys.argv[1:]:
try:
splitArg = inarg.strip("-").split("=")
if splitArg[... | [((56, 67), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (65, 67), False, 'import os\n'), ((1000, 1010), 'Director.Director', 'Director', ([], {}), '()\n', (1008, 1010), False, 'from Director import Director\n')] |
eigenein/sqlitemap | tests/constants.py | 25846178dee90cfe45a2bc951309301bc7f3694b | # See also: https://stackoverflow.com/questions/3694276/what-are-valid-table-names-in-sqlite
good_table_names = [
'foo',
'123abc',
'123abc.txt',
'123abc-ABC.txt',
'foo""bar',
'😀',
'_sqlite',
]
# See also: https://stackoverflow.com/questions/3694276/what-are-valid-table-names-in-sqlite
bad_... | [] |
amire80/TWLight | TWLight/settings/base.py | 063a385ea46c61a4889ba88e3fded4183c3a6bd3 | # -*- coding: utf-8 -*-
"""
Base settings for twlight project.
This is not intended to be used as the live settings file for a project and will
not work as one. You should instead use production.py, local.py, heroku.py, or
another file that you write. These files should live in the settings directory;
start with 'from... | [((1444, 1473), 'os.environ.get', 'os.environ.get', (['"""TWLIGHT_ENV"""'], {}), "('TWLIGHT_ENV')\n", (1458, 1473), False, 'import os\n'), ((7899, 7927), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (7913, 7927), False, 'import os\n'), ((8305, 8345), 'os.environ.get', 'os.environ.... |
informalsystems/modelator-py | modelator_py/util/tla/_optable.py | d66464096c022799e680e6201590a2ead69be32d | """Table of operators."""
# Copyright 2020 by California Institute of Technology
# Copyright (c) 2008-2013 INRIA and Microsoft Corporation
# All rights reserved. Licensed under 3-clause BSD.
#
# This module is based on the file:
#
# <https://github.com/tlaplus/tlapm/blob/main/src/optable.ml>
#
import pprint
from .ast... | [] |
a1ext/DIE | DIE/UI/FunctionViewEx.py | 1a3a19f016f44cf611847ce4f0d126b136040cb6 | import networkx as nx
from awesome.context import ignored
import sark
import idaapi
import idautils
import idc
from idaapi import PluginForm
from sark.qt import QtGui, QtCore, QtWidgets, form_to_widget, use_qt5
if use_qt5:
_QSortFilterProxyModel = QtCore.QSortFilterProxyModel
_MatchRecursive = QtC... | [((1325, 1396), 'idaapi.PluginForm.Show', 'PluginForm.Show', (['self', '"""Function View"""'], {'options': 'PluginForm.FORM_PERSIST'}), "(self, 'Function View', options=PluginForm.FORM_PERSIST)\n", (1340, 1396), False, 'from idaapi import PluginForm\n'), ((1844, 1864), 'sark.qt.form_to_widget', 'form_to_widget', (['for... |
danerprog/PeerHostedDiscordBot | peerbot/PeerBot.py | 310467d8f123826a20ed92174666beb46fe35d02 | from peerbot.PeerBotStateMachine import PeerBotStateMachine
from utils.Logger import Logger
import discord
class PeerBot(discord.Client):
def __init__(self, args):
self.args = args
self.isBotReady = False
super().__init__()
async def on_ready(self):
stringifiedUse... | [((373, 423), 'utils.Logger.Logger.getLogger', 'Logger.getLogger', (["('PeerBot - ' + stringifiedUserId)"], {}), "('PeerBot - ' + stringifiedUserId)\n", (389, 423), False, 'from utils.Logger import Logger\n')] |
ynang/airflow-jobs-1 | dags/oss_know/oss_know_dags/dags_github/dag_github_init_issues_timeline.py | 857e9dfbc2444dc1d23dd2b0463fe89108f01b89 | from datetime import datetime
from airflow import DAG
from airflow.operators.python import PythonOperator
# v0.0.1
from oss_know.libs.base_dict.variable_key import NEED_INIT_GITHUB_ISSUES_TIMELINE_REPOS, GITHUB_TOKENS, \
OPENSEARCH_CONN_DATA, PROXY_CONFS
from oss_know.libs.util.proxy import KuaiProxyService, Prox... | [((769, 894), 'airflow.operators.python.PythonOperator', 'PythonOperator', ([], {'task_id': '"""op_scheduler_init_github_issues_timeline"""', 'python_callable': 'scheduler_init_github_issues_timeline'}), "(task_id='op_scheduler_init_github_issues_timeline',\n python_callable=scheduler_init_github_issues_timeline)\n"... |
laundry-96/conan | conans/conan.py | fd938f7220ca042d94c42ec5eb607ee69c6785a3 | import sys
from conans.client.command import main
def run():
main(sys.argv[1:])
if __name__ == '__main__':
run()
| [((68, 86), 'conans.client.command.main', 'main', (['sys.argv[1:]'], {}), '(sys.argv[1:])\n', (72, 86), False, 'from conans.client.command import main\n')] |
lunika/richie | tests/apps/persons/test_cms_plugins_person.py | b0b04d0ffc0b16f2f1b8a8201418b8f86941e45f | # -*- coding: utf-8 -*-
"""
Unit tests for the Person plugin and its model
"""
from django import forms
from django.conf import settings
from django.test import TestCase
from cms.api import add_plugin, create_page
from cmsplugin_plain_text.cms_plugins import PlaintextPlugin
from djangocms_picture.cms_plugins import Pi... | [((1176, 1191), 'richie.apps.persons.factories.PersonFactory', 'PersonFactory', ([], {}), '()\n', (1189, 1191), False, 'from richie.apps.persons.factories import PersonFactory\n'), ((1240, 1318), 'cms.api.create_page', 'create_page', (['other_page_title', '"""richie/fullwidth.html"""', 'settings.LANGUAGE_CODE'], {}), "... |
Mathics3/mathics-core | mathics/core/subexpression.py | 54dc3c00a42cd893c6430054e125291b6eb55ead | # cython: language_level=3
# -*- coding: utf-8 -*-
from mathics.core.expression import Expression
from mathics.core.symbols import Atom, Symbol
from mathics.core.atoms import Integer
from mathics.builtin.base import MessageException
"""
This module provides some infrastructure to deal with SubExpressions.
"""
def... | [((611, 651), 'mathics.builtin.base.MessageException', 'MessageException', (['"""Part"""', '"""span"""', 'leaves'], {}), "('Part', 'span', leaves)\n", (627, 651), False, 'from mathics.builtin.base import MessageException\n'), ((1177, 1216), 'mathics.builtin.base.MessageException', 'MessageException', (['"""Part"""', '"... |
webu/pyopenproject | pyopenproject/business/services/command/configuration/find.py | 40b2cb9fe0fa3f89bc0fe2a3be323422d9ecf966 | from pyopenproject.api_connection.exceptions.request_exception import RequestError
from pyopenproject.api_connection.requests.get_request import GetRequest
from pyopenproject.business.exception.business_error import BusinessError
from pyopenproject.business.services.command.configuration.configuration_command import Co... | [((771, 794), 'pyopenproject.model.configuration.Configuration', 'Configuration', (['json_obj'], {}), '(json_obj)\n', (784, 794), False, 'from pyopenproject.model.configuration import Configuration\n'), ((848, 892), 'pyopenproject.business.exception.business_error.BusinessError', 'BusinessError', (['"""Error listing co... |
vrautela/treadmill | lib/python/treadmill/tests/api/cell_test.py | 05e47fa8acdf8bad7af78e737efb26ea6488de82 | """Cell API tests.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import mock
from treadmill import admin
from treadmill.api import cell
class ApiCellTest(unittest.TestCase):
"""treadmill.... | [((1944, 1959), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1957, 1959), False, 'import unittest\n'), ((381, 391), 'treadmill.api.cell.API', 'cell.API', ([], {}), '()\n', (389, 391), False, 'from treadmill.api import cell\n'), ((751, 767), 'treadmill.admin.Cell', 'admin.Cell', (['None'], {}), '(None)\n', (761,... |
microsoft/ai-python-package | src/python_package/__init__.py | 770f5167ebc32b5410739f04c5730e68f84785c9 | # -------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in project root for information.
# -------------------------------------------------------------
"""Python Package Template"""
from __future__... | [] |
themoodymann/piChain | tests/test_integration_partition.py | 4de9e8da3994901371713b68bc05295fe6676571 | """Integration test: Test partition of piChain nodes.
Note: run tests with default setting values in config.py.
"""
import time
from tests.util import MultiNodeTest
class MultiNodeTestPartition(MultiNodeTest):
def test_scenario30_partition(self):
self.start_processes_with_test_scenario(30, 5)
t... | [((319, 332), 'time.sleep', 'time.sleep', (['(8)'], {}), '(8)\n', (329, 332), False, 'import time\n'), ((1043, 1056), 'time.sleep', 'time.sleep', (['(8)'], {}), '(8)\n', (1053, 1056), False, 'import time\n'), ((1767, 1781), 'time.sleep', 'time.sleep', (['(15)'], {}), '(15)\n', (1777, 1781), False, 'import time\n')] |
projectpai/paipass | sandbox/pdp2/arbitrary_data/zip_files.py | 8b8e70b6808bf026cf957e240c7eed7bfcf4c55d | import zipfile
import random
RAND_INT_RANGE = (1,100)
def wrf(fname):
with open(fname, 'w') as f:
for i in range(100):
f.write(str(random.randint(*RAND_INT_RANGE)))
fnames = []
for i in range(10):
fname = 'file' + str(i) + '.txt'
wrf(fname)
fnames.append(fname)
dirpaths = set()
wi... | [((323, 390), 'zipfile.ZipFile', 'zipfile.ZipFile', (['"""myzip.zip"""', '"""w"""'], {'compression': 'zipfile.ZIP_DEFLATED'}), "('myzip.zip', 'w', compression=zipfile.ZIP_DEFLATED)\n", (338, 390), False, 'import zipfile\n'), ((457, 488), 'random.randint', 'random.randint', (['*RAND_INT_RANGE'], {}), '(*RAND_INT_RANGE)\... |
mwesterhof/wagtail_managed404 | tests/testproject/testproject/tests/test_middleware.py | a961271c7fc70accb43ec329da9defe36e3dab3c | import unittest
from django.test import Client
from wagtail.core.models import Page
from wagtail_managed404.models import PageNotFoundEntry
class TestMiddleware(unittest.TestCase):
"""Tests for `wagtail_app_pages` package."""
def setUp(self):
self.client = Client()
self.invalid_url = '/defi... | [((278, 286), 'django.test.Client', 'Client', ([], {}), '()\n', (284, 286), False, 'from django.test import Client\n'), ((430, 455), 'wagtail.core.models.Page.objects.get', 'Page.objects.get', ([], {'depth': '(2)'}), '(depth=2)\n', (446, 455), False, 'from wagtail.core.models import Page\n'), ((1154, 1208), 'wagtail_ma... |
maraujop/django-reversion | src/reversion/version.py | c9e7788ca858d3c75b617a7277ffcd177a19d414 | __version__ = (1, 8, 5)
| [] |
hajime9652/observations | observations/r/bomsoi.py | 2c8b1ac31025938cb17762e540f2f592e302d5de | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def bomsoi(path):
"""Southern Oscillation Index Data
The Southern Osci... | [((2272, 2296), 'os.path.expanduser', 'os.path.expanduser', (['path'], {}), '(path)\n', (2290, 2296), False, 'import os\n'), ((2439, 2524), 'observations.util.maybe_download_and_extract', 'maybe_download_and_extract', (['path', 'url'], {'save_file_name': '"""bomsoi.csv"""', 'resume': '(False)'}), "(path, url, save_file... |
dangerstudios/OpenPype | openpype/hosts/houdini/plugins/publish/validate_bypass.py | 10ddcc4699137888616eec57cd7fac9648189714 | import pyblish.api
import openpype.api
class ValidateBypassed(pyblish.api.InstancePlugin):
"""Validate all primitives build hierarchy from attribute when enabled.
The name of the attribute must exist on the prims and have the same name
as Build Hierarchy from Attribute's `Path Attribute` value on the Ale... | [] |
GavinK-ai/cv | gavPrj/dataset_core.py | 6dd11b2100c40aca281508c3821c807ef0ee227d | import os
import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
#srcPaths = ('dataset/Screenshot1','dataset/Screenshot2','dataset/Screenshot3', 'dataset/Screenshot4')
#srcPaths = ('all_dataset/s1',
# 'all_dataset/s10',
# 'all_dataset/s11',
# 'all_dataset/s12',
... | [((3273, 3366), 'numpy.savez_compressed', 'np.savez_compressed', (['datasetfilename'], {'images': 'images', 'labels': 'labels', 'labelnames': 'labelnames'}), '(datasetfilename, images=images, labels=labels,\n labelnames=labelnames)\n', (3292, 3366), True, 'import numpy as np\n'), ((2579, 2598), 'os.listdir', 'os.lis... |
jinified/kronos | kronos/kronos.py | 1f110372a025d28ccc407372320491ee818c893d | """
Kronos: A simple scheduler for graduate training programme
Entities: User, Schedule, Rotation
"""
from operator import itemgetter
from datetime import datetime, timedelta
def getRotationCapacity(rotationId, startDate, endDate, assignments):
""" Calculate number of users assigned to a particular rotation dur... | [((367, 405), 'datetime.datetime.strptime', 'datetime.strptime', (['startDate', '"""%d%m%Y"""'], {}), "(startDate, '%d%m%Y')\n", (384, 405), False, 'from datetime import datetime, timedelta\n'), ((416, 452), 'datetime.datetime.strptime', 'datetime.strptime', (['endDate', '"""%d%m%Y"""'], {}), "(endDate, '%d%m%Y')\n", (... |
jestinmwilson/personal-website | personal_env/lib/python3.8/site-packages/pylint/lint/utils.py | 6e47a7f33ed3b1ca5c1d42c89c5380d22992ed74 | # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
import contextlib
import sys
from pylint.utils import utils
class ArgumentPreprocessingError(Exception):
"""Raised if an error occurs during argument prep... | [((1694, 1720), 'pylint.utils.utils.get_python_path', 'utils.get_python_path', (['arg'], {}), '(arg)\n', (1715, 1720), False, 'from pylint.utils import utils\n')] |
deepneuralmachine/google-research | mol_dqn/experimental/multi_obj.py | d2ce2cf0f5c004f8d78bfeddf6e88e88f4840231 | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [((1238, 1308), 'absl.flags.DEFINE_float', 'flags.DEFINE_float', (['"""target_sas"""', '(1)', '"""The target SAS of the molecule."""'], {}), "('target_sas', 1, 'The target SAS of the molecule.')\n", (1256, 1308), False, 'from absl import flags\n'), ((1309, 1381), 'absl.flags.DEFINE_float', 'flags.DEFINE_float', (['"""t... |
uw-it-aca/myuw | myuw/test/views/test_rest_search.py | 3fa1fabeb3c09d81a049f7c1a8c94092d612438a | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
# -*- coding: utf-8 -*-
from django.test.utils import override_settings
from django.urls import reverse
from myuw.test.api import MyuwApiTest
@override_settings(
RESTCLIENTS_ADMIN_AUTH_MODULE='rc_django.tests.can_proxy_restcli... | [((233, 325), 'django.test.utils.override_settings', 'override_settings', ([], {'RESTCLIENTS_ADMIN_AUTH_MODULE': '"""rc_django.tests.can_proxy_restclient"""'}), "(RESTCLIENTS_ADMIN_AUTH_MODULE=\n 'rc_django.tests.can_proxy_restclient')\n", (250, 325), False, 'from django.test.utils import override_settings\n'), ((45... |
danagle/boggled | examples/cli-solver/cli_solver.py | 13fea4c31b5dff72093c38d1ad368dec9d44f4d0 | # cli_solver.py
import argparse
import os
from boggled import BoggleBoard, BoggleSolver, BoggleWords
def solve_board(board, words):
solver = BoggleSolver(board, words)
solver.solve()
return solver
def display_board_details(board):
print("Board details:")
print("Columns: ", board.columns)
pr... | [((148, 174), 'boggled.BoggleSolver', 'BoggleSolver', (['board', 'words'], {}), '(board, words)\n', (160, 174), False, 'from boggled import BoggleBoard, BoggleSolver, BoggleWords\n'), ((592, 617), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (615, 617), False, 'import argparse\n'), ((1125, 11... |
gitter-badger/wepy-1 | src/wepy/orchestration/orchestrator.py | 9bc619aeae178ad5d10f658fae2abfd2c7aeb18a | from copy import copy, deepcopy
import sqlite3
from hashlib import md5
import time
import os
import os.path as osp
from base64 import b64encode, b64decode
from zlib import compress, decompress
import itertools as it
import logging
# instead of pickle we use dill, so we can save dynamically defined
# classes
import dil... | [((1857, 1881), 'wepy.util.kv.gen_uri', 'gen_uri', (['orch_path', 'mode'], {}), '(orch_path, mode)\n', (1864, 1881), False, 'from wepy.util.kv import KV, SQLITE3_INMEMORY_URI, gen_uri\n'), ((2022, 2098), 'sqlite3.connect', 'sqlite3.connect', (['self.db_uri'], {'uri': '(True)', 'timeout': 'self.SQLITE3_DEFAULT_TIMEOUT'}... |
HesterLim/pytorch-cnn-visualizations | src/generate_class_specific_samples.py | 59ddf0ef6ea2c9d4d69c1ac6b260cb399867d178 | """
Created on Thu Oct 26 14:19:44 2017
@author: Utku Ozbulak - github.com/utkuozbulak
"""
import os
import numpy as np
import torch
from torch.optim import SGD
from torchvision import models
from misc_functions import preprocess_image, recreate_image, save_image
class ClassSpecificImageGeneration():
"""
... | [((2557, 2588), 'torchvision.models.alexnet', 'models.alexnet', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (2571, 2588), False, 'from torchvision import models\n'), ((704, 744), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(255)', '(224, 224, 3)'], {}), '(0, 255, (224, 224, 3))\n', (721, 744), Tru... |
iltempe/osmosi | sumo/tools/net/visum_mapDistricts.py | c0f54ecdbb7c7b5602d587768617d0dc50f1d75d | #!/usr/bin/env python
"""
@file visum_mapDistricts.py
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2007-10-25
@version $Id$
This script reads a network and a dump file and
draws the network, coloring it by the values
found within the dump-file.
SUMO, Simulation of Urban MObility; see http://sum... | [((1283, 1297), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (1295, 1297), False, 'from optparse import OptionParser\n'), ((1041, 1069), 'math.sqrt', 'math.sqrt', (['(xd * xd + yd * yd)'], {}), '(xd * xd + yd * yd)\n', (1050, 1069), False, 'import math\n'), ((854, 879), 'os.path.abspath', 'os.path.abspath... |
bkpifc/BKPMediaDetector | BKPMediaDetector.py | 51858b45e218e0c4b5ed4d6aac6d751e029d850e | #!/usr/bin/env python3
######
# General Detector
# 06.12.2018 / Last Update: 20.05.2021
# LRB
######
import numpy as np
import os
import sys
import tensorflow as tf
import hashlib
import cv2
import magic
import PySimpleGUI as sg
import csv
import imagehash
import face_recognition
import subprocess
from itertools impo... | [((16564, 16598), 'pathlib.Path', 'Path', (['"""Models/OpenVINO/age-gender"""'], {}), "('Models/OpenVINO/age-gender')\n", (16568, 16598), False, 'from pathlib import Path\n'), ((16953, 16961), 'openvino.inference_engine.IECore', 'IECore', ([], {}), '()\n', (16959, 16961), False, 'from openvino.inference_engine import I... |
stevenwalton/Retro-Learner | src/BruteForce.py | 74586c57b5dd5f6e82abaff99344285731f1fc56 | import time
import retro
import FrameSkip
import TimeLimit
import Brute
class BruteForce():
def __init__(self,
game='Airstriker-Genesis',
max_episode_steps=4500,
timestep_limit=100_000_000,
state=retro.State.DEFAULT,
scenario=Non... | [((985, 1090), 'retro.make', 'retro.make', ([], {'game': 'game', 'state': 'state', 'use_restricted_actions': 'retro.Actions.DISCRETE', 'scenario': 'scenario'}), '(game=game, state=state, use_restricted_actions=retro.Actions.\n DISCRETE, scenario=scenario)\n', (995, 1090), False, 'import retro\n'), ((1197, 1245), 'Fr... |
yakhyo/PyTorch-Tutorials | tutorials/04-advanced/03-super-resolution-onnx/main.py | 163287bc735b09c366dbdfa3989e81acaef6fa1f | import io
import numpy as np
import torch.utils.model_zoo as model_zoo
import torch.onnx
import torch.nn as nn
import torch.nn.init as init
# ================================================================ #
# Building the Model #
# ====================================... | [((3603, 3637), 'onnx.load', 'onnx.load', (['"""super_resolution.onnx"""'], {}), "('super_resolution.onnx')\n", (3612, 3637), False, 'import onnx\n'), ((3638, 3674), 'onnx.checker.check_model', 'onnx.checker.check_model', (['onnx_model'], {}), '(onnx_model)\n', (3662, 3674), False, 'import onnx\n'), ((3690, 3743), 'onn... |
revvsales/python-docx-1 | features/steps/section.py | 5b3ff2b828cc30f1567cb1682a8cb399143732d7 | # encoding: utf-8
"""
Step implementations for section-related features
"""
from __future__ import absolute_import, print_function, unicode_literals
from behave import given, then, when
from docx import Document
from docx.enum.section import WD_ORIENT, WD_SECTION
from docx.section import Section
from docx.shared im... | [((428, 464), 'behave.given', 'given', (['"""a Section object as section"""'], {}), "('a Section object as section')\n", (433, 464), False, 'from behave import given, then, when\n'), ((592, 685), 'behave.given', 'given', (['"""a Section object {with_or_without} a distinct first-page header as section"""'], {}), "(\n ... |
seberg/scipy | scipy/sparse/csgraph/_laplacian.py | d8081cdd40ed8cbebd5905c0ad6c323c57d5da6e | """
Laplacian of a compressed-sparse graph
"""
# Authors: Aric Hagberg <hagberg@lanl.gov>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Jake Vanderplas <vanderplas@astro.washington.edu>
# License: BSD
import numpy as np
from scipy.sparse import isspmatrix, coo_matrix
#########################... | [((2376, 2395), 'scipy.sparse.isspmatrix', 'isspmatrix', (['csgraph'], {}), '(csgraph)\n', (2386, 2395), False, 'from scipy.sparse import isspmatrix, coo_matrix\n'), ((3247, 3288), 'numpy.concatenate', 'np.concatenate', (['[lap.row, diagonal_holes]'], {}), '([lap.row, diagonal_holes])\n', (3261, 3288), True, 'import nu... |
kuasha/peregrine | samples/barebone/settings.py | b3dd92146d26fe9e4ea589868431b590324b47d1 | import os
import logging
from collections import namedtuple
from Crypto.PublicKey import RSA
from tornado import gen
from tornado import concurrent
from cosmos.rbac.object import *
from cosmos.service import OBSERVER_PROCESSOR
DEBUG = True
DB_HOST = "127.0.0.1"
DB_NAME = "cosmos"
DB_PORT = 27017
DB_USER_NAME = None
... | [((559, 585), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (575, 585), False, 'import os\n'), ((640, 666), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (656, 666), False, 'import os\n'), ((729, 755), 'os.path.realpath', 'os.path.realpath', (['__file__'], {})... |
A-Hilaly/zilean | zilean/system/zilean_migrator.py | 2b2e87969a0d8064e8b92b07c346a4006f93c795 | from .utils.migrations import (migrate_database_from,
migrate_machine_from,
zilean_rollback_database_backup,
zilean_rollback_machine_backup)
class ZileanMigrator(object):
pass
| [] |
DionysisChristopoulos/google-research | coltran/run.py | 7f59ef421beef32ca16c2a7215be74f7eba01a0f | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [((1288, 1397), 'absl.flags.DEFINE_enum', 'flags.DEFINE_enum', (['"""mode"""', '"""train"""', "['train', 'eval_train', 'eval_valid', 'eval_test']", '"""Operation mode."""'], {}), "('mode', 'train', ['train', 'eval_train', 'eval_valid',\n 'eval_test'], 'Operation mode.')\n", (1305, 1397), False, 'from absl import fla... |
wenliangdai/sunets-reproduce | train_multi_human.py | d92efa80e8314aea153d498cce3c9c6e30c252bd | import argparse
import math
import os
import pickle
import random
import sys
import numpy as np
import torch
import torch.backends.cudnn as cudnn
from torch import nn
from torch.optim import lr_scheduler
from torch.utils import data
import torchvision.transforms as transforms
import transforms as extended_transforms
... | [((764, 793), 'random.seed', 'random.seed', (['args.manual_seed'], {}), '(args.manual_seed)\n', (775, 793), False, 'import random\n'), ((798, 830), 'numpy.random.seed', 'np.random.seed', (['args.manual_seed'], {}), '(args.manual_seed)\n', (812, 830), True, 'import numpy as np\n'), ((835, 870), 'torch.manual_seed', 'tor... |
quitaiskiluisf/TI4F-2021-LogicaProgramacao | exemplos/exemplo-aula-14-01.py | d12e5c389a43c98f27726df5618fe529183329a8 | # Apresentação
print('Programa para somar 8 valores utilizando vetores/listas')
print()
# Declaração do vetor
valores = [0, 0, 0, 0, 0, 0, 0, 0]
# Solicita os valores
for i in range(len(valores)):
valores[i] = int(input('Informe o valor: '))
# Cálculo da soma
soma = 0
for i in range(len(valores)):
soma += va... | [] |
pwicks86/adventofcode2015 | day3/p1.py | fba7cc8f6942f43f5b0226a0ac70365630f14cbd | from collections import defaultdict
f = open("input.txt")
d = f.read()
houses = defaultdict(int,{(0,0):1})
cur = [0,0]
for c in d:
if c == "<":
cur[0] -= 1
if c == ">":
cur[0] += 1
if c == "v":
cur[1] += 1
if c == "^":
cur[1] -= 1
houses[tuple(cur)]+=1
print(len(hou... | [((80, 109), 'collections.defaultdict', 'defaultdict', (['int', '{(0, 0): 1}'], {}), '(int, {(0, 0): 1})\n', (91, 109), False, 'from collections import defaultdict\n')] |
NUbots/NUpbr | pbr/config/blend_config.py | 49b0d2abd15512a93bfe21157269288c9ec4c54d | # Blender-specific Configuration Settings
from math import pi
render = {
"render_engine": "CYCLES",
"render": {"cycles_device": "GPU"},
"dimensions": {"resolution": [1280, 1024], "percentage": 100.0},
"sampling": {"cycles_samples": 256, "cycles_preview_samples": 16},
"light_paths": {
"tran... | [] |
mia-jingyi/simglucose | simglucose/controller/basal_bolus_ctrller.py | a90bd8750fce362be91668ed839b3b252bc0d58d | from .base import Controller
from .base import Action
import numpy as np
import pandas as pd
import logging
from collections import namedtuple
from tqdm import tqdm
logger = logging.getLogger(__name__)
CONTROL_QUEST = 'simglucose/params/Quest.csv'
PATIENT_PARA_FILE = 'simglucose/params/vpatient_params.csv'
ParamTup = ... | [((175, 202), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (192, 202), False, 'import logging\n'), ((320, 365), 'collections.namedtuple', 'namedtuple', (['"""ParamTup"""', "['basal', 'cf', 'cr']"], {}), "('ParamTup', ['basal', 'cf', 'cr'])\n", (330, 365), False, 'from collections import... |
redhat-openstack/ceilometer | ceilometer/event/trait_plugins.py | 9e503d7068889e52e9144079de331ed51676e535 | #
# Copyright 2013 Rackspace Hosting.
#
# 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... | [((612, 642), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (629, 642), False, 'import six\n'), ((4093, 4124), 'six.text_type', 'six.text_type', (['match_list[0][1]'], {}), '(match_list[0][1])\n', (4106, 4124), False, 'import six\n')] |
gongjunhuang/web | web13/jsonapi.py | 9412f6fd7c223174fdb30f4d7a8b61a8e130e329 | from flask import Flask, redirect, url_for, jsonify, request
app = Flask(__name__)
users = []
'''
Json api
请求form里面Json 返回Json
好处:
1.通信的格式统一,对语言的约束就小了
2.易于做成open api
3.客户端重度渲染
RESTful api
Dr. Fielding
url 用资源来组织的 名词
/GET /players 拿到所有玩家
/GET /player/id 访问id的玩家的数据
/PUT /players 全量更新
... | [((68, 83), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (73, 83), False, 'from flask import Flask, redirect, url_for, jsonify, request\n'), ((777, 791), 'flask.jsonify', 'jsonify', (['users'], {}), '(users)\n', (784, 791), False, 'from flask import Flask, redirect, url_for, jsonify, request\n'), ((713, ... |
mhndlsz/memodrop | cards/migrations/0012_auto_20180331_1348.py | 7ba39143c8e4fbe67881b141accedef535e936e6 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-31 13:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cards', '0011_auto_20180319_1112'),
]
operations = [
migrations.AlterField... | [((398, 437), 'django.db.models.TextField', 'models.TextField', ([], {'verbose_name': '"""Answer"""'}), "(verbose_name='Answer')\n", (414, 437), False, 'from django.db import migrations, models\n'), ((555, 604), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'verbose_name': '"""Hint"""'}), "... |
T6751/MoMMI | MoMMI/Modules/ss14_nudges.py | 4b9dd0d49c6e2bd82b82a4893fc35475d4e39e9a | import logging
from typing import Match, Any, Dict
import aiohttp
from discord import Message
from MoMMI import comm_event, command, MChannel, always_command
logger = logging.getLogger(__name__)
@comm_event("ss14")
async def ss14_nudge(channel: MChannel, message: Any, meta: str) -> None:
try:
config: Dict... | [((168, 195), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (185, 195), False, 'import logging\n'), ((198, 216), 'MoMMI.comm_event', 'comm_event', (['"""ss14"""'], {}), "('ss14')\n", (208, 216), False, 'from MoMMI import comm_event, command, MChannel, always_command\n'), ((841, 882), 'Mo... |
CybersecurityLuxembourg/openxeco | oxe-api/test/resource/company/test_get_company_taxonomy.py | 8d4e5578bde6a07f5d6d569b16b4de224abf7bf0 | from test.BaseCase import BaseCase
class TestGetCompanyTaxonomy(BaseCase):
@BaseCase.login
def test_ok(self, token):
self.db.insert({"id": 1, "name": "My Company"}, self.db.tables["Company"])
self.db.insert({"id": 2, "name": "My Company 2"}, self.db.tables["Company"])
self.db.insert({... | [] |
mikeboers/Spoon | spoon/models/groupmembership.py | 9fe4a06be7c2c6c307b79e72893e32f2006de4ea | import sqlalchemy as sa
from ..core import db
class GroupMembership(db.Model):
__tablename__ = 'group_memberships'
__table_args__ = dict(
autoload=True,
extend_existing=True,
)
user = db.relationship('Account',
foreign_keys='GroupMembership.user_id',
backref=db.backr... | [] |
HaolinCMU/Soft_tissue_tracking | nonlinear/aorta/nonlinearCasesCreation_aorta.py | 8592b87066ddec84a3aefc18240303cb085cf34c | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 25 13:08:16 2020
@author: haolinl
"""
import copy
import os
import time
import numpy as np
import random
import scipy.io # For extracting data from .mat file
class inputFileGenerator(object):
"""
Generate input file for Abaqus.
Unit s... | [((53960, 53971), 'time.time', 'time.time', ([], {}), '()\n', (53969, 53971), False, 'import time\n'), ((55237, 55248), 'time.time', 'time.time', ([], {}), '()\n', (55246, 55248), False, 'import time\n'), ((57556, 57567), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (57565, 57567), False, 'import os\n'), ((17350, 17381)... |
dongboyan77/quay | data/cache/test/test_cache.py | 8018e5bd80f17e6d855b58b7d5f2792d92675905 | import pytest
from mock import patch
from data.cache import InMemoryDataModelCache, NoopDataModelCache, MemcachedModelCache
from data.cache.cache_key import CacheKey
class MockClient(object):
def __init__(self, server, **kwargs):
self.data = {}
def get(self, key, default=None):
return self.... | [((422, 509), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""cache_type"""', '[NoopDataModelCache, InMemoryDataModelCache]'], {}), "('cache_type', [NoopDataModelCache,\n InMemoryDataModelCache])\n", (445, 509), False, 'import pytest\n'), ((551, 573), 'data.cache.cache_key.CacheKey', 'CacheKey', (['"""fo... |
mazmat-panw/content | Packs/HealthCheck/Scripts/HealthCheckIncidentsCreatedMonthly/HealthCheckIncidentsCreatedMonthly.py | 024a65c1dea2548e2637a9cbbe54966e9e34a722 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
ctx = demisto.context()
dataFromCtx = ctx.get("widgets")
if not dataFromCtx:
incident = demisto.incidents()[0]
accountName = incident.get('account')
accountName = f"acc_{accountName}" if accountName != "" else ""
... | [((98, 115), 'demistomock.context', 'demisto.context', ([], {}), '()\n', (113, 115), True, 'import demistomock as demisto\n'), ((330, 657), 'demistomock.executeCommand', 'demisto.executeCommand', (['"""demisto-api-post"""', "{'uri': f'{accountName}/statistics/widgets/query', 'body': {'size': 13,\n 'dataType': 'incid... |
qzlydao/Bert_Sentiment_Analysis | Bert_training.py | 2da2d0c6da2cdb55f37ff0a7e95f0ea4876b2d61 | from torch.utils.data import DataLoader
from dataset.wiki_dataset import BERTDataset
from models.bert_model import *
from tqdm import tqdm
import numpy as np
import pandas as pd
import os
config = {}
config['train_corpus_path'] = './corpus/train_wiki.txt'
config['test_corpus_path'] = './corpus/test_wiki.txt'
config[... | [((1318, 1497), 'dataset.wiki_dataset.BERTDataset', 'BERTDataset', ([], {'corpus_path': "config['train_corpus_path']", 'word2idx_path': "config['word2idx_path']", 'seq_len': 'self.max_seq_len', 'hidden_dim': 'bertconfig.hidden_size', 'on_memory': '(False)'}), "(corpus_path=config['train_corpus_path'], word2idx_path=con... |
appliedml85/triton | python/triton/language/random.py | 8bedcce9befbbe95d8fe0a082718edc4050e2831 | import triton
import triton.language as tl
# Notes
# 1. triton doesn't support uint32, so we use int32 instead and benefit from the fact that two's complement operations are equivalent to uint operations.
# 2. multiply_low_high is currently inefficient.
# 3. Even though technically philox sampling outputs int, in man... | [((2809, 2830), 'triton.language.maximum', 'tl.maximum', (['(1e-07)', 'u1'], {}), '(1e-07, u1)\n', (2819, 2830), True, 'import triton.language as tl\n'), ((2887, 2897), 'triton.language.log', 'tl.log', (['u1'], {}), '(u1)\n', (2893, 2897), True, 'import triton.language as tl\n'), ((2914, 2924), 'triton.language.cos', '... |
kensho-technologies/pyctcdecode | pyctcdecode/__init__.py | c33f94bce283ea9af79d30e2b815e3bf34a137c9 | # Copyright 2021-present Kensho Technologies, LLC.
from .alphabet import Alphabet # noqa
from .decoder import BeamSearchDecoderCTC, build_ctcdecoder # noqa
from .language_model import LanguageModel # noqa
__package_name__ = "pyctcdecode"
__version__ = "0.3.0"
| [] |
marky1991/Legend-of-Wumpus | wumpus/start_server.py | b53f4a520cea274ddb4c40c6ab4f42a68008896f | from wumpus.server import Server
from circuits import Debugger
s = Server("0.0.0.0", 50551) + Debugger()
s.run()
import sys
sys.exit(1)
| [((125, 136), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (133, 136), False, 'import sys\n'), ((68, 92), 'wumpus.server.Server', 'Server', (['"""0.0.0.0"""', '(50551)'], {}), "('0.0.0.0', 50551)\n", (74, 92), False, 'from wumpus.server import Server\n'), ((95, 105), 'circuits.Debugger', 'Debugger', ([], {}), '()\n'... |
BlackLight/platypush | platypush/backend/joystick/linux/__init__.py | 6c0a8bf2599eb4ab41a6122dbd988075d8b1a63a | import array
import struct
import time
from fcntl import ioctl
from typing import IO
from platypush.backend import Backend
from platypush.message.event.joystick import JoystickConnectedEvent, JoystickDisconnectedEvent, \
JoystickButtonPressedEvent, JoystickButtonReleasedEvent, JoystickAxisEvent
class JoystickLin... | [((3326, 3352), 'array.array', 'array.array', (['"""B"""', '([0] * 64)'], {}), "('B', [0] * 64)\n", (3337, 3352), False, 'import array\n'), ((3552, 3573), 'array.array', 'array.array', (['"""B"""', '[0]'], {}), "('B', [0])\n", (3563, 3573), False, 'import array\n'), ((3582, 3609), 'fcntl.ioctl', 'ioctl', (['dev', '(214... |
SaxionMechatronics/Firmware | src/modules/sensors/vehicle_magnetometer/mag_compensation/python/mag_compensation.py | 7393d5d7610dc8d2cb64d90a5359b6c561fb642a | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
File: mag_compensation.py
Author: Tanja Baumann
Email: tanja@auterion.com
Github: https://github.com/baumanta
Description:
Computes linear coefficients for mag compensation from thrust and current
Usage:
python mag_compensation.py /path/to/log/logfile.ulg curr... | [((733, 820), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Calculate compensation parameters from ulog"""'}), "(description=\n 'Calculate compensation parameters from ulog')\n", (756, 820), False, 'import argparse\n'), ((1426, 1440), 'pyulog.ULog', 'ULog', (['log_name'], {}), '(log_... |
19857625778/watchlist | app.py | 284e3f814394d0fda6e262ab84177a493027c19e | from flask import Flask
app = Flask(_name_)
@app.route('/')
def hello():
return 'welcome to my watchlist' | [((30, 43), 'flask.Flask', 'Flask', (['_name_'], {}), '(_name_)\n', (35, 43), False, 'from flask import Flask\n')] |
AI-Traiding-Team/paired_trading | portfolio_optimization/constants.py | 72d4dd0071314e2f0efaa26931ca7339199fc998 | import os
path1 = "outputs"
path2 = "outputs/_imgs"
path3 = "outputs/max_sharpe_weights"
path4 = "outputs/opt_portfolio_trades"
try:
os.mkdir(path1)
except OSError:
print ("Директория %s уже создана" % path1)
else:
print ("Успешно создана директория %s " % path1)
try:
os.makedirs(path2)
os.makedi... | [((139, 154), 'os.mkdir', 'os.mkdir', (['path1'], {}), '(path1)\n', (147, 154), False, 'import os\n'), ((288, 306), 'os.makedirs', 'os.makedirs', (['path2'], {}), '(path2)\n', (299, 306), False, 'import os\n'), ((311, 329), 'os.makedirs', 'os.makedirs', (['path3'], {}), '(path3)\n', (322, 329), False, 'import os\n'), (... |
silky/mypy | mypy/transformtype.py | de6a8d3710df9f49109cb682f2092e4967bfb92c | """Transform classes for runtime type checking."""
from typing import Undefined, List, Set, Any, cast, Tuple, Dict
from mypy.nodes import (
TypeDef, Node, FuncDef, VarDef, Block, Var, ExpressionStmt,
TypeInfo, SuperExpr, NameExpr, CallExpr, MDEF, MemberExpr, ReturnStmt,
AssignmentStmt, TypeExpr, PassStmt,... | [((1866, 1918), 'typing.Undefined', 'Undefined', (['"""mypy.transform.DyncheckTransformVisitor"""'], {}), "('mypy.transform.DyncheckTransformVisitor')\n", (1875, 1918), False, 'from typing import Undefined, List, Set, Any, cast, Tuple, Dict\n'), ((1970, 1996), 'typing.Undefined', 'Undefined', (['FuncTransformer'], {}),... |
AhmadManzoor/jazzpos | jazzpos/admin.py | 7b771095b8df52d036657f33f36a97efb575d36c | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django_tablib.admin import TablibAdmin
from jazzpos.models import Customer, Patient, Store, CustomerType, StoreSettings
from jazzpos.models import UserProfile
class CustomerAdmin(TablibAd... | [((687, 731), 'django.contrib.admin.site.register', 'admin.site.register', (['Customer', 'CustomerAdmin'], {}), '(Customer, CustomerAdmin)\n', (706, 731), False, 'from django.contrib import admin\n'), ((732, 774), 'django.contrib.admin.site.register', 'admin.site.register', (['Patient', 'PatientAdmin'], {}), '(Patient,... |
vfdev-5/ignite-examples | classification/imaterialist_challenge_furniture_2018/configs/train/train_inceptionresnetv2_350_ssd_like_v3.py | fb15b59e2b159e1e2bc4628f8756055e9154f5c8 | # Basic training configuration file
from torch.optim import RMSprop
from torch.optim.lr_scheduler import MultiStepLR
from torchvision.transforms import RandomHorizontalFlip, Compose
from torchvision.transforms import RandomResizedCrop, RandomAffine, RandomApply
from torchvision.transforms import ColorJitter, ToTensor, ... | [((1033, 1096), 'common.dataset.FilesFromCsvDataset', 'FilesFromCsvDataset', (['"""output/unique_filtered_train_dataset.csv"""'], {}), "('output/unique_filtered_train_dataset.csv')\n", (1052, 1096), False, 'from common.dataset import FilesFromCsvDataset\n'), ((1112, 1251), 'common.data_loaders.get_data_loader', 'get_da... |
QuESt-Calculator/pyscf | examples/qmmm/02-mcscf.py | 0ed03633b699505c7278f1eb501342667d0aa910 | #!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
'''
A simple example to run MCSCF with background charges.
'''
import numpy
from pyscf import gto, scf, mcscf, qmmm
mol = gto.M(atom='''
C 1.1879 -0.3829 0.0000
C 0.0000 0.5526 0.0000
O -1.1867 -0.2472 0.0000
H -1.9237 0... | [((195, 543), 'pyscf.gto.M', 'gto.M', ([], {'atom': '"""\nC 1.1879 -0.3829 0.0000\nC 0.0000 0.5526 0.0000\nO -1.1867 -0.2472 0.0000\nH -1.9237 0.3850 0.0000\nH 2.0985 0.2306 0.0000\nH 1.1184 -1.0093 0.8869\nH 1.1184 -1.0093 -0.8869\nH -0.0227 1.1812 0.8852\nH ... |
uk-gov-mirror/ministryofjustice.money-to-prisoners-send-money | mtp_send_money/apps/send_money/utils.py | 80db0cf5f384f93d35387a757605cfddbc98935f | import datetime
from decimal import Decimal, ROUND_DOWN, ROUND_UP
import logging
import re
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from django.utils import formats
from django.utils.cache import patch_cache_control
from djang... | [((674, 698), 'logging.getLogger', 'logging.getLogger', (['"""mtp"""'], {}), "('mtp')\n", (691, 698), False, 'import logging\n'), ((720, 776), 're.compile', 're.compile', (['"""^[a-z]\\\\d\\\\d\\\\d\\\\d[a-z]{2}$"""', 're.IGNORECASE'], {}), "('^[a-z]\\\\d\\\\d\\\\d\\\\d[a-z]{2}$', re.IGNORECASE)\n", (730, 776), False, ... |
Zumbi-ML/zmbRELEV | src/zmbrelev/config.py | e6a6f789804d7230415f390da905e94ae2ab27f5 | # -*- coding: UTF-8 -*-
import os
this_file_path = os.path.dirname(os.path.realpath(__file__))
MODELS_DIR = os.path.join(this_file_path, "models/")
| [((111, 150), 'os.path.join', 'os.path.join', (['this_file_path', '"""models/"""'], {}), "(this_file_path, 'models/')\n", (123, 150), False, 'import os\n'), ((69, 95), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (85, 95), False, 'import os\n')] |
EdgarVallejo96/pyEdureka | ArraysP2.py | f103f67ed4f9eee6ab924237e9d94a489e602c7c | import array as arr
a = arr.array('i', [ 1,2,3,4,5,6])
print(a)
# Accessing elements
print(a[2])
print(a[-2])
# BASIC ARRAY OPERATIONS
# Find length of array
print()
print('Length of array')
print(len(a))
# Adding elments to an array
# append() to add a single element at the end of an array
# extend() to add more th... | [((24, 58), 'array.array', 'arr.array', (['"""i"""', '[1, 2, 3, 4, 5, 6]'], {}), "('i', [1, 2, 3, 4, 5, 6])\n", (33, 58), True, 'import array as arr\n'), ((1131, 1168), 'array.array', 'arr.array', (['"""i"""', '[1, 2, 3, 4, 5, 6, 7]'], {}), "('i', [1, 2, 3, 4, 5, 6, 7])\n", (1140, 1168), True, 'import array as arr\n'),... |
RichardLitt/Vesper | vesper/mpg_ranch/nfc_detector_low_score_classifier_1_0/classifier.py | 5360844f42a06942e7684121c650b08cf8616285 | """
Module containing low score classifier for MPG Ranch NFC detectors.
An instance of the `Classifier` class of this module assigns the `LowScore`
classification to a clip if the clip has no `Classification` annotation and
has a `DetectorScore` annotation whose value is less than a threshold.
This classifier is inte... | [((580, 599), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (597, 599), False, 'import logging\n'), ((2769, 2806), 'vesper.django.app.models.AnnotationInfo.objects.get', 'AnnotationInfo.objects.get', ([], {'name': 'name'}), '(name=name)\n', (2795, 2806), False, 'from vesper.django.app.models import Annota... |
yitzikc/athena2pd | setup.py | d2d6b886a70e958f51d90103600572152eaa7bb9 | from setuptools import setup, find_packages
def find_version(path):
import re
# path shall be a plain ascii tetxt file
s = open(path, 'rt').read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", s, re.M)
if version_match:
return version_match.group(1)
raise RuntimeErro... | [((181, 243), 're.search', 're.search', (['"""^__version__ = [\'\\\\"]([^\'\\\\"]*)[\'\\\\"]"""', 's', 're.M'], {}), '(\'^__version__ = [\\\'\\\\"]([^\\\'\\\\"]*)[\\\'\\\\"]\', s, re.M)\n', (190, 243), False, 'import re\n')] |
PuAnysh/UFPMP-Det | mmdet/core/ufp/__init__.py | 6809b4f8de3aa1d013a3f86114bc3e8496d896a9 | from .spp import *
from .unified_foreground_packing import *
__all__ = [
'phsppog', 'UnifiedForegroundPacking'
]
| [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.