repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
smdesai/logica | colab_logica.py | ad099bcd6064e38e9c2bc9a99564832857c0768c | #!/usr/bin/python
#
# Copyright 2020 Google LLC
#
# 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... | [((1956, 1980), 'google.colab.auth.authenticate_user', 'auth.authenticate_user', ([], {}), '()\n', (1978, 1980), False, 'from google.colab import auth\n'), ((5747, 5768), 'IPython.get_ipython', 'IPython.get_ipython', ([], {}), '()\n', (5766, 5768), False, 'import IPython\n'), ((7847, 7886), 'os.system', 'os.system', ([... |
toddrme2178/pyccel | pyccel/ast/basic.py | deec37503ab0c5d0bcca1a035f7909f7ce8ef653 | from sympy.core.basic import Basic as sp_Basic
class Basic(sp_Basic):
"""Basic class for Pyccel AST."""
_fst = None
def set_fst(self, fst):
"""Sets the redbaron fst."""
self._fst = fst
@property
def fst(self):
return self._fst
| [] |
Clusks/alibi-detect | alibi_detect/utils/tests/test_discretize.py | b39406a6cf88f315f401562d4fea93a42aa6dcc1 | from itertools import product
import numpy as np
import pytest
from alibi_detect.utils.discretizer import Discretizer
x = np.random.rand(10, 4)
n_features = x.shape[1]
feature_names = [str(_) for _ in range(n_features)]
categorical_features = [[], [1, 3]]
percentiles = [list(np.arange(25, 100, 25)), list(np.arange(10... | [((123, 144), 'numpy.random.rand', 'np.random.rand', (['(10)', '(4)'], {}), '(10, 4)\n', (137, 144), True, 'import numpy as np\n'), ((346, 388), 'itertools.product', 'product', (['categorical_features', 'percentiles'], {}), '(categorical_features, percentiles)\n', (353, 388), False, 'from itertools import product\n'), ... |
AlloSphere-Research-Group/tinc-python | tinc/tests/parameter_space_test.py | 4c3390df9911a391833244de1eb1d33a2e19d330 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 11:49:43 2021
@author: Andres
"""
import sys,time
import unittest
from tinc import *
class ParameterSpaceTest(unittest.TestCase):
def test_parameter(self):
p1 = Parameter("param1")
p2 = Parameter("param2")
ps = ParameterSpace("ps")
... | [((3345, 3360), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3358, 3360), False, 'import unittest\n')] |
CORE-Robotics-Lab/Interpretable_DDTS_AISTATS2020 | interpretable_ddts/runfiles/gym_runner.py | a7fde4d2a7d70477b2e6c96b140f8c6587f78791 | # Created by Andrew Silva on 8/28/19
import gym
import numpy as np
import torch
from interpretable_ddts.agents.ddt_agent import DDTAgent
from interpretable_ddts.agents.mlp_agent import MLPAgent
from interpretable_ddts.opt_helpers.replay_buffer import discount_reward
import torch.multiprocessing as mp
import argparse
im... | [((651, 674), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (668, 674), False, 'import torch\n'), ((698, 718), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (712, 718), True, 'import numpy as np\n'), ((755, 772), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (766... |
andrewn488/OMSBA-5061 | Week 08/tw10_words_by_prefix.py | 8e57fff45d8965b0423a6fe338bd74cedfe94ea0 | """ TW10: Words by Prefix
Team: Tam Tamura, Andrew Nalundasan
For: OMSBA 2061, Seattle University
Date: 11/3/2020
"""
def wordByPrefix(prefix_length, word):
my_dict = {}
for key in word:
for letter in word:
prefix_key = letter[:prefix_length]
letter = word[:prefix_len... | [] |
openforcefield/bespoke-f | openff/bespokefit/executor/services/qcgenerator/cache.py | 27b072bd09610dc8209429118d739e1f453edd61 | import hashlib
from typing import TypeVar, Union
import redis
from openff.toolkit.topology import Molecule
from openff.bespokefit.executor.services.qcgenerator import worker
from openff.bespokefit.schema.tasks import HessianTask, OptimizationTask, Torsion1DTask
from openff.bespokefit.utilities.molecule import canonic... | [((341, 400), 'typing.TypeVar', 'TypeVar', (['"""_T"""', 'HessianTask', 'OptimizationTask', 'Torsion1DTask'], {}), "('_T', HessianTask, OptimizationTask, Torsion1DTask)\n", (348, 400), False, 'from typing import TypeVar, Union\n'), ((609, 671), 'openff.toolkit.topology.Molecule.from_smiles', 'Molecule.from_smiles', (['... |
jrzeszutek/cloudify-training-labs | advanced-workflows/task-graphs-lab/exercise/plugins/lab/plugin/workflows.py | 5477750d269cb703ce47e35a1c13749fc88f3f6f | '''Copyright Gigaspaces, 2017, All Rights Reserved'''
from cloudify.plugins import lifecycle
OP_START = 'hacker.interfaces.lifecycle.start'
OP_STOP = 'hacker.interfaces.lifecycle.stop'
OP_SS_C = 'hacker.interfaces.lifecycle.create_snapshots'
OP_SS_D = 'hacker.interfaces.lifecycle.delete_snapshots'
REQUIRED_OPS = set([... | [((3599, 3631), 'cloudify.plugins.lifecycle.is_host_node', 'lifecycle.is_host_node', (['instance'], {}), '(instance)\n', (3621, 3631), False, 'from cloudify.plugins import lifecycle\n')] |
CryptoNyxz/Miscellaneous-Tools | File Transfer/Flyter/flyter.py | 797ea04d7c369469ab3d2a1ae2838c4a7b7b9c02 | """
Flyter
Tool for transferring files on the same network using raw sockets.
Doesn't use encryption.
"""
__version__ = (0, 0, 0)
__author__ = "CryptoNyxz"
__license__ = """
MIT License
Copyright (c) 2021 Jaymund Cyrus F. Floranza
Permission is hereby granted, free of charge, to any person obtaining a copy
of this... | [((1853, 1954), 'warnings.warn', 'warn', (['"""[!] Some features are not be compatible with the version of your python interpreter"""'], {}), "(\n '[!] Some features are not be compatible with the version of your python interpreter'\n )\n", (1857, 1954), False, 'from warnings import warn\n'), ((2782, 2796), 'sock... |
patelrajnath/transformers | tests/test_modeling_tf_led.py | 98afe9d7c94a840d4b30c7eb76f9bfe570d2ed50 | # coding=utf-8
# Copyright Iz Beltagy, Matthew E. Peters, Arman Cohan and The HuggingFace Inc. team. 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.ap... | [((921, 938), 'transformers.is_tf_available', 'is_tf_available', ([], {}), '()\n', (936, 938), False, 'from transformers import LEDConfig, is_tf_available\n'), ((12895, 12931), 'tensorflow.constant', 'tf.constant', (['tok_lst'], {'dtype': 'tf.int32'}), '(tok_lst, dtype=tf.int32)\n', (12906, 12931), True, 'import tensor... |
plonerma/wann-genetic | src/wann_genetic/individual/numpy/ffnn.py | c4a8a1db81665b2549994d615e1d347dbe00226a | import numpy as np
import sklearn
import logging
from wann_genetic.individual.network_base import BaseFFNN
def softmax(x, axis=-1):
"""Compute softmax values for each sets of scores in x.
Returns:
softmax - softmax normalized in dim axis
"""
e_x = np.exp(x - np.expand_dims(np.max(x,axis=axis)... | [((709, 726), 'numpy.empty', 'np.empty', (['x.shape'], {}), '(x.shape)\n', (717, 726), True, 'import numpy as np\n'), ((936, 999), 'numpy.array', 'np.array', (['[available_funcs[func][0] for func in selected_funcs]'], {}), '([available_funcs[func][0] for func in selected_funcs])\n', (944, 999), True, 'import numpy as n... |
uktrade/tamato | common/tests/util.py | 4ba2ffb25eea2887e4e081c81da7634cd7b4f9ca | import contextlib
from datetime import date
from datetime import datetime
from datetime import timezone
from functools import wraps
from io import BytesIO
from itertools import count
from typing import Any
from typing import Dict
from typing import Sequence
import pytest
from dateutil.parser import parse as parse_date... | [((1138, 1228), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not COMMODITIES_IMPLEMENTED)'], {'reason': '"""Commodities not implemented"""'}), "(not COMMODITIES_IMPLEMENTED, reason=\n 'Commodities not implemented')\n", (1156, 1228), False, 'import pytest\n'), ((1274, 1394), 'pytest.mark.skipif', 'pytest.mark.skip... |
Leeo1124/pythonDemo | src/com/python/email/send_mail.py | 72e2209c095301a3f1f61edfe03ea69c3c05be40 | '''
Created on 2016年8月10日
@author: Administrator
'''
from email import encoders
from email.header import Header
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.multipart import MIMEBase
from email.utils import parseaddr, formataddr
import smtplib
def _format_addr(s)... | [((864, 879), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', ([], {}), '()\n', (877, 879), False, 'from email.mime.multipart import MIMEMultipart\n'), ((1820, 1849), 'smtplib.SMTP', 'smtplib.SMTP', (['smtp_server', '(25)'], {}), '(smtp_server, 25)\n', (1832, 1849), False, 'import smtplib\n'), ((339, 351), 'emai... |
aquilesC/aquicarattino | aqui_carattino/blog/migrations/0002_auto_20200424_1452.py | b6d873aea6e3ec9d1b802ea13952746e4fcc22b6 | # Generated by Django 3.0.5 on 2020-04-24 12:52
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.contrib.taggit
import modelcluster.fields
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
depend... | [((677, 847), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'auto_created': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'parent_link': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'to': '"""wagtailcore.Page"""'}), "(auto_created=True, on_delete=django.db.models.deletion\n... |
openforcefield/nistdataselection | studies/mixture_feasibility/parsley_benchmark/alcohol_ester/run.py | d797d597f4ff528a7219d58daa8ef6508d438b24 | from evaluator import unit
from evaluator.backends import QueueWorkerResources
from evaluator.backends.dask import DaskLSFBackend
from evaluator.client import ConnectionOptions, EvaluatorClient
from evaluator.datasets import PhysicalPropertyDataSet
from evaluator.forcefield import SmirnoffForceFieldSource
from evaluato... | [((423, 448), 'evaluator.utils.setup_timestamp_logging', 'setup_timestamp_logging', ([], {}), '()\n', (446, 448), False, 'from evaluator.utils import setup_timestamp_logging\n'), ((550, 602), 'evaluator.forcefield.SmirnoffForceFieldSource.from_path', 'SmirnoffForceFieldSource.from_path', (['force_field_path'], {}), '(f... |
motional/nuplan-devkit | nuplan/planning/simulation/observation/idm/test/test_profile_idm_observation.py | e39029e788b17f47f2fcadb774098ef8fbdd0d67 | import logging
import unittest
from pyinstrument import Profiler
from nuplan.planning.scenario_builder.nuplan_db.test.nuplan_scenario_test_utils import get_test_nuplan_scenario
from nuplan.planning.simulation.history.simulation_history_buffer import SimulationHistoryBuffer
from nuplan.planning.simulation.observation.... | [((465, 492), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (482, 492), False, 'import logging\n'), ((493, 532), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (512, 532), False, 'import logging\n'), ((2252, 2267), 'unittest.main'... |
RDaneelOlivav/baselines | baselines/ddpg/ddpg.py | fea6ba932055bb76d68b4b22e812bab738fc18f8 | import os
import os.path as osp
import time
from collections import deque
import pickle
from baselines.ddpg.ddpg_learner import DDPG
from baselines.ddpg.models import Actor, Critic
from baselines.ddpg.memory import Memory
from baselines.ddpg.noise import AdaptiveParamNoiseSpec, NormalActionNoise, OrnsteinUhlenbeckActi... | [((1363, 1385), 'baselines.common.set_global_seeds', 'set_global_seeds', (['seed'], {}), '(seed)\n', (1379, 1385), False, 'from baselines.common import set_global_seeds\n'), ((1948, 2043), 'baselines.ddpg.models.Critic', 'Critic', (['nb_actions'], {'ob_shape': 'env.observation_space.shape', 'network': 'network'}), '(nb... |
enwawerueli/footprints | footprints/transaction_details.py | d9b2a0064b21495edfd0563cb521b0675ee4363d | import os
from datetime import datetime
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from PySide2.QtPrintSupport import QPrinter, QPrintDialog
from jinja2 import TemplateNotFound
from .ui.ui_transaction_details import Ui_TransactionDetails
from .ui import images_rc
from . i... | [((1157, 1167), 'PySide2.QtPrintSupport.QPrinter', 'QPrinter', ([], {}), '()\n', (1165, 1167), False, 'from PySide2.QtPrintSupport import QPrinter, QPrintDialog\n'), ((1228, 1250), 'os.environ.get', 'os.environ.get', (['"""HOME"""'], {}), "('HOME')\n", (1242, 1250), False, 'import os\n'), ((1731, 1745), 'datetime.datet... |
FeiLi5/git-github.com-yt-project-yt | yt/units/yt_array.py | 0c6cf75351b91e4da80f6a0207ebbcb73dd72a59 | """
YTArray class.
"""
from __future__ import print_function
#-----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this so... | [((2243, 2249), 'yt.units.unit_object.Unit', 'Unit', ([], {}), '()\n', (2247, 2249), False, 'from yt.units.unit_object import Unit, UnitParseError\n'), ((2777, 2812), 'yt.utilities.lru_cache.lru_cache', 'lru_cache', ([], {'maxsize': '(128)', 'typed': '(False)'}), '(maxsize=128, typed=False)\n', (2786, 2812), False, 'fr... |
MahmoudMagdi20/django_rest_blog_api | src/posts/api/serializers.py | e1969c75e20b4d807baf26051924a0b99a23b4dc | from rest_framework import serializers
from posts.models import Post
class PostCreateUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = Post
fields = [
#'id',
'title',
#'slug',
'content',
'publish',
]
post_detail_... | [((326, 417), 'rest_framework.serializers.HyperlinkedIdentityField', 'serializers.HyperlinkedIdentityField', ([], {'view_name': '"""posts-api:detail"""', 'lookup_field': '"""slug"""'}), "(view_name='posts-api:detail',\n lookup_field='slug')\n", (362, 417), False, 'from rest_framework import serializers\n'), ((524, 5... |
98llm/tir-script-samples | Protheus_WebApp/Modules/SIGAGTP/GTPA036ETestCase.py | 0bff8393b79356aa562e9e6512c11ee6e039b177 | from tir import Webapp
import unittest
class GTPA036E(unittest.TestCase):
@classmethod
def setUpClass(inst):
inst.oHelper = Webapp()
inst.oHelper.Setup("SIGAGTP", "05/08/2020", "T1", "D MG 01 ")
inst.oHelper.Program('GTPA036')
def test_GTPA036E_CT001(self):
self.oHelper.SetButton('Avançar')
... | [((1069, 1084), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1082, 1084), False, 'import unittest\n'), ((130, 138), 'tir.Webapp', 'Webapp', ([], {}), '()\n', (136, 138), False, 'from tir import Webapp\n')] |
lovebirdegg/nnms-server | code_tmpl/views.py | 9fd4563ccca9f29add375d346cdd1c2dd636c512 | # @Time : {time}
# @Author : code_generator
from rest_framework.viewsets import ModelViewSet
from rest_framework.generics import ListAPIView
from rest_framework.filters import SearchFilter, OrderingFilter
from rest_framework.response import Response
from rest_framework.decorators import api_view,authentication_cla... | [] |
art19/netuitive-diamond | src/collectors/heartbeat/heartbeat.py | 57f61f2444e6f3d3692b4ee989415939bfaa932e | # coding=utf-8
"""
Send a value of 1 as a heartbeat every time this collector is invoked.
#### Dependencies
None
#### Usage
Add the collector config as :
enabled = True
path = netuitive
Metrics are collected as :
- metrics.heartbeat
Netuitive Change History
========================
DVG 2016/11/14 In... | [((1565, 1618), 'netuitive.Check', 'netuitive.Check', (['"""heartbeat"""', 'self.hostname', 'self.ttl'], {}), "('heartbeat', self.hostname, self.ttl)\n", (1580, 1618), False, 'import netuitive\n'), ((1187, 1353), 'netuitive.Client', 'netuitive.Client', ([], {'url': "self.config['netuitive_url']", 'api_key': "self.confi... |
vitorebatista/AVEMH | process_script/stat.py | 1c0bea3ae6c35729b80ba49b9663ce83ea43922d | import numpy as np
import pandas as pd
import sys
markets = ["hangseng", "dax", "ftse", "sp", "nikkei"]
market = markets[int(sys.argv[1])-1]
# read GD data file
dat = pd.read_csv("./num_res/{}.GD.csv".format(market))
# split into two experiments
exp1_GD = dat[dat.columns[:5]]
exp2_GD = dat[dat.columns[5:... | [((5899, 5999), 'pandas.concat', 'pd.concat', (['[stat1_GD, stat1_Spacing, stat1_MaxSpread, stat1_Delta, stat1_IGD,\n stat1_Hypervolume]'], {}), '([stat1_GD, stat1_Spacing, stat1_MaxSpread, stat1_Delta, stat1_IGD,\n stat1_Hypervolume])\n', (5908, 5999), True, 'import pandas as pd\n'), ((6019, 6119), 'pandas.conca... |
zmlabe/ThicknessSensitivity | Scripts/calc_Utilities.py | 6defdd897a61d7d1a02f34a9f4ec92b2b17b3075 | """
Functions are useful untilities for SITperturb experiments
Notes
-----
Author : Zachary Labe
Date : 13 August 2017
Usage
-----
[1] calcDecJan(varx,vary,lat,lon,level,levsq)
[2] calcDecJanFeb(varx,vary,lat,lon,level,levsq)
[3] calc_indttest(varx,vary)
[4] calc_weightedAve(var,lats)
... | [((9848, 9892), 'scipy.stats.ttest_ind', 'sts.ttest_ind', (['varx', 'vary'], {'nan_policy': '"""omit"""'}), "(varx, vary, nan_policy='omit')\n", (9861, 9892), True, 'import scipy.stats as sts\n'), ((1888, 1945), 'numpy.empty', 'np.empty', (['(varx.shape[0] - 1, lat.shape[0], lon.shape[0])'], {}), '((varx.shape[0] - 1, ... |
xiebaiyuan/tvm | tests/python/unittest/test_tir_schedule_compute_inline.py | 726239d788e3b90cbe4818271ca5361c46d8d246 | # 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... | [((1063, 1094), 'tvm.tir.match_buffer', 'tir.match_buffer', (['a', '(128, 128)'], {}), '(a, (128, 128))\n', (1079, 1094), False, 'from tvm import tir\n'), ((1103, 1131), 'tvm.tir.alloc_buffer', 'tir.alloc_buffer', (['(128, 128)'], {}), '((128, 128))\n', (1119, 1131), False, 'from tvm import tir\n'), ((1140, 1171), 'tvm... |
Sage-Bionetworks/workflow-service | cwl_flask.py | 8b5dc0afe9ea0972014cdf48a693ee6f893cfe5e | from flask import Flask, Response, request, redirect
import subprocess
import tempfile
import json
import yaml
import signal
import threading
import time
import copy
app = Flask(__name__)
jobs_lock = threading.Lock()
jobs = []
class Job(threading.Thread):
def __init__(self, jobid, path, inputobj):
super... | [((173, 188), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (178, 188), False, 'from flask import Flask, Response, request, redirect\n'), ((202, 218), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (216, 218), False, 'import threading\n'), ((2719, 2757), 'flask.redirect', 'redirect', (["('/jobs/%i'... |
JulyKikuAkita/PythonPrac | cs15211/ReverseBits.py | 0ba027d9b8bc7c80bc89ce2da3543ce7a49a403c | __source__ = 'https://leetcode.com/problems/reverse-bits/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/reverse-bits.py
# Time : O(n)
# Space: O(1)
# Bit Manipulation
#
# Description: Leetcode # 190. Reverse Bits
#
# Reverse bits of a given 32 bits unsigned integer.
#
# For example, given input... | [] |
freezecoder/tibanna | tibanna/_version.py | 89b02e95d04b9c630a9786f4d1eb8157c40098e0 | """Version information."""
# The following line *must* be the last in the module, exactly as formatted:
__version__ = "0.16.1"
| [] |
vs-slavchev/selective_merge_pdf | selective_merge_pdf.py | b24b4dbcaf1ffb8dc0924dafec56f94e452c1ebd | from sys import argv
from PyPDF2 import PdfFileReader, PdfFileWriter
import re
range_pattern = re.compile(r'(\d+)(\.\.|-)(\d+)')
comma_pattern = re.compile('\d+(,\d+)*')
def pages_args_to_array(pages_str):
groups = range_pattern.search(pages_str)
if groups:
start = int(groups.group(1))
end = int(groups.group(3)... | [((97, 133), 're.compile', 're.compile', (['"""(\\\\d+)(\\\\.\\\\.|-)(\\\\d+)"""'], {}), "('(\\\\d+)(\\\\.\\\\.|-)(\\\\d+)')\n", (107, 133), False, 'import re\n'), ((147, 173), 're.compile', 're.compile', (['"""\\\\d+(,\\\\d+)*"""'], {}), "('\\\\d+(,\\\\d+)*')\n", (157, 173), False, 'import re\n'), ((845, 860), 'PyPDF2... |
romack77/vp-toolbox | vp/scoring.py | 2677b78b80d0b4794735f3ee9bd70403c6b884e6 | import math
from vp import geom_tools
def horizon_error(ground_truth_horizon, detected_horizon, image_dims):
"""Calculates error in a detected horizon.
This measures the max distance between the detected horizon line and
the ground truth horizon line, within the image's x-axis, and
normalized by ima... | [((1771, 1862), 'vp.geom_tools.get_line_angle', 'geom_tools.get_line_angle', (['(principal_point[0], principal_point[1], gt_vp[0], gt_vp[1])'], {}), '((principal_point[0], principal_point[1], gt_vp[0],\n gt_vp[1]))\n', (1796, 1862), False, 'from vp import geom_tools\n'), ((1899, 1990), 'vp.geom_tools.get_line_angle'... |
collassubmission91/CompoSuite-Code | compositional-rl-benchmark/composition/spinningup_training/train_mtl_ppo.py | ac544efb68a11ed8a483b0932975c4949f0cec90 | import numpy as np
import argparse
import composition
import os
import json
import torch
from spinup.algos.pytorch.ppo.core import MLPActorCritic
from spinup.algos.pytorch.ppo.ppo import ppo
from spinup.utils.run_utils import setup_logger_kwargs
from spinup.utils.mpi_tools import proc_id, num_procs
def parse_args()... | [((335, 360), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (358, 360), False, 'import argparse\n'), ((1997, 2022), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (2011, 2022), True, 'import numpy as np\n'), ((2998, 3022), 'torch.set_num_threads', 'torch.set_num_t... |
m4sterchain/mesapy | pypy/interpreter/test/test_generator.py | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | class AppTestGenerator:
def test_generator(self):
def f():
yield 1
assert f().next() == 1
def test_generator2(self):
def f():
yield 1
g = f()
assert g.next() == 1
raises(StopIteration, g.next)
def test_attributes(self):
def f... | [] |
innogames/igvm | igvm/cli.py | 6c4bd98d61ebaf6280698e74d560ea5b3d70cd9e | """igvm - The command line interface
Copyright (c) 2017 InnoGames GmbH
"""
from __future__ import print_function
from argparse import ArgumentParser, _SubParsersAction
from logging import StreamHandler, root as root_logger
import time
from fabric.network import disconnect_all
from igvm.commands import (
change_... | [((15035, 15062), 'logging.root.setLevel', 'root_logger.setLevel', (['level'], {}), '(level)\n', (15055, 15062), True, 'from logging import StreamHandler, root as root_logger\n'), ((14255, 14271), 'fabric.network.disconnect_all', 'disconnect_all', ([], {}), '()\n', (14269, 14271), False, 'from fabric.network import dis... |
puraminy/OpenPrompt | test/test_data_processor/test_condition_generation_dataset.py | 49f0ed9719bb6285e94c746de4511991c848492c | import os, sys
from os.path import dirname as d
from os.path import abspath, join
root_dir = d(d(d(abspath(__file__))))
sys.path.append(root_dir)
from openprompt.data_utils.conditional_generation_dataset import PROCESSORS
base_path = os.path.join(root_dir, "datasets/CondGen")
def test_WebNLGProcessor():
dataset_n... | [((120, 145), 'sys.path.append', 'sys.path.append', (['root_dir'], {}), '(root_dir)\n', (135, 145), False, 'import os, sys\n'), ((235, 277), 'os.path.join', 'os.path.join', (['root_dir', '"""datasets/CondGen"""'], {}), "(root_dir, 'datasets/CondGen')\n", (247, 277), False, 'import os, sys\n'), ((359, 396), 'os.path.joi... |
JayLeeCompal/EDKII_Git | BaseTools/Source/Python/Common/BuildToolError.py | de4800d50e1f357002bf77235d3bebabd0c00007 | ## @file
# Standardized Error Hanlding infrastructures.
#
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text... | [] |
allenai/ViRB | datasets/SUN397EncodbleDataset.py | fbe1c42571ce0994b1e41bc4bdf88cf9658ae48b | import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
import glob
from PIL import Image
import random
class SUN397EncodableDataset(Dataset):
"""SUN397 encodable dataset class"""
def __init__(self, train=True):
super().__init__()
path = 'data/SUN397/trai... | [((422, 447), 'random.shuffle', 'random.shuffle', (['self.data'], {}), '(self.data)\n', (436, 447), False, 'import random\n'), ((987, 1007), 'torch.is_tensor', 'torch.is_tensor', (['idx'], {}), '(idx)\n', (1002, 1007), False, 'import torch\n'), ((397, 412), 'glob.glob', 'glob.glob', (['path'], {}), '(path)\n', (406, 41... |
tirkarthi/python-cybox | cybox/common/location.py | a378deb68b3ac56360c5cc35ff5aad1cd3dcab83 | # Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import entities, fields
import cybox
import cybox.bindings.cybox_common as common_binding
class LocationFactory(entities.EntityFactory):
@classmethod
def entity_class(cls, key):
return... | [((592, 615), 'mixbox.fields.IdrefField', 'fields.IdrefField', (['"""id"""'], {}), "('id')\n", (609, 615), False, 'from mixbox import entities, fields\n'), ((628, 654), 'mixbox.fields.IdrefField', 'fields.IdrefField', (['"""idref"""'], {}), "('idref')\n", (645, 654), False, 'from mixbox import entities, fields\n'), ((6... |
varlociraptor/prosic-evaluation | scripts/bam-stats.py | f4f1950ba5c10bda0f41df2a8f519d98f779d736 | #!/usr/bin/env python
import sys
import numpy as np
import pandas as pd
import pysam
import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
import seaborn as sns
from functools import partial
tumor = pysam.AlignmentFile(snakemake.input[0], "rb")
normal = pysam.AlignmentFile(snakemake.input[1], "rb")
... | [((104, 125), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (118, 125), False, 'import matplotlib\n'), ((219, 264), 'pysam.AlignmentFile', 'pysam.AlignmentFile', (['snakemake.input[0]', '"""rb"""'], {}), "(snakemake.input[0], 'rb')\n", (238, 264), False, 'import pysam\n'), ((274, 319), 'pysam.Al... |
RSaab/rss-scraper | app/rss_feeder_api/migrations/0003_auto_20200813_1623.py | 9bf608878e7d08fea6508ae90b27f1c226b313f1 | # Generated by Django 3.1 on 2020-08-13 16:23
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('rss_feeder_api', '0002_feed_subtitle'),
]
operations = [
migrations.AlterModelOptions(
name='entry',
... | [((264, 385), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""entry"""', 'options': "{'ordering': ('-updated_at',), 'verbose_name_plural': 'entries'}"}), "(name='entry', options={'ordering': (\n '-updated_at',), 'verbose_name_plural': 'entries'})\n", (292, 385), False, 'fr... |
MetaMain/BewareAdvML | AdversarialSampleGeneratorV11/AdversarialSampleGeneratorV11/ResNetConstructor.py | 52d489b565b0df36cb588b5709c29c2e8e4d3f49 | import tensorflow
from tensorflow import keras
Model = keras.models.Model
Dense = keras.layers.Dense
Activation = keras.layers.Activation
Flatten = keras.layers.Flatten
BatchNormalization= keras.layers.BatchNormalization
Conv2D = tensorflow.keras.layers.Conv2D
AveragePooling2D = keras.layers.AveragePooling2D
I... | [((4292, 4327), 'tensorflow.keras.layers.add', 'tensorflow.keras.layers.add', (['[x, y]'], {}), '([x, y])\n', (4319, 4327), False, 'import tensorflow\n')] |
the-norman-sicily-project/genealogical-trees | ttl2json.py | 32fa4f25861ae34543b0a6b95e54842c0018331b | #!/usr/bin/env python3
import sys
import json
import rdflib
import rdflib.plugins.sparql as sparql
RELS_TO_DRAW = ['isWifeOf', 'isMotherOf', 'isFatherOf', 'isHusbandOf', 'isSpouseOf']
RELS_TO_INFER = ['hasGrandParent', 'isGrandParentOf', 'hasGreatGrandParent',
'isGreatGrandParentOf', 'isUncleOf', 'ha... | [((884, 898), 'rdflib.Graph', 'rdflib.Graph', ([], {}), '()\n', (896, 898), False, 'import rdflib\n'), ((1029, 1055), 'rdflib.Namespace', 'rdflib.Namespace', (['fhkb_str'], {}), '(fhkb_str)\n', (1045, 1055), False, 'import rdflib\n'), ((1069, 1097), 'rdflib.Namespace', 'rdflib.Namespace', (['schema_str'], {}), '(schema... |
BearerPipelineTest/synapse-1 | tests/rest/client/test_login.py | 78b99de7c206b106340e12cdee0af9aa246bd5ad | # Copyright 2019-2021 The Matrix.org Foundation C.I.C.
#
# 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... | [((16039, 16101), 'tests.unittest.skip_unless', 'skip_unless', (['(has_saml2 and HAS_OIDC)', '"""Requires SAML2 and OIDC"""'], {}), "(has_saml2 and HAS_OIDC, 'Requires SAML2 and OIDC')\n", (16050, 16101), False, 'from tests.unittest import HomeserverTestCase, override_config, skip_unless\n'), ((33304, 33340), 'tests.un... |
Kevinskwk/rmf_demos | rmf_demo_tasks/rmf_demo_tasks/request_delivery.py | 2d7b9c7c75211b89b91977e5d1a66f440cc5df95 |
import argparse
import sys
from time import sleep
import uuid
import rclpy
from rmf_task_msgs.msg import Delivery
def main(argv = sys.argv):
rclpy.init(args=argv)
args_without_ros = rclpy.utilities.remove_ros_args(argv)
'''
# Example request:
task_id: randomid_001
items: [itemA, itemB....]
... | [((149, 170), 'rclpy.init', 'rclpy.init', ([], {'args': 'argv'}), '(args=argv)\n', (159, 170), False, 'import rclpy\n'), ((194, 231), 'rclpy.utilities.remove_ros_args', 'rclpy.utilities.remove_ros_args', (['argv'], {}), '(argv)\n', (225, 231), False, 'import rclpy\n'), ((659, 684), 'argparse.ArgumentParser', 'argparse.... |
BoredManCodes/Dis-Snek | dis_snek/api/http/http_client.py | 662dbc3f86c133fd704c22d3d6d55af5ee1f6f5b | """This file handles the interaction with discords http endpoints."""
import asyncio
import logging
from typing import Any, Dict, Optional, Union
from urllib.parse import quote as _uriquote
from weakref import WeakValueDictionary
import aiohttp
from aiohttp import BaseConnector, ClientSession, ClientWebSocketResponse,... | [((1138, 1168), 'logging.getLogger', 'logging.getLogger', (['logger_name'], {}), '(logger_name)\n', (1155, 1168), False, 'import logging\n'), ((1308, 1329), 'dis_snek.models.CooldownSystem', 'CooldownSystem', (['(45)', '(1)'], {}), '(45, 1)\n', (1322, 1329), False, 'from dis_snek.models import CooldownSystem\n'), ((145... |
conradsuuna/uac-computer-competency | config.py | 40f8b165e5432ca22ab97838f424e26650a3d300 | from os import environ
import psycopg2
from datetime import timedelta
from dotenv import load_dotenv
load_dotenv()
class Config(object):
""" app configuration class """
TESTING = False
CSRF_ENABLED = True
SECRET_KEY = environ.get('SECRET_KEY')
USER = environ.get('DB_USER')
PASSWORD = environ.g... | [((101, 114), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (112, 114), False, 'from dotenv import load_dotenv\n'), ((235, 260), 'os.environ.get', 'environ.get', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (246, 260), False, 'from os import environ\n'), ((273, 295), 'os.environ.get', 'environ.get', (['"""D... |
c4pt000/electrum-radiocoin | electrum/version.py | 7cb5f618a9aa8cd03d60191624a0e57cc24646d2 | ELECTRUM_VERSION = '4.1.5-radc' # version of the client package
APK_VERSION = '4.1.5.0' # read by buildozer.spec
PROTOCOL_VERSION = '1.4' # protocol version requested
# The hash of the mnemonic seed must begin with this
SEED_PREFIX = '01' # Standard wallet
SEED_PREFIX_SW = '100' # S... | [] |
arleyzhang/object-detection-pytorch | lib/layers/functions/prior_box.py | de96a507e6643a7019b94d92f77219439ccca29f | from __future__ import division
from math import sqrt as sqrt
from itertools import product as product
import torch
import numpy as np
import cv2
from lib.utils.visualize_utils import TBWriter
def vis(func):
"""tensorboard visualization if has writer as input"""
def wrapper(*args, **kw):
return func... | [((5886, 5904), 'copy.deepcopy', 'copy.deepcopy', (['cfg'], {}), '(cfg)\n', (5899, 5904), False, 'import copy\n'), ((6247, 6265), 'copy.deepcopy', 'copy.deepcopy', (['cfg'], {}), '(cfg)\n', (6260, 6265), False, 'import copy\n'), ((6845, 6863), 'copy.deepcopy', 'copy.deepcopy', (['cfg'], {}), '(cfg)\n', (6858, 6863), Fa... |
cwmartin/gaffer | python/Gaffer/SequencePath.py | 1f8a0f75522105c9d5efefac6d55cb61c1038909 | ##########################################################################
#
# Copyright (c) 2012-2013, Image Engine Design 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:
#
# * Redi... | [((2502, 2524), 'Gaffer.Path.info', 'Gaffer.Path.info', (['self'], {}), '(self)\n', (2518, 2524), False, 'import Gaffer\n'), ((3963, 4024), 'IECore.findSequences', 'IECore.findSequences', (['leafPathStrings', 'self.__minSequenceSize'], {}), '(leafPathStrings, self.__minSequenceSize)\n', (3983, 4024), False, 'import IEC... |
NREL/REopt_API | reo/migrations/0121_merge_20211001_1841.py | fbc70f3b0cdeec9ee220266d6b3b0c5d64f257a6 | # Generated by Django 3.1.13 on 2021-10-01 18:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('reo', '0117_financialmodel_generator_fuel_escalation_pct'),
('reo', '0120_auto_20210927_2046'),
('reo', '0121_auto_20211012_0305')
]
operat... | [] |
ckamtsikis/cmssw | PhysicsTools/Heppy/python/analyzers/objects/TauAnalyzer.py | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | from PhysicsTools.Heppy.analyzers.core.Analyzer import Analyzer
from PhysicsTools.Heppy.analyzers.core.AutoHandle import AutoHandle
from PhysicsTools.Heppy.physicsobjects.Tau import Tau
from PhysicsTools.HeppyCore.utils.deltar import deltaR, matchObjectCollection3
import PhysicsTools.HeppyCore.framework.config as cfg... | [((6681, 7442), 'PhysicsTools.HeppyCore.framework.config.Analyzer', 'cfg.Analyzer', ([], {'class_object': 'TauAnalyzer', 'inclusive_ptMin': '(18)', 'inclusive_etaMax': '(9999)', 'inclusive_dxyMax': '(1000.0)', 'inclusive_dzMax': '(0.4)', 'inclusive_vetoLeptons': '(False)', 'inclusive_leptonVetoDR': '(0.4)', 'inclusive_... |
omuryorulmaz/kriptografi | vize/170401038.py | 04c22e4f05f126b14f41842597a7b27065326670 | # İsmail ALTAY 170401038
import math
import random
r = 3271
def egcd(a,b):
if(a == 0):
return(b,0,1)
else:
c,d,e = egcd(b % a, a)
return(c, e - (b // a) * d, d)
def modInvert(a,b):
c,d,e = egcd(a,b)
if c != 1:
raise Exception('moduler ters bulunamad... | [((394, 432), 'random.randrange', 'random.randrange', (['(2 ** (n - 1))', '(2 ** n)'], {}), '(2 ** (n - 1), 2 ** n)\n', (410, 432), False, 'import random\n'), ((903, 929), 'random.randrange', 'random.randrange', (['(2)', '(p - 2)'], {}), '(2, p - 2)\n', (919, 929), False, 'import random\n'), ((1375, 1397), 'random.rand... |
xapple/seqenv | seqenv/ontology.py | a898b936b64b51340f439b05fc8909f4ed826247 | # Built-in modules #
# Internal modules #
from seqenv import module_dir
from seqenv.common.cache import property_cached
# Third party modules #
import sh, networkx
import matplotlib.colors
# A list of envos to help test this module #
test_envos = [
"ENVO:00000033",
"ENVO:00000043",
"ENVO:00000067",
"... | [] |
adewaleo/azure-sdk-for-python | sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models.py | 169457edbea5e3c5557246cfcf8bd635d528bae4 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [] |
cognifloyd/st2-open-rbac | tests/unit/controllers/v1/test_rbac_for_supported_st2api_endpoints.py | fb3251223743e497267277fe9f5cef91f41ade34 | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | [((1631, 2193), 'collections.OrderedDict', 'OrderedDict', (["[('runners', ['testrunner1.yaml', 'run-local.yaml']), ('sensors', [\n 'sensor1.yaml']), ('actions', ['action1.yaml', 'local.yaml']), (\n 'aliases', ['alias1.yaml']), ('triggers', ['trigger1.yaml',\n 'cron1.yaml']), ('rules', ['rule1.yaml']), ('trigge... |
dtrawins/seldon-core | testing/scripts/test_ksonnet_single_namespace.py | 3d8b3791b343118953757a1e787e5919cc64e697 | import pytest
import time
import subprocess
from subprocess import run,Popen
from seldon_utils import *
from k8s_utils import *
def wait_for_shutdown(deploymentName):
ret = run("kubectl get deploy/"+deploymentName, shell=True)
while ret.returncode == 0:
time.sleep(1)
ret = run("kubectl get depl... | [((1033, 1078), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""seldon_java_images"""'], {}), "('seldon_java_images')\n", (1056, 1078), False, 'import pytest\n'), ((1080, 1138), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""single_namespace_seldon_ksonnet"""'], {}), "('single_namespace_seldon_... |
enthought/etsproxy | enthought/envisage/safeweakref.py | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | # proxy module
from __future__ import absolute_import
from envisage.safeweakref import *
| [] |
alissonmuller/django-group-by | test_app/models.py | 645c36ad2c3ab1f4691de6fcc04fed8b5d7ef78d | from django.db import models
from .query import BookQuerySet
class Book(models.Model):
objects = BookQuerySet.as_manager()
title = models.CharField(max_length=50)
publication_date = models.DateTimeField()
author = models.ForeignKey('Author')
genres = models.ManyToManyField('Genre')
class Autho... | [((143, 174), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (159, 174), False, 'from django.db import models\n'), ((198, 220), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {}), '()\n', (218, 220), False, 'from django.db import models\n'), ((234, 2... |
whj363636/CamDrop | ResNet/dropblock.py | f8af8c200665145f112b59348f60fc4cf80f04ec | # -*- coding: utf-8 -*-
# File: dropblock.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
import six
# from tensorpack.tfutils.compat import tfv1 as tf # this should be avoided first in model code
from tensorpack.tfutils.tower import get_curren... | [((1674, 1701), 'tensorpack.tfutils.tower.get_current_tower_context', 'get_current_tower_context', ([], {}), '()\n', (1699, 1701), False, 'from tensorpack.tfutils.tower import get_current_tower_context\n'), ((2773, 2810), 'tensorflow.expand_dims', 'tf.expand_dims', (['valid_block_center', '(0)'], {}), '(valid_block_cen... |
Purple-PI/rlstructures | tutorial/deprecated/tutorial_recurrent_policy/main_a2c.py | 9b201b083715bbda2f3534b010c84e11dfc0a1c7 | #
# 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.
#
from rlstructures import logging
from rlstructures.env_wrappers import GymEnv, GymEnvInf
from rlstructures.tools import weight_init
impor... | [((793, 811), 'gym.make', 'gym.make', (['env_name'], {}), '(env_name)\n', (801, 811), False, 'import gym\n'), ((1063, 1081), 'rlstructures.env_wrappers.GymEnv', 'GymEnv', (['envs', 'seed'], {}), '(envs, seed)\n', (1069, 1081), False, 'from rlstructures.env_wrappers import GymEnv, GymEnvInf\n'), ((1339, 1360), 'rlstruct... |
buchmuseum/GND_Dashboard | dashboard/gnd-app.py | c8c039bc8c09c480fc5ab8a0b186cd9dc37d7423 | from matplotlib.pyplot import title
import streamlit as st
import pandas as pd
import altair as alt
import pydeck as pdk
import os
import glob
from wordcloud import WordCloud
import streamlit_analytics
path = os.path.dirname(__file__)
streamlit_analytics.start_tracking()
@st.cache
def load_gnd_top_daten(typ):
gn... | [((210, 235), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (225, 235), False, 'import os\n'), ((237, 273), 'streamlit_analytics.start_tracking', 'streamlit_analytics.start_tracking', ([], {}), '()\n', (271, 273), False, 'import streamlit_analytics\n'), ((16582, 16607), 'streamlit.title', 's... |
amandalynne/Seattle-Mobility-Index | seamo/support/seamo_exceptions.py | f21d2fa6913ce9474aedc298e9e4a6e7c9390e64 | """
Class for all excpetions used in following scripts
- geocoder.py
- geocoder_input.py
"""
class OverlappingGeographyError(Exception):
def __init__(self, message):
self.message = message
# msg: geodataframe has overlapping polygons representing geographic features
# please how shapefiles are pro... | [] |
hasan-se/blm304 | vize/150401052/sunucu.py | 893d15282497a426ff96b0c8b6c77d57c406742e | #Erdin Alhas 150401052
import os
import sys
import time
from socket import *
from os import system, name
ip = '127.0.0.1'
port = 42
s_soket = socket(AF_INET, SOCK_DGRAM)
s_soket.bind((ip, port))
print("\nSunucu Hazir\n")
kontrol, istemciAdres = s_soket... | [((707, 717), 'sys.exit', 'sys.exit', ([], {}), '()\n', (715, 717), False, 'import sys\n'), ((566, 578), 'os.listdir', 'os.listdir', ([], {}), '()\n', (576, 578), False, 'import os\n'), ((2836, 2846), 'sys.exit', 'sys.exit', ([], {}), '()\n', (2844, 2846), False, 'import sys\n'), ((3010, 3020), 'sys.exit', 'sys.exit', ... |
panyuan209/httprunner | httprunner/compat.py | d90f2b9ab06963e8efa1c327975fca5296d6bc39 | """
This module handles compatibility issues between testcase format v2 and v3.
解决httprunner2 和 3 之间测试用例兼容性问题
"""
import os
import sys
from typing import List, Dict, Text, Union, Any
from loguru import logger
from httprunner import exceptions
from httprunner.loader import load_project_meta, convert_relative_project_r... | [((4234, 4282), 'httprunner.utils.sort_dict_by_custom_order', 'sort_dict_by_custom_order', (['request', 'custom_order'], {}), '(request, custom_order)\n', (4259, 4282), False, 'from httprunner.utils import sort_dict_by_custom_order\n'), ((4566, 4611), 'httprunner.utils.sort_dict_by_custom_order', 'sort_dict_by_custom_o... |
ContinuumIO/chaco | examples/demo/basic/scatter.py | e4a42b91cb25ef7191fd465caaef2c3256fc668e | """
Scatter plot with panning and zooming
Shows a scatter plot of a set of random points,
with basic Chaco panning and zooming.
Interacting with the plot:
- Left-mouse-drag pans the plot.
- Mouse wheel up and down zooms the plot in and out.
- Pressing "z" brings up the Zoom Box, and you can click-drag a recta... | [((1150, 1164), 'numpy.random.random', 'random', (['numpts'], {}), '(numpts)\n', (1156, 1164), False, 'from numpy.random import random\n'), ((1228, 1243), 'chaco.api.ArrayPlotData', 'ArrayPlotData', ([], {}), '()\n', (1241, 1243), False, 'from chaco.api import ArrayPlotData, Plot\n'), ((1334, 1342), 'chaco.api.Plot', '... |
fbalak/webstr | webstr/core/config.py | 7c7e552fb9943bf664b94ca75a88747c0b243722 | """
Central configuration module of webstr selenium tests.
This module provides configuration options along with default values and
function to redefine values.
"""
# Copyright 2016 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... | [] |
PiotrBosowski/feat-genes | operations/mutations/mutation.py | 8e6604fd4e121022f8ac988d9b56985de01b8331 | import random
class Mutation:
def __init__(self, chrom_mut_chance, gen_mut_chance):
self.chrom_mut_chance = chrom_mut_chance
self.gen_mut_chance = gen_mut_chance
def __call__(self, population):
chroms_to_mutate = random.sample(
population,
round(self.chrom_mut_... | [] |
Ellis0817/Introduction-to-Programming-Using-Python | examples/CountLettersInList.py | 1882a2a846162d5ff56d4d56c3940b638ef408bd | import RandomCharacter # Defined in Listing 6.9
def main():
"""Main."""
# Create a list of characters
chars = createList()
# Display the list
print("The lowercase letters are:")
displayList(chars)
# Count the occurrences of each letter
counts = countLetters(chars)
# Display cou... | [((612, 654), 'RandomCharacter.getRandomLowerCaseLetter', 'RandomCharacter.getRandomLowerCaseLetter', ([], {}), '()\n', (652, 654), False, 'import RandomCharacter\n')] |
lightstep/dd-trace-py | ddtrace/contrib/vertica/__init__.py | 9108cbf54ff31f803eac735507ae6d2a87b9b45f | """
The Vertica integration will trace queries made using the vertica-python
library.
Vertica will be automatically instrumented with ``patch_all``, or when using
the ``ls-trace-run`` command.
Vertica is instrumented on import. To instrument Vertica manually use the
``patch`` function. Note the ordering of the follow... | [] |
kokosing/hue | desktop/core/ext-py/python-openid-2.2.5/openid/test/test_htmldiscover.py | 2307f5379a35aae9be871e836432e6f45138b3d9 | from openid.consumer.discover import OpenIDServiceEndpoint
import datadriven
class BadLinksTestCase(datadriven.DataDrivenTestCase):
cases = [
'',
"http://not.in.a.link.tag/",
'<link rel="openid.server" href="not.in.html.or.head" />',
]
def __init__(self, data):
datadriv... | [((596, 626), 'datadriven.loadTests', 'datadriven.loadTests', (['__name__'], {}), '(__name__)\n', (616, 626), False, 'import datadriven\n'), ((312, 362), 'datadriven.DataDrivenTestCase.__init__', 'datadriven.DataDrivenTestCase.__init__', (['self', 'data'], {}), '(self, data)\n', (350, 362), False, 'import datadriven\n'... |
chiehtu/kissaten | project/settings/production.py | a7aad01de569107d5fd5ed2cd781bca6e5750871 | from .base import *
SECRET_KEY = get_env_var('SECRET_KEY')
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
)
EMAIL_BACK... | [] |
ModelFlow/modelflow | modelflow/graph_viz_from_outputs.py | c2b720b2da8bb17462baff5c00bbe942644474b0 | import pandas as pd
import argparse
import json
try:
from graphviz import Digraph
except:
print("Note: Optional graphviz not installed")
def generate_graph(df, graph_format='pdf'):
g = Digraph('ModelFlow', filename='modelflow.gv', engine='neato', format=graph_format)
g.attr(overlap='false')
g.attr... | [((199, 286), 'graphviz.Digraph', 'Digraph', (['"""ModelFlow"""'], {'filename': '"""modelflow.gv"""', 'engine': '"""neato"""', 'format': 'graph_format'}), "('ModelFlow', filename='modelflow.gv', engine='neato', format=\n graph_format)\n", (206, 286), False, 'from graphviz import Digraph\n'), ((1681, 1695), 'pandas.D... |
link1345/Vol-GameClanTools-DiscordBot | src/command/voice_log/chart.py | c3349f38d59cba59161b8c54c172e39ba873c53d | import discord
import os
import json
import datetime
import pandas as pd
from dateutil.relativedelta import relativedelta
from pprint import pprint
import base.ColorPrint as CPrint
import command.voice_log.Config_Main as CSetting
def most_old_Month() :
old_month = 1
labels = []
fileNameList = []
while True :
... | [((4326, 4369), 'pandas.DataFrame', 'pd.DataFrame', (['df_dict'], {'index': 'members_IDlist'}), '(df_dict, index=members_IDlist)\n', (4338, 4369), True, 'import pandas as pd\n'), ((404, 446), 'datetime.datetime.strftime', 'datetime.datetime.strftime', (['filetime', '"""%m"""'], {}), "(filetime, '%m')\n", (430, 446), Fa... |
e1r0nd/codewars | 5kyu/(5 kyu) Count IP Addresses/(5 kyu) Count IP Addresses.py | 9b05e32a26ee5f36a4b3f1e76a71e0c79b3c865b | def ips_between(start, end):
calc = lambda n, m: (int(end.split(".")[n]) - int(start.split(".")[n])) * m
return calc(0, 256 * 256 * 256) + calc(1, 256 * 256) + calc(2, 256) + calc(3, 1)
| [] |
jayholman/vmaf | python/src/vmaf/core/feature_extractor.py | 0bba4faf68ab89e38314cc596e6908b4fb83984d | from abc import ABCMeta, abstractmethod
import os
from vmaf.tools.misc import make_absolute_path, run_process
from vmaf.tools.stats import ListStats
__copyright__ = "Copyright 2016-2018, Netflix, Inc."
__license__ = "Apache, Version 2.0"
import re
import numpy as np
import ast
from vmaf import ExternalProgramCaller,... | [((1573, 1607), 'vmaf.core.result.Result', 'Result', (['asset', 'executor_id', 'result'], {}), '(asset, executor_id, result)\n', (1579, 1607), False, 'from vmaf.core.result import Result\n'), ((6044, 6146), 'vmaf.ExternalProgramCaller.call_vmaf_feature', 'ExternalProgramCaller.call_vmaf_feature', (['yuv_type', 'ref_pat... |
rprops/Python_DS-WS | notebooks/_solutions/pandas_02_basic_operations28.py | b2fc449a74be0c82863e5fcf1ddbe7d64976d530 | df['Age'].hist() #bins=30, log=True | [] |
oopsteams/pansite | controller/base_service.py | 11896842da66efc72c26eab071f7f802b982f435 | # -*- coding: utf-8 -*-
"""
Created by susy at 2019/11/8
"""
from dao.dao import DataDao
import pytz
from dao.models import PanAccounts
from cfg import PAN_SERVICE, MASTER_ACCOUNT_ID
class BaseService:
def __init__(self):
self.default_tz = pytz.timezone('Asia/Chongqing')
# self.pan_acc: PanAccoun... | [((255, 286), 'pytz.timezone', 'pytz.timezone', (['"""Asia/Chongqing"""'], {}), "('Asia/Chongqing')\n", (268, 286), False, 'import pytz\n')] |
StateOfTheArt-quant/transformerquant | transformerquant/modules/attention/multi_head.py | f6775d7aa920b84908b0a09d9ba098b1fe87bdff | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import torch.nn as nn
from .single import attention
class MultiHeadedAttention(nn.Module):
def __init__(self, d_model, nhead, dropout=0.1):
super().__init__()
assert d_model % nhead ==0
# we assume d_v always equal d_k
s... | [((504, 531), 'torch.nn.Linear', 'nn.Linear', (['d_model', 'd_model'], {}), '(d_model, d_model)\n', (513, 531), True, 'import torch.nn as nn\n'), ((555, 576), 'torch.nn.Dropout', 'nn.Dropout', ([], {'p': 'dropout'}), '(p=dropout)\n', (565, 576), True, 'import torch.nn as nn\n'), ((427, 454), 'torch.nn.Linear', 'nn.Line... |
Julian-Theis/AVATAR | avatar/generalization.py | 24fcd6eaa26f413be528a160d865d5d7e49a780b | import os, time, argparse
from datetime import datetime
from pm4py.objects.log.importer.csv import factory as csv_importer
from pm4py.objects.log.exporter.xes import factory as xes_exporter
from pm4py.objects.log.importer.xes import factory as xes_importer
from pm4py.objects.petri.importer import pnml as pnml_importer... | [((526, 537), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (535, 537), False, 'import os, time, argparse\n'), ((2537, 2562), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2560, 2562), False, 'import os, time, argparse\n'), ((4595, 4608), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (460... |
uqtimes/Rust-SampleCodes | Introductions/The Rust Programming Language/embed/bindings/embed.py | f9d7a040d8198acd30bf3423e7c6cf52bc9c7b6e | # $ python embed.py
from ctypes import cdll
lib = cdll.LoadLibrary("../target/release/libembed.dylib") #=> for Mac
#lib = cdll.LoadLibrary("../target/release/libembed.so") #=> for Linux
lib.process()
print("done!")
| [((52, 104), 'ctypes.cdll.LoadLibrary', 'cdll.LoadLibrary', (['"""../target/release/libembed.dylib"""'], {}), "('../target/release/libembed.dylib')\n", (68, 104), False, 'from ctypes import cdll\n')] |
handsome-baby/huaweicloud-sdk-python-v3 | huaweicloud-sdk-image/huaweicloudsdkimage/v1/image_client.py | 6cdcf1da8b098427e58fc3335a387c14df7776d0 | # coding: utf-8
from __future__ import absolute_import
import datetime
import re
import importlib
import six
from huaweicloudsdkcore.client import Client, ClientBuilder
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcore.utils import http_utils
from huaweicloudsdkcore.sdk_stream_request imp... | [((1028, 1083), 'importlib.import_module', 'importlib.import_module', (['"""huaweicloudsdkimage.v1.model"""'], {}), "('huaweicloudsdkimage.v1.model')\n", (1051, 1083), False, 'import importlib\n'), ((1421, 1441), 'huaweicloudsdkcore.client.ClientBuilder', 'ClientBuilder', (['clazz'], {}), '(clazz)\n', (1434, 1441), Fal... |
ebezzam/PolyatomicFW_SPL | frank_wolfe.py | 7fbbead5a642915c4bb4d061006b7dac8f6af788 | import numpy as np
from typing import Optional, Any
from pandas import DataFrame
from copy import deepcopy
from abc import abstractmethod
from utils import TimedGenericIterativeAlgorithm
import pycsou.core as pcore
import pycsou.linop as pl
from pycsou.func.penalty import L1Norm
from pycsou.func.loss import SquaredL2... | [((1448, 1466), 'numpy.zeros', 'np.zeros', (['self.dim'], {}), '(self.dim)\n', (1456, 1466), True, 'import numpy as np\n'), ((3088, 3112), 'numpy.abs', 'np.abs', (['dual_certificate'], {}), '(dual_certificate)\n', (3094, 3112), True, 'import numpy as np\n'), ((7848, 7911), 'pycsou.linop.DenseLinearOperator', 'pl.DenseL... |
suzuken/xbrlparser | lib/rdflib-3.1.0/test/test_trix_serialize.py | d9309081b8d21113ebb7a0983c677bee971af0a1 | #!/usr/bin/env python
import unittest
from rdflib.graph import ConjunctiveGraph
from rdflib.term import URIRef, Literal
from rdflib.graph import Graph
class TestTrixSerialize(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testSerialize(self):
s1 = URIRef... | [((1684, 1699), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1697, 1699), False, 'import unittest\n'), ((314, 331), 'rdflib.term.URIRef', 'URIRef', (['"""store:1"""'], {}), "('store:1')\n", (320, 331), False, 'from rdflib.term import URIRef, Literal\n'), ((343, 363), 'rdflib.term.URIRef', 'URIRef', (['"""resour... |
leschzinerlab/myami-3.2-freeHand | dbschema/revertDBinstall.py | 974b8a48245222de0d9cfb0f433533487ecce60d | #!/usr/bin/env python
from sinedon import dbupgrade, dbconfig
import updatelib
project_dbupgrade = dbupgrade.DBUpgradeTools('projectdata', drop=True)
if __name__ == "__main__":
updatelib_inst = updatelib.UpdateLib(project_dbupgrade)
checkout_version = raw_input('Revert to checkout version, for example, 2.1 -->')
i... | [] |
guy4261/fight-churn | fightchurn/listings/chap9/listing_9_4_regression_cparam.py | f3820edd6d4af5e0bd625434d3ad4236aa781ef4 | from sklearn.linear_model import LogisticRegression
from fightchurn.listings.chap8.listing_8_2_logistic_regression import prepare_data, save_regression_model
from fightchurn.listings.chap8.listing_8_2_logistic_regression import save_regression_summary, save_dataset_predictions
def regression_cparam(data_set_path, C_pa... | [((336, 363), 'fightchurn.listings.chap8.listing_8_2_logistic_regression.prepare_data', 'prepare_data', (['data_set_path'], {}), '(data_set_path)\n', (348, 363), False, 'from fightchurn.listings.chap8.listing_8_2_logistic_regression import prepare_data, save_regression_model\n'), ((381, 468), 'sklearn.linear_model.Logi... |
prise6/smart-iss-posts | notebooks/classical_clustering.py | fc913078e7fbe6343fd36ec6ca9852322247da5d | #%% [markdown]
# # Clustering classique
#%% [markdown]
# ## import classique
import os
#%%
%load_ext autoreload
%autoreload 2
os.chdir('/home/jovyan/work')
#%% [markdown]
# ## Import iss
#%%
from iss.tools import Config
from iss.tools import Tools
from iss.models import SimpleConvAutoEncoder
from iss.clustering imp... | [] |
kaulketh/stepper-motor-stuff | SM_28BYJ48/logger/logger.py | ca7cc78279b378e5ad8e19f9c77b794a43d9a07e | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# -----------------------------------------------------------
# created 02.02.2021, tkaulke
# Thomas Kaulke, kaulkth@gmail.com
# https://github.com/kaulketh
# -----------------------------------------------------------
__author__ = "Thomas Kaulke"
__email__ = "kaulketh@gmail... | [((533, 569), 'os.path.join', 'os.path.join', (['this_folder', '"""../logs"""'], {}), "(this_folder, '../logs')\n", (545, 569), False, 'import os\n'), ((1062, 1097), 'os.path.join', 'os.path.join', (['this_folder', 'ini_file'], {}), '(this_folder, ini_file)\n', (1074, 1097), False, 'import os\n'), ((1098, 1152), 'loggi... |
Ibotta/mr_uplift | tests/test_mr_uplift.py | e1facd39a87683dfdeaf7b08336e0ce781ff87cf | import numpy as np
import pytest
from mr_uplift.dataset.data_simulation import get_no_noise_data, get_simple_uplift_data, get_observational_uplift_data_1
from mr_uplift.mr_uplift import MRUplift, get_t_data
from mr_uplift.keras_model_functionality import prepare_data_optimized_loss
import sys
import pandas as pd
clas... | [((440, 464), 'mr_uplift.mr_uplift.get_t_data', 'get_t_data', (['(0)', 'num_obs_1'], {}), '(0, num_obs_1)\n', (450, 464), False, 'from mr_uplift.mr_uplift import MRUplift, get_t_data\n'), ((908, 936), 'numpy.array', 'np.array', (['[[0, 0], [1, 0.5]]'], {}), '([[0, 0], [1, 0.5]])\n', (916, 936), True, 'import numpy as n... |
Full-Data-Alchemist/lambdata-Mani-alch | lambdataalchemani/lambda_test.py | 90dcbc091d8f9841d5a1046e64437058a4156dc5 | """
"""
import unittest
from example_module import COLORS, increment
class ExampleTest(unittest.TestCase):
"""
#TODO
"""
def test_increment(self):
x0 = 0
y0 = increment(x0) #y0 == 1
self.assertEqual(y0, 1)
x1 = 100
y1 = increment(x1) #y1 == 101
se... | [((195, 208), 'example_module.increment', 'increment', (['x0'], {}), '(x0)\n', (204, 208), False, 'from example_module import COLORS, increment\n'), ((285, 298), 'example_module.increment', 'increment', (['x1'], {}), '(x1)\n', (294, 298), False, 'from example_module import COLORS, increment\n')] |
bopopescu/hue-5 | desktop/core/src/desktop/auth/views.py | 665c275d0c0570b1a4a34a293503cc72ec35695c | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | [] |
AlonsoReyes/t-intersection-graph | models/node.py | 68bab234cd6e334edcec27bfee3e019f08997945 |
class Node(object):
def __init__(self, name, follow_list, intention, lane):
self.name = name
self.follow_list = follow_list
self.intention = intention
self.lane = lane
def __eq__(self, other):
if isinstance(other, Node):
if self.name == other.get... | [] |
tim-werner/gsheets-db-api | gsheetsdb/url.py | 12f2a4fbe1bd5aa36781226759326ce782b08a91 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import OrderedDict
from moz_sql_parser import parse as parse_sql
import pyparsing
import re
from six.moves.urllib import parse
FROM_REGEX = re.compile... | [((310, 356), 're.compile', 're.compile', (['""" from ("http.*?")"""', 're.IGNORECASE'], {}), '(\' from ("http.*?")\', re.IGNORECASE)\n', (320, 356), False, 'import re\n'), ((419, 438), 'six.moves.urllib.parse.urlparse', 'parse.urlparse', (['url'], {}), '(url)\n', (433, 438), False, 'from six.moves.urllib import parse\... |
joyjeni/detr-fine | detr/datasets/construction_panoptic.py | dfc0f4abc2579a2b3ef4527904af3345c7a9de4d | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import json
from pathlib import Path
import numpy as np
import torch
from PIL import Image
from panopticapi.utils import rgb2id
# from util.box_ops import masks_to_boxes
from .construction import make_construction_transforms
import logging
def... | [((422, 444), 'torch.stack', 'torch.stack', (['b'], {'dim': '(-1)'}), '(b, dim=-1)\n', (433, 444), False, 'import torch\n'), ((1007, 1045), 'torch.tensor', 'torch.tensor', (['boxes'], {'dtype': 'torch.int64'}), '(boxes, dtype=torch.int64)\n', (1019, 1045), False, 'import torch\n'), ((1059, 1098), 'torch.tensor', 'torch... |
diyarkudrat/CS-1.3-Core-Data-Structures | Code/all-starter-code/search.py | 7d7d48ad7913cded7b0ea75ced144d0a08989924 | #!python
"""
ANNOTATE FUNCTIONS WITH TIME AND SPACE COMPLEXITY!!!!!
"""
def linear_search(array, item):
"""return the first index of item in array or None if item is not found"""
return linear_search_iterative(array, item)
# return linear_search_recursive(array, item)
def linear_search_iterative(ar... | [] |
mat-heim/max_ros | max_ai/src/max_ai/mem_db.py | e01e4f5b2db96d94865d80452d41b8dcf1412232 | #!/usr/bin/python
'''
memory class
stored in sqlite data base
holds raw input and memories in parse taged columns
'''
import sys
import re
import sqlite3
import os
from datetime import date, datetime
from pattern.en import parse
from pattern.en import pprint
from pattern.en import parsetree
from pattern.en import ... | [((537, 582), 'sqlite3.connect', 'sqlite3.connect', (["(dir + 'robbie_memory.sqlite')"], {}), "(dir + 'robbie_memory.sqlite')\n", (552, 582), False, 'import sqlite3\n'), ((2301, 2315), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2313, 2315), False, 'from datetime import date, datetime\n')] |
pierre-haessig/matplotlib | examples/pylab_examples/image_masked.py | 0d945044ca3fbf98cad55912584ef80911f330c6 | #!/usr/bin/env python
'''imshow with masked array input and out-of-range colors.
The second subplot illustrates the use of BoundaryNorm to
get a filled contour effect.
'''
from pylab import *
from numpy import ma
import matplotlib.colors as colors
delta = 0.025
x = y = arange(-3.0, 3.0, delta)
X, Y = meshgri... | [((887, 914), 'numpy.ma.masked_where', 'ma.masked_where', (['(Z > 1.2)', 'Z'], {}), '(Z > 1.2, Z)\n', (902, 914), False, 'from numpy import ma\n'), ((1192, 1241), 'matplotlib.colors.Normalize', 'colors.Normalize', ([], {'vmin': '(-1.0)', 'vmax': '(1.0)', 'clip': '(False)'}), '(vmin=-1.0, vmax=1.0, clip=False)\n', (1208... |
d3vzer0/reternal-backend | app/schemas/socket.py | aeeb613c820759212e7aef9150738a66b2882d50 |
from pydantic import BaseModel, validator, Field
from typing import List, Dict
from datetime import datetime
class Authenticate(BaseModel):
access_token: str | [] |
aniket091/modmail-plugins-1 | meme/meme.py | 4360ff885f27e5c9488ea5cf9431aff20435209b | import discord
from discord.ext import commands
import requests
import random
from box import Box
class WildMemes(commands.Cog):
"""
Randomly spawns memes.
"""
subreddits = [
"dankmemes",
"wholesomememes",
"memes",
"terriblefacebookmemes",
"historymemes",
"me_irl",
"2meirl4m... | [((423, 446), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (444, 446), False, 'from discord.ext import commands\n'), ((565, 587), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (579, 587), False, 'import random\n'), ((672, 702), 'random.choice', 'random.choi... |
phnomcobra/PCAT2PY | pcat2py/class/20bdcef0-5cc5-11e4-af55-00155d01fe08.py | 937c3b365cdc5ac69b78f59070be0a21bdb53db0 | #!/usr/bin/python
################################################################################
# 20bdcef0-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... | [] |
dzzhvks94vd2/mikan | mikan/exceptions.py | 569b331cff02a089721fd6d0a430d5c2812b4934 | class MikanException(Exception):
"""Generic Mikan exception"""
class ConversionError(MikanException, ValueError):
"""Cannot convert a string"""
| [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.