repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
funnel-io/python-on-rails | tests/either_catch_test.py | cccd2284c7dab32a37d573042531a54454164f6a | from python_on_rails.either import as_either, Failure, Success
@as_either(TypeError)
def add_one(x):
return x + 1
@as_either()
def times_five(x):
return x * 5
def test_success_executes_bindings():
result = Success(1).bind(add_one).bind(times_five)
assert isinstance(result, Success)
assert resu... | [((66, 86), 'python_on_rails.either.as_either', 'as_either', (['TypeError'], {}), '(TypeError)\n', (75, 86), False, 'from python_on_rails.either import as_either, Failure, Success\n'), ((123, 134), 'python_on_rails.either.as_either', 'as_either', ([], {}), '()\n', (132, 134), False, 'from python_on_rails.either import ... |
Coullence/DRF_Percels-Couriers_API_V.0.0.2 | ServerSide/models.py | 906786115861b316f8ecf023c8af82f2dacff68e | from django.db import models
# Create your models here.
# Station
class Stations(models.Model):
stationName = models.CharField(max_length=100)
stationLocation = models.CharField(max_length=100)
stationStaffId = models.CharField(max_length=100)
date = models.DateTimeField(auto_now_add=True)
d... | [((119, 151), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (135, 151), False, 'from django.db import models\n'), ((174, 206), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (190, 206), False, 'from django.d... |
JamesTheZ/BladeDISC | tao_compiler/mlir/disc/tests/glob_op_test.bzl | e6c76ee557ebfccd560d44f6b6276bbc4e0a8a34 | # Test definitions for Lit, the LLVM test runner.
#
# This is reusing the LLVM Lit test runner in the interim until the new build
# rules are upstreamed.
# TODO(b/136126535): remove this custom rule.
"""Lit runner globbing test
"""
load("//tensorflow:tensorflow.bzl", "filegroup")
load("@bazel_skylib//lib:paths.bzl", "... | [] |
yulicrunchy/JALoP | build-scripts/PackageCheckHelpers.py | a474b464d4916fe559cf1df97c855232e5ec24ab | """
These are functions to add to the configure context.
"""
def __checkCanLink(context, source, source_type, message_libname, real_libs=[]):
"""
Check that source can be successfully compiled and linked against real_libs.
Keyword arguments:
source -- source to try to compile
source_type -- type of source file, ... | [] |
ari-holtzman/transformers | src/transformers/modeling_tf_pytorch_utils.py | 8725c545e8feeecdcee0ad92ca1d80cee8f0c6e4 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | [((814, 841), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (831, 841), False, 'import logging\n'), ((1581, 1626), 're.sub', 're.sub', (['"""/[^/]*___([^/]*)/"""', '"""/\\\\1/"""', 'tf_name'], {}), "('/[^/]*___([^/]*)/', '/\\\\1/', tf_name)\n", (1587, 1626), False, 'import re\n'), ((1913... |
mitochon/hail | hail/python/test/hail/helpers.py | 25e5e5b8da1d978468d2cee393426ade46484a87 | import os
from timeit import default_timer as timer
import unittest
import pytest
from decorator import decorator
from hail.utils.java import Env
import hail as hl
from hail.backend.local_backend import LocalBackend
_initialized = False
def startTestHailContext():
global _initialized
if not _initialized:
... | [((630, 696), 'os.environ.get', 'os.environ.get', (['"""HAIL_TEST_RESOURCES_DIR"""', '"""../src/test/resources"""'], {}), "('HAIL_TEST_RESOURCES_DIR', '../src/test/resources')\n", (644, 696), False, 'import os\n'), ((712, 769), 'os.environ.get', 'os.environ.get', (['"""HAIL_DOCTEST_DATA_DIR"""', '"""hail/docs/data"""']... |
mjstrobl/WEXEA | src/entity_linker/models/figer_model/labeling_model.py | 0af0be1cdb93fc00cd81f885aa15ef8d6579b304 | """
Modifications copyright (C) 2020 Michael Strobl
"""
import time
import tensorflow as tf
import numpy as np
from entity_linker.models.base import Model
class LabelingModel(Model):
"""Unsupervised Clustering using Discrete-State VAE"""
def __init__(self, batch_size, num_labels, context_encoded_dim,
... | [((575, 604), 'tensorflow.variable_scope', 'tf.variable_scope', (['scope_name'], {}), '(scope_name)\n', (592, 604), True, 'import tensorflow as tf\n'), ((611, 628), 'tensorflow.device', 'tf.device', (['device'], {}), '(device)\n', (620, 628), True, 'import tensorflow as tf\n'), ((1486, 1532), 'tensorflow.matmul', 'tf.m... |
wutobias/collection | python/molecular_diameter.py | fdac4ce5bb99c31115efdbed7db3316eea4b2826 | #!/usr/bin/env python
import sys
import parmed as pmd
import numpy as np
from scipy.spatial import distance
if len(sys.argv) < 2:
print "Usage: molecular_diameter.py <mymolecule.mol2>"
exit(1)
mol = pmd.load_file(sys.argv[1])
crds = mol.coordinates
dist = distance.cdist(crds, crds, 'euclidean')
print np.max(dist... | [] |
liorshk/simpletransformers | examples/text_classification/yelp_reviews_polarity/train.py | 226cf4d11edf5157c1beafcc44aaa78f65ccc985 | import sys
import pandas as pd
from simpletransformers.classification import ClassificationModel
prefix = "data/"
train_df = pd.read_csv(prefix + "train.csv", header=None)
train_df.head()
eval_df = pd.read_csv(prefix + "test.csv", header=None)
eval_df.head()
train_df[0] = (train_df[0] == 2).astype(int)
eval_df[0]... | [((129, 175), 'pandas.read_csv', 'pd.read_csv', (["(prefix + 'train.csv')"], {'header': 'None'}), "(prefix + 'train.csv', header=None)\n", (140, 175), True, 'import pandas as pd\n'), ((203, 248), 'pandas.read_csv', 'pd.read_csv', (["(prefix + 'test.csv')"], {'header': 'None'}), "(prefix + 'test.csv', header=None)\n", (... |
mahdi-zafarmand/SNA | LoadGraph.py | a7188a2ceb63355183e470648f6ae4fa90a22faa | import networkx as nx
import os.path
def load_graph(path, weighted=False, delimiter='\t', self_loop=False):
graph = nx.Graph()
if not os.path.isfile(path):
print("Error: file " + path + " not found!")
exit(-1)
with open(path) as file:
for line in file.readlines():
w = 1.0
line = line.split(delimiter)
... | [((119, 129), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (127, 129), True, 'import networkx as nx\n'), ((621, 631), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (629, 631), True, 'import networkx as nx\n')] |
wan1869/dushuhu | mayan/apps/document_signatures/models.py | 934dd178e67140cffc6b9203e793fdf8bbc73a54 | import logging
import uuid
from django.db import models
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from model_utils.managers import InheritanceManager
from mayan.apps.django_gpg.exceptions import VerificationError
from mayan.ap... | [((624, 656), 'logging.getLogger', 'logging.getLogger', ([], {'name': '__name__'}), '(name=__name__)\n', (641, 656), False, 'import logging\n'), ((2025, 2045), 'model_utils.managers.InheritanceManager', 'InheritanceManager', ([], {}), '()\n', (2043, 2045), False, 'from model_utils.managers import InheritanceManager\n')... |
ramezrawas/galaxy-1 | scripts/sync_reports_config.py | c03748dd49c060a68d07bce56eae33e0ba154414 | from ConfigParser import ConfigParser
from sys import argv
REPLACE_PROPERTIES = ["file_path", "database_connection", "new_file_path"]
MAIN_SECTION = "app:main"
def sync():
# Add or replace the relevant properites from galaxy.ini
# into reports.ini
reports_config_file = "config/reports.ini"
if len(arg... | [((489, 503), 'ConfigParser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (501, 503), False, 'from ConfigParser import ConfigParser\n')] |
wotchin/openGauss-server | src/gausskernel/dbmind/xtuner/test/test_ssh.py | ebd92e92b0cfd76b121d98e4c57a22d334573159 | # Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS... | [((1307, 1324), 'ssh.ExecutorFactory', 'ExecutorFactory', ([], {}), '()\n', (1322, 1324), False, 'from ssh import ExecutorFactory\n'), ((835, 852), 'ssh.ExecutorFactory', 'ExecutorFactory', ([], {}), '()\n', (850, 852), False, 'from ssh import ExecutorFactory\n')] |
wyshi/Unsupervised-Structure-Learning | models/utils.py | 19b49320b46e5f7d990ab9e5b3054b331b86e59d | # Original work Copyright (C) 2017 Tiancheng Zhao, Carnegie Mellon University
# Modified work Copyright 2018 Weiyan Shi.
import tensorflow as tf
import numpy as np
from nltk.translate.bleu_score import sentence_bleu
from nltk.translate.bleu_score import SmoothingFunction
def get_bleu_stats(ref, hyps):
scores = [... | [((1234, 1254), 'tensorflow.exp', 'tf.exp', (['(0.5 * logvar)'], {}), '(0.5 * logvar)\n', (1240, 1254), True, 'import tensorflow as tf\n'), ((582, 596), 'numpy.max', 'np.max', (['scores'], {}), '(scores)\n', (588, 596), True, 'import numpy as np\n'), ((598, 613), 'numpy.mean', 'np.mean', (['scores'], {}), '(scores)\n',... |
Kh4L/gluon-cv | gluoncv/data/transforms/block.py | 849411ed56632cd854850b07142087d599f97dcb | # 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... | [((4465, 4507), 'random.uniform', 'random.uniform', (['self.ratio', '(1 / self.ratio)'], {}), '(self.ratio, 1 / self.ratio)\n', (4479, 4507), False, 'import random\n'), ((4246, 4266), 'random.uniform', 'random.uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (4260, 4266), False, 'import random\n'), ((4396, 4434), 'random.un... |
lribiere/explore-mit-bih-arrhythmia-db | explore.py | 44eb2601ed437cb9766ae9cfd3c3553bf108d4f1 | import plotly.graph_objects as go
import streamlit as st
import pandas as pd
from utils import *
import glob
import wfdb
import os
ANNOTATIONS_COL_NAME = 'annotations'
'''
# MIT-BIH Arrhythmia DB Exploration
'''
record_ids = [os.path.basename(file)[:-4] for file in glob.glob('data/*.dat')]
if len(record_ids) == 0:
... | [((324, 516), 'streamlit.write', 'st.write', (['"""Warning ! No data could be found under the ./data/ directory."""', '"""*\\\\*.dat*, *\\\\*.hea*, *\\\\*.atr* files and such should be placed """', '"""immediately under the ./data/ directory"""'], {}), "('Warning ! No data could be found under the ./data/ directory.',\... |
tranconbv/ironpython-stubs | release/stubs.min/System/__init___parts/CharEnumerator.py | a601759e6c6819beff8e6b639d18a24b7e351851 | class CharEnumerator(object):
""" Supports iterating over a System.String object and reading its individual characters. This class cannot be inherited. """
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return CharEnumerator()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
de... | [] |
levidavis/py-home | src/home_automation_hub/config.py | 3cc30e19d506824de9816ad9dbcfba4338a7dfa8 | from .config_store import ConfigStore
config = ConfigStore()
config.set_mqtt_broker("mqtt", 1883)
config.set_redis_config("redis", 6379, 0)
| [] |
Krozark/Harpe-Website | Harpe-website/website/contrib/communication/utils.py | 1038a8550d08273806c9ec244cb8157ef9e9101e | # -*- coding: utf-8 -*-
import socket as csocket
from struct import pack,unpack
from website.contrib.communication.models import *
def enum(**enums):
return type('Enum', (), enums)
class Socket:
Dommaine = enum(IP=csocket.AF_INET,LOCAL=csocket.AF_UNIX)
Type = enum(TCP=csocket.SOCK_STREAM, UDP=csocket.SOCK... | [] |
hzi-bifo/Model-T | traitarm/reconstruction/visualize_recon.py | 197b52f6fe9b73e0411dbfc66f6d2a43081f5697 | import pandas as pd
import ete2
from ete2 import faces, Tree, AttrFace, TreeStyle
import pylab
from matplotlib.colors import hex2color, rgb2hex, hsv_to_rgb, rgb_to_hsv
kelly_colors_hex = [
0xFFB300, # Vivid Yellow
0x803E75, # Strong Purple
0xFF6800, # Vivid Orange
0xA6BDD7, # Very Light Blue
0xC100... | [((1247, 1321), 'ete2.faces.add_face_to_node', 'faces.add_face_to_node', (['name_face', 'node'], {'column': '(0)', 'position': '"""branch-right"""'}), "(name_face, node, column=0, position='branch-right')\n", (1269, 1321), False, 'from ete2 import faces, Tree, AttrFace, TreeStyle\n'), ((1732, 1743), 'ete2.TreeStyle', '... |
volpatto/firedrake_scripts | scripts/misc/operator_condition_number_scipy.py | ba9c935bb0c9a6bbc6de69f476e42ad0ea8bb1c6 | import attr
from firedrake import *
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from scipy.linalg import svd
from scipy.sparse.linalg import svds
from scipy.sparse import csr_matrix
from slepc4py import SLEPc
import pandas as pd
from tqdm import tqdm
import os
matplotlib.use('Agg')
@attr.s
c... | [((287, 308), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (301, 308), False, 'import matplotlib\n'), ((367, 376), 'attr.ib', 'attr.ib', ([], {}), '()\n', (374, 376), False, 'import attr\n'), ((398, 407), 'attr.ib', 'attr.ib', ([], {}), '()\n', (405, 407), False, 'import attr\n'), ((431, 440), ... |
Wlgls/pyDEAP | pydeap/feature_extraction/_time_domain_features.py | b7cec369cedd4a69ea82bc49a2fb8376260e4ad2 | # -*- encoding: utf-8 -*-
'''
@File :_time_domain_features.py
@Time :2021/04/16 20:02:55
@Author :wlgls
@Version :1.0
'''
import numpy as np
def statistics(data, combined=True):
"""Statistical features, include Power, Mean, Std, 1st differece, Normalized 1st difference, 2nd difference, Nor... | [] |
kimballh/pymutual | pymutual/__init__.py | 7d7f588099eee7bdd669d613756509c6ab44a911 | from .session import Session, MutualAPI | [] |
Joshua-Barawa/pitches-IP | forms.py | 41d9d0d2fbecab50e82a4ee64a036952b8d785e1 | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import InputRequired, Email, ValidationError
from models import User
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address', validators=[InputRequired(), Email()])
username ... | [((471, 493), 'wtforms.SubmitField', 'SubmitField', (['"""Sign Up"""'], {}), "('Sign Up')\n", (482, 493), False, 'from wtforms import StringField, PasswordField, SubmitField\n'), ((913, 935), 'wtforms.SubmitField', 'SubmitField', (['"""Sign In"""'], {}), "('Sign In')\n", (924, 935), False, 'from wtforms import StringFi... |
lukaszlaszuk/insightconnect-plugins | plugins/barracuda_waf/komand_barracuda_waf/actions/create_security_policy/schema.py | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | # GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Creates a security policy with the default values"
class Input:
NAME = "name"
class Output:
ID = "id"
class CreateSecurityPolicyInput(komand.Input):
schema = json.loads("""
{
"type": "o... | [((288, 591), 'json.loads', 'json.loads', (['"""\n {\n "type": "object",\n "title": "Variables",\n "properties": {\n "name": {\n "type": "string",\n "title": "Name",\n "description": "The name of the security policy that needs to be created",\n "order": 1\n }\n },\n "required": [\n "... |
fruttasecca/hay_checker | examples/dhc/rule_example.py | 2bbf4e8e90e0abc590dd74080fb6e4f445056354 | #!/usr/bin/python3
from pyspark.sql import SparkSession
from haychecker.dhc.metrics import rule
spark = SparkSession.builder.appName("rule_example").getOrCreate()
df = spark.read.format("csv").option("header", "true").load("examples/resources/employees.csv")
df.show()
condition1 = {"column": "salary", "operator": ... | [((636, 652), 'haychecker.dhc.metrics.rule', 'rule', (['conditions'], {}), '(conditions)\n', (640, 652), False, 'from haychecker.dhc.metrics import rule\n'), ((836, 852), 'haychecker.dhc.metrics.rule', 'rule', (['conditions'], {}), '(conditions)\n', (840, 852), False, 'from haychecker.dhc.metrics import rule\n'), ((372... |
uk-gov-mirror/ONSdigital.ras-secure-message | secure_message/common/utilities.py | 741eed651eea47dd1a13c7c93b1b1796584cdf2b | import collections
import logging
import urllib.parse
from structlog import wrap_logger
from secure_message.constants import MESSAGE_BY_ID_ENDPOINT, MESSAGE_LIST_ENDPOINT, MESSAGE_QUERY_LIMIT
from secure_message.services.service_toggles import party, internal_user_service
logger = wrap_logger(logging.getLogger(__nam... | [((340, 537), 'collections.namedtuple', 'collections.namedtuple', (['"""MessageArgs"""', '"""page limit business_id surveys cc label desc ce is_closed my_conversations new_respondent_conversations all_conversation_types unread_conversations"""'], {}), "('MessageArgs',\n 'page limit business_id surveys cc label desc ... |
notechats/notegame | notegame/games/nonogram/core/renderer.py | 3d9538b98cb6b0b240956b1271e028b22458fc54 | # -*- coding: utf-8 -*-
"""
Defines various renderers for the game of nonogram
"""
from abc import ABC
from sys import stdout
from notetool.tool.log import logger
from six import integer_types, itervalues, text_type
from ..utils.iter import max_safe, pad
from ..utils.other import two_powers
from .common import BOX, ... | [((5860, 5926), 'notetool.tool.log.logger.info', 'logger.info', (['"""init cells: %sx%s"""', 'self.full_width', 'self.full_width'], {}), "('init cells: %sx%s', self.full_width, self.full_width)\n", (5871, 5926), False, 'from notetool.tool.log import logger\n'), ((1484, 1505), 'six.text_type', 'text_type', (['self.value... |
Carreau/sympy | sympy/printing/lambdarepr.py | 168de33bb177936fa9517702b2c5a777b3989672 | from __future__ import print_function, division
from .str import StrPrinter
from sympy.utilities import default_sort_key
class LambdaPrinter(StrPrinter):
"""
This printer converts expressions into strings that can be used by
lambdify.
"""
def _print_MatrixBase(self, expr):
return "%s(%s)... | [] |
fredmell/CS229Project | python/fill_na_v2.py | b214127485ddc587b9fe3be253937ba8378f9db7 | """
Fill na with most common of the whole column
"""
import numpy as np
import pandas as pd
import time
import matplotlib.pyplot as plt
from datetime import datetime
import re
from collections import Counter
from statistics import median
from tqdm import tqdm
def find_most_common_value(element_list):
for elemen... | [((1100, 1120), 'pandas.read_pickle', 'pd.read_pickle', (['file'], {}), '(file)\n', (1114, 1120), True, 'import pandas as pd\n'), ((398, 414), 'pandas.isna', 'pd.isna', (['element'], {}), '(element)\n', (405, 414), True, 'import pandas as pd\n'), ((354, 370), 'pandas.isna', 'pd.isna', (['element'], {}), '(element)\n', ... |
jaiswalIT02/pythonprograms | GUI Applications/calc.py | bc94e52121202b04c3e9112d9786f93ed6707f7a | from tkinter import Tk
from tkinter import Entry
from tkinter import Button
from tkinter import StringVar
t=Tk()
t.title("Tarun Jaiswal")
t.geometry("425x300")
t.resizable(0,0)
t.configure(background="black")#back ground color
a=StringVar()
def show(c):
a.set(a.get()+c)
def equal():
x=a.get()
a.set(eva... | [((109, 113), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (111, 113), False, 'from tkinter import Tk\n'), ((232, 243), 'tkinter.StringVar', 'StringVar', ([], {}), '()\n', (241, 243), False, 'from tkinter import StringVar\n'), ((363, 416), 'tkinter.Entry', 'Entry', ([], {'font': "('', 30)", 'justify': '"""right"""', 'textvari... |
uktrade/great-cms | core/models.py | f13fa335ddcb925bc33a5fa096fe73ef7bdd351a | import hashlib
import mimetypes
from urllib.parse import unquote
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.http import HttpResponseRedirect
from django.template.loader import render_to_string
from django.urls import reverse
from django.... | [((2206, 2232), 'wagtail.snippets.models.register_snippet', 'register_snippet', (['Redirect'], {}), '(Redirect)\n', (2222, 2232), False, 'from wagtail.snippets.models import register_snippet\n'), ((3527, 3560), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1000)'}), '(max_length=1000)\n', (354... |
dumpmemory/Research | CV/Effective Transformer-based Solution for RSNA Intracranial Hemorrhage Detection/easymia/transforms/transforms.py | 30fd70ff331b3d9aeede0b71e7a691ed6c2b87b3 | # -*-coding utf-8 -*-
##########################################################################
#
# Copyright (c) 2022 Baidu.com, Inc. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of th... | [((4959, 5017), 'collections.namedtuple', 'collections.namedtuple', (['"""params_ret"""', "['i', 'j', 'h', 'w']"], {}), "('params_ret', ['i', 'j', 'h', 'w'])\n", (4981, 5017), False, 'import collections\n'), ((8071, 8109), 'random.uniform', 'random.uniform', (['degrees[0]', 'degrees[1]'], {}), '(degrees[0], degrees[1])... |
galterlibrary/InvenioRDM-at-NU | tests/ui/terms/test_views.py | 5aff6ac7c428c9a61bdf221627bfc05f2280d1a3 | # -*- coding: utf-8 -*-
#
# This file is part of menRva.
# Copyright (C) 2018-present NU,FSM,GHSL.
#
# menRva is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test terms views.py"""
from cd2h_repo_project.modules.terms.views import ... | [((679, 715), 'cd2h_repo_project.modules.terms.views.serialize_terms_for_edit_ui', 'serialize_terms_for_edit_ui', (['deposit'], {}), '(deposit)\n', (706, 715), False, 'from cd2h_repo_project.modules.terms.views import serialize_terms_for_edit_ui\n'), ((1187, 1223), 'cd2h_repo_project.modules.terms.views.serialize_terms... |
alamin3637k/Searcher | main.py | bb948b373d1bd1261930a47c37fa9210a98e9ef3 | import webbrowser
import wikipedia
import requests
def yt_search(search: str):
webbrowser.open_new_tab(f"https://www.youtube.com/results?search_query={search}")
def google_search(search: str):
webbrowser.open_new_tab(f"https://www.google.com/search?q={search}")
def bing_search(search: str):
webbrowser.op... | [((84, 170), 'webbrowser.open_new_tab', 'webbrowser.open_new_tab', (['f"""https://www.youtube.com/results?search_query={search}"""'], {}), "(\n f'https://www.youtube.com/results?search_query={search}')\n", (107, 170), False, 'import webbrowser\n'), ((203, 271), 'webbrowser.open_new_tab', 'webbrowser.open_new_tab', (... |
ptsurko/coursera_crypt | hw1.py | ec952800c441a9b07ac427045851285fee8c6543 | import string
from timeit import itertools
s1 = '315c4eeaa8b5f8aaf9174145bf43e1784b8fa00dc71d885a804e5ee9fa40b16349c146fb778cdf2d3aff021dfff5b403b510d0d0455468aeb98622b137dae857553ccd8883a7bc37520e06e515d22c954eba5025b8cc57ee59418ce7dc6bc41556bdb36bbca3e8774301fbcaa3b83b220809560987815f65286764703de0f3d524400a19b15961... | [] |
dstoeckel/MOE | moe/bandit/ucb/ucb_interface.py | 5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c | # -*- coding: utf-8 -*-
"""Classes (Python) to compute the Bandit UCB (Upper Confidence Bound) arm allocation and choosing the arm to pull next.
See :mod:`moe.bandit.bandit_interface` for further details on bandit.
"""
import copy
from abc import abstractmethod
from moe.bandit.bandit_interface import BanditInterfac... | [((1529, 1559), 'copy.deepcopy', 'copy.deepcopy', (['historical_info'], {}), '(historical_info)\n', (1542, 1559), False, 'import copy\n'), ((5703, 5776), 'moe.bandit.utils.get_winning_arm_names_from_payoff_arm_name_list', 'get_winning_arm_names_from_payoff_arm_name_list', (['ucb_payoff_arm_name_list'], {}), '(ucb_payof... |
RonaldoAPSD/Hedge | Hedge/Shell.py | 2a1550ea38a0384f39ed3541c8a91f9ca57f5a64 | import Hedge
while True:
text = input('Hedge > ')
if text.strip() == "":
continue
result, error = Hedge.run('<stdin>', text)
if (error):
print(error.asString())
elif result:
if len(result.elements) == 1:
print(repr(result.elements[0]))
else:
print(repr(result)) | [((110, 136), 'Hedge.run', 'Hedge.run', (['"""<stdin>"""', 'text'], {}), "('<stdin>', text)\n", (119, 136), False, 'import Hedge\n')] |
Xarthisius/yt | yt/frontends/enzo/io.py | 321643c3abff64a6f132d98d0747f3558f7552a3 | import numpy as np
from yt.geometry.selection_routines import GridSelector
from yt.utilities.io_handler import BaseIOHandler
from yt.utilities.logger import ytLogger as mylog
from yt.utilities.on_demand_imports import _h5py as h5py
_convert_mass = ("particle_mass", "mass")
_particle_position_names = {}
class IOHan... | [((550, 584), 'yt.utilities.on_demand_imports._h5py.File', 'h5py.File', (['grid.filename'], {'mode': '"""r"""'}), "(grid.filename, mode='r')\n", (559, 584), True, 'from yt.utilities.on_demand_imports import _h5py as h5py\n'), ((7940, 7972), 'yt.utilities.io_handler.BaseIOHandler.__init__', 'BaseIOHandler.__init__', (['... |
arisada/cidr_enum | cidr_enum.py | 1908f20ac15a83738fc1ff74ff17a7280bec769f | #!/usr/bin/env python3
"""
cidr_enum.py is a very simple tool to help enumerate IP ranges when being used with other tools
"""
import argparse
import netaddr
def enum_ranges(ranges, do_sort):
cidrs=[]
for r in ranges:
try:
cidrs.append(netaddr.IPNetwork(r))
except Exception as e:
print("Error:", e)
re... | [((452, 512), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Enumarate CIDR ranges"""'}), "(description='Enumarate CIDR ranges')\n", (475, 512), False, 'import argparse\n'), ((246, 266), 'netaddr.IPNetwork', 'netaddr.IPNetwork', (['r'], {}), '(r)\n', (263, 266), False, 'import netaddr\n'... |
lambert-x/video_semisup | configs/k400-fixmatch-tg-alignment-videos-ptv-simclr/8gpu/r3d_r18_8x8x1_45e_k400_rgb_offlinetg_1percent_align0123_1clip_no_contrast_precisebn_ptv.py | 8ff44343bb34485f8ad08d50ca4d8de22e122c1d | # model settings
model = dict(
type='Semi_AppSup_TempSup_SimCLR_Crossclip_PTV_Recognizer3D',
backbone=dict(
type='ResNet3d',
depth=18,
pretrained=None,
pretrained2d=False,
norm_eval=False,
conv_cfg=dict(type='Conv3d'),
norm_cfg=dict(type='SyncBN', requires... | [] |
willingc/pingo | experiments/rpi/gertboard/dtoa.py | 0890bf5ed763e9061320093fc3fb5f7543c5cc2c | #!/usr/bin/python2.7
# Python 2.7 version by Alex Eames of http://RasPi.TV
# functionally equivalent to the Gertboard dtoa test by Gert Jan van Loo & Myra VanInwegen
# Use at your own risk - I'm pretty sure the code is harmless, but check it yourself.
# This will not work unless you have installed py-spidev as in the ... | [] |
themilkman/GitGutter | modules/statusbar.py | 355b4480e7e1507fe1f9ae1ad9eca9649400a76c | # -*- coding: utf-8 -*-
import sublime
from . import blame
from . import templates
class SimpleStatusBarTemplate(object):
"""A simple template class with the same interface as jinja2's one."""
# a list of variables used by this template
variables = frozenset([
'repo', 'branch', 'compare', 'inser... | [] |
bunya017/Django-Polls-App | polls/tests.py | 7b71ac9d1ffb66518e1d0345bc0f11ee5907c1be | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
class RandomTestCase(TestCase):
def test_one_plus_one1(self):
self.assertEqual(1+1, 2)
| [] |
LeonHodgesAustin/video_stream_processor | test.py | 8014705edc37599716eb1320d46c99136fe3e262 | # import logging
# import hercules.lib.util.hercules_logging as l
# from hercules.lib.util import sso as sso
import opencv2 as cv2
import urllib
import numpy as np
# log = l.setup_logging(__name__)
def main(args=None):
# username, passowrd = sso.get_login_credentials("WATCHER")
# Open a sample video available... | [((349, 445), 'opencv2.VideoCapture', 'cv2.VideoCapture', (['"""https://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_2mb.mp4"""'], {}), "(\n 'https://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_2mb.mp4')\n", (365, 445), True, 'import opencv2 as cv2\n'), ((1026, 1049), 'opencv2.destroyAllWindow... |
cloutiertyler/RibbonGraph | ribbon/exceptions.py | 000864dd0ee33da4ed44af2f4bd1f1a83d5a1ba4 | from rest_framework.exceptions import APIException
from rest_framework import status
class GraphAPIError(APIException):
"""Base class for exceptions in this module."""
pass
class NodeNotFoundError(GraphAPIError):
status_code = status.HTTP_404_NOT_FOUND
def __init__(self, id):
self.id = id
... | [] |
LeonardoM011/kobe-trading-bot | kobe-trading-bot/app.py | 83a84ee0fb8dab3d9ae174be91e96de6d5f2d823 | #!/usr/bin/env python3
# Crypto trading bot using binance api
# Author: LeonardoM011<Leonardo.leo.201@gmail.com>
# Created on 2021-02-05 21:56
# Set constants here:
DELTA_TIME = 300 # How long can we check for setting up new trade (in seconds)
# ----------------------
# Imports:
import os
import sys... | [((421, 458), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../deps/binance"""'], {}), "(1, '../deps/binance')\n", (436, 458), False, 'import sys\n'), ((2192, 2219), 'binance.client.Client', 'Client', (['api_key', 'api_secret'], {}), '(api_key, api_secret)\n', (2198, 2219), False, 'from binance.client import Clien... |
SoumyaShreeram/Locating_AGN_in_DM_halos | imported_files/plotting_edh01.py | 1cfbee69b2c000faee4ecb199d65c3235afbed42 | # -*- coding: utf-8 -*-
"""Plotting.py for notebook 01_Exploring_DM_Halos
This python file contains all the functions used for plotting graphs and maps in the 1st notebook (.ipynb) of the repository: 01. Exploring parameters in DM halos and sub-halos
Script written by: Soumya Shreeram
Project supervised by Johan Com... | [((2235, 2269), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(9, 8)'}), '(1, 1, figsize=(9, 8))\n', (2247, 2269), True, 'import matplotlib.pyplot as plt\n'), ((3541, 3575), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(9, 8)'}), '(1, 1, figsize=(9, 8))\n', (... |
Rubtsowa/modin | asv_bench/benchmarks/omnisci/io.py | 6550939753c76e896ef2bfd65bb9468d6ad161d7 | # Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | [((1883, 1899), 'modin.pandas.DataFrame', 'pd.DataFrame', (['[]'], {}), '([])\n', (1895, 1899), True, 'import modin.pandas as pd\n')] |
ypeng22/ProgLearn | benchmarks/rotation/rotated_cifar.py | 671ff6a03c156bab3eedbd9e112705eeabd59da7 | import matplotlib.pyplot as plt
import random
import pickle
from skimage.transform import rotate
from scipy import ndimage
from skimage.util import img_as_ubyte
from joblib import Parallel, delayed
from sklearn.ensemble.forest import _generate_unsampled_indices
from sklearn.ensemble.forest import _generate_sample_indic... | [((638, 673), 'sys.path.append', 'sys.path.append', (['"""../../proglearn/"""'], {}), "('../../proglearn/')\n", (653, 673), False, 'import sys\n'), ((7056, 7091), 'keras.datasets.cifar100.load_data', 'keras.datasets.cifar100.load_data', ([], {}), '()\n', (7089, 7091), False, 'import keras\n'), ((7101, 7134), 'numpy.con... |
toddbenanzer/sklearn_pandas | sklearn_pandas/transformers/monitor.py | 36e24c55ef4829aa261963201c346869097d4931 | import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin, clone
from sklearn_pandas.util import validate_dataframe
class MonitorMixin(object):
def print_message(self, message):
if self.logfile:
with open(self.logfile, "a") as fout:
fout.w... | [((622, 643), 'sklearn_pandas.util.validate_dataframe', 'validate_dataframe', (['X'], {}), '(X)\n', (640, 643), False, 'from sklearn_pandas.util import validate_dataframe\n'), ((826, 847), 'sklearn_pandas.util.validate_dataframe', 'validate_dataframe', (['X'], {}), '(X)\n', (844, 847), False, 'from sklearn_pandas.util ... |
cbrake1/content | Packs/ProofpointThreatResponse/Integrations/ProofpointThreatResponse/ProofpointThreatResponse_test.py | 5b031129f98935c492056675eeee0fefcacbd87b | import pytest
from CommonServerPython import *
from ProofpointThreatResponse import create_incident_field_context, get_emails_context, pass_sources_list_filter, \
pass_abuse_disposition_filter, filter_incidents, prepare_ingest_alert_request_body, \
get_incidents_batch_by_time_request, get_new_incidents, get_tim... | [((2985, 3050), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""incident, answer"""', 'INCIDENT_FIELD_INPUT'], {}), "('incident, answer', INCIDENT_FIELD_INPUT)\n", (3008, 3050), False, 'import pytest\n'), ((3591, 3653), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""event, answer"""', 'EMAILS_C... |
l1haoyuan/macholib | macholib/macho_methname.py | 48c59841e2ca5aa308eab67f72faed384a2c0723 | import sys
import os
import json
from enum import Enum
from .mach_o import LC_SYMTAB
from macholib import MachO
from macholib import mach_o
from shutil import copy2
from shutil import SameFileError
class ReplaceType(Enum):
objc_methname = 1
symbol_table = 2
def replace_in_bytes(method_bytes, name_dict, type... | [((2829, 2852), 'macholib.MachO.MachO', 'MachO.MachO', (['macho_file'], {}), '(macho_file)\n', (2840, 2852), False, 'from macholib import MachO\n'), ((3099, 3124), 'os.path.split', 'os.path.split', (['macho_file'], {}), '(macho_file)\n', (3112, 3124), False, 'import os\n'), ((3194, 3228), 'os.path.join', 'os.path.join'... |
FloFincke/affective-chat | archive/data-processing/archive/features/sd1.py | 241c2b555541968f7e5e70b022fdb71102aed510 | #!/usr/bin/env python
import math
import numpy as np
def sd1(rr):
sdnn = np.std(rr)
return math.sqrt(0.5 * sdnn * sdnn) | [((76, 86), 'numpy.std', 'np.std', (['rr'], {}), '(rr)\n', (82, 86), True, 'import numpy as np\n'), ((95, 123), 'math.sqrt', 'math.sqrt', (['(0.5 * sdnn * sdnn)'], {}), '(0.5 * sdnn * sdnn)\n', (104, 123), False, 'import math\n')] |
soheilv/python-samples | forms/snippets/delete_watch.py | 4443431261dbcd88408dcc89d5702eeb1ac18ffd | # Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [((952, 984), 'oauth2client.file.Storage', 'file.Storage', (['"""credentials.json"""'], {}), "('credentials.json')\n", (964, 984), False, 'from oauth2client import client, file, tools\n'), ((1040, 1100), 'oauth2client.client.flow_from_clientsecrets', 'client.flow_from_clientsecrets', (['"""client_secret.json"""', 'SCOP... |
egagraha/python-algorithm | data_structures/disjoint_set/disjoint_set.py | 07a6a745b4ebddc93ab7c10b205c75b2427ac1fb | """
Disjoint set.
Reference: https://en.wikipedia.org/wiki/Disjoint-set_data_structure
"""
class Node:
def __init__(self, data: int) -> None:
self.data = data
self.rank: int
self.parent: Node
def make_set(x: Node) -> None:
"""
Make x as a set.
"""
# rank is the di... | [] |
tkeller12/spin_physics | cw_EPR.py | 271f3081bc8ca87b159ed3e3494dbd0ffdea8fa5 | # Timothy Keller
# S = 1/2, I = 1/2
# Spin 1/2 electron coupled to spin 1/2 nuclei
import numpy as np
from scipy.linalg import expm
from matplotlib.pylab import *
from matplotlib import cm
sigma_x = 0.5*np.r_[[[0, 1],[1, 0]]]
sigma_y = 0.5*np.r_[[[0,-1j],[1j, 0]]]
sigma_z = 0.5*np.r_[[[1, 0],[0, -1]]]
Identity = np.e... | [((316, 325), 'numpy.eye', 'np.eye', (['(2)'], {}), '(2)\n', (322, 325), True, 'import numpy as np\n'), ((333, 359), 'numpy.kron', 'np.kron', (['sigma_x', 'Identity'], {}), '(sigma_x, Identity)\n', (340, 359), True, 'import numpy as np\n'), ((365, 391), 'numpy.kron', 'np.kron', (['sigma_y', 'Identity'], {}), '(sigma_y,... |
TOMJERRY23333/V2RayCloudSpider | V2RaycSpider0825/MiddleKey/VMes_IO.py | 0647db8c7b67e4393d1f65dadc08d7e16c1dc324 | from spiderNest.preIntro import *
path_ = os.path.dirname(os.path.dirname(__file__)) + '/dataBase/log_information.csv'
def save_login_info(VMess, class_):
"""
VMess入库
class_: ssr or v2ray
"""
now = str(datetime.now()).split('.')[0]
with open(path_, 'a', encoding='utf-8', newline='') as f:
... | [((225, 239), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (237, 239), False, 'from datetime import datetime, timedelta\n'), ((1602, 1631), 'datetime.datetime.fromisoformat', 'datetime.fromisoformat', (['vm[0]'], {}), '(vm[0])\n', (1624, 1631), False, 'from datetime import datetime, timedelta\n'), ((1634,... |
AK391/PaddleSpeech | paddlespeech/s2t/frontend/audio.py | 8cdbe3a6c0fe447e54cfbcfd82139d2869f5fc49 | # Copyright (c) 2021 PaddlePaddle 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... | [((1933, 1971), 'numpy.any', 'np.any', (['(self.samples != other._samples)'], {}), '(self.samples != other._samples)\n', (1939, 1971), True, 'import numpy as np\n'), ((4228, 4253), 'soundfile.SoundFile', 'soundfile.SoundFile', (['file'], {}), '(file)\n', (4247, 4253), False, 'import soundfile\n'), ((6540, 6582), 're.ma... |
bhch/tornado-debugger | tornado_debugger/debug.py | 4adeead7a45506eda34fc8d1e91dd32acc8cfe4e | import os.path
import re
import sys
import traceback
from pprint import pformat
import tornado
from tornado import template
SENSITIVE_SETTINGS_RE = re.compile(
'api|key|pass|salt|secret|signature|token',
flags=re.IGNORECASE
)
class ExceptionReporter:
def __init__(self, exc_info, handler):
self.... | [((151, 226), 're.compile', 're.compile', (['"""api|key|pass|salt|secret|signature|token"""'], {'flags': 're.IGNORECASE'}), "('api|key|pass|salt|secret|signature|token', flags=re.IGNORECASE)\n", (161, 226), False, 'import re\n'), ((3995, 4018), 'pprint.pformat', 'pformat', (['value'], {'width': '(1)'}), '(value, width=... |
jpolitz/lambda-py-paper | base/pylib/seq_iter.py | 746ef63fc1123714b4adaf78119028afbea7bd76 | class SeqIter:
def __init__(self,l):
self.l = l
self.i = 0
self.stop = False
def __len__(self):
return len(self.l)
def __list__(self):
l = []
while True:
try:
l.append(self.__next__())
except StopIteration:
... | [] |
code-review-doctor/lite-frontend-1 | caseworker/open_general_licences/enums.py | cb3b885bb389ea33ef003c916bea7b03a36d86bb | from lite_content.lite_internal_frontend.open_general_licences import (
OGEL_DESCRIPTION,
OGTCL_DESCRIPTION,
OGTL_DESCRIPTION,
)
from lite_forms.components import Option
class OpenGeneralExportLicences:
class OpenGeneralLicence:
def __init__(self, id, name, description, acronym):
s... | [((1318, 1407), 'lite_forms.components.Option', 'Option', ([], {'key': 'ogl.id', 'value': 'f"""{ogl.name} ({ogl.acronym})"""', 'description': 'ogl.description'}), "(key=ogl.id, value=f'{ogl.name} ({ogl.acronym})', description=ogl.\n description)\n", (1324, 1407), False, 'from lite_forms.components import Option\n')] |
pratika1505/DSA-Path-And-Important-Questions | Matrix/Python/rotatematrix.py | a86a0774f0abf5151c852afd2bbf67a5368125c8 | # -*- coding: utf-8 -*-
"""RotateMatrix.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1LX-dZFuQCyBXDNVosTp0MHaZZxoc5T4I
"""
#Function to rotate matrix by 90 degree
def rotate(mat):
# `N × N` matrix
N = len(mat)
# Transpose the m... | [] |
EYH0602/FP_Workshop | sort.py | 866b180b411c1ef439e1a2d039c6d6333e91cd39 | def quicksort(xs):
if len(xs) == 0:
return []
pivot = xs[0]
xs = xs[1:]
left = [x for x in xs if x <= pivot]
right = [x for x in xs if x > pivot]
res = quicksort(left)
res.append(pivot)
res += quicksort(right)
return res
xs = [1, 3, 2, 4, 5, 2]
sorted_xs = quicksort(xs)
| [] |
TarantulaTechnology/fabric5 | bddtests/steps/bdd_test_util.py | 6da971177ab7d74f1e1cfa6f7fc73e75768e5686 |
# Copyright IBM Corp. 2016 All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [((1433, 1507), 'subprocess.Popen', 'subprocess.Popen', (['arg_list'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), '(arg_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n', (1449, 1507), False, 'import subprocess\n'), ((3973, 4016), 'devops_pb2.beta_create_Devops_stub', 'devops_pb2.beta_create_De... |
cefect/SOFDA0 | 1.0.0/hp/dict.py | 62c5566d0f388a5fd76a070ceb5ee3e38b0d7463 | '''
Created on Mar 6, 2018
@author: cef
hp functions for workign with dictionaries
'''
import logging, os, sys, math, copy, inspect
from collections import OrderedDict
from weakref import WeakValueDictionary as wdict
import numpy as np
import hp.basic
mod_logger = logging.getLogger(__name__) #... | [((291, 318), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (308, 318), False, 'import logging, os, sys, math, copy, inspect\n'), ((4046, 4062), 'copy.copy', 'copy.copy', (['d_big'], {}), '(d_big)\n', (4055, 4062), False, 'import logging, os, sys, math, copy, inspect\n'), ((11902, 11920)... |
Cyber-Dioxide/CyberPhish | Core/pre.py | bc2e39d8612ef657d481cdd40d676983f7bf190c | import os
import random
try:
from colorama import Fore, Style
except ModuleNotFoundError:
os.system("pip install colorama")
from urllib.request import urlopen
from Core.helper.color import green, white, blue, red, start, alert
Version = "2.2"
yellow = ("\033[1;33;40m")
def connected(host='http://duckduckgo.com'):... | [((664, 686), 'random.choice', 'random.choice', (['all_col'], {}), '(all_col)\n', (677, 686), False, 'import random\n'), ((3511, 3529), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (3520, 3529), False, 'import os\n'), ((92, 125), 'os.system', 'os.system', (['"""pip install colorama"""'], {}), "('pip ... |
candango/automatoes | automatoes/authorize.py | fbfd01cfaa2c36e23a7251e333ef3fa86ef4bff9 | #!/usr/bin/env python
#
# Copyright 2019-2020 Flavio Garcia
# Copyright 2016-2017 Veeti Paananen under MIT License
#
# 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... | [((1909, 1948), 'os.path.join', 'os.path.join', (['orders_path', 'domains_hash'], {}), '(orders_path, domains_hash)\n', (1921, 1948), False, 'import os\n'), ((1453, 1478), 'os.remove', 'os.remove', (['challenge_file'], {}), '(challenge_file)\n', (1462, 1478), False, 'import os\n'), ((2038, 2065), 'os.path.exists', 'os.... |
jamesliu/ray | rllib/agents/dqn/simple_q_torch_policy.py | 11ab412db1fa3603a3006e8ed414e80dd1f11c0c | """PyTorch policy class used for Simple Q-Learning"""
import logging
from typing import Dict, Tuple
import gym
import ray
from ray.rllib.agents.dqn.simple_q_tf_policy import (
build_q_models, compute_q_values, get_distribution_inputs_and_class)
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.models.to... | [((867, 885), 'ray.rllib.utils.framework.try_import_torch', 'try_import_torch', ([], {}), '()\n', (883, 885), False, 'from ray.rllib.utils.framework import try_import_torch\n'), ((933, 960), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (950, 960), False, 'import logging\n'), ((5341, 581... |
NoahDrisort/ViSV2TTS | viphoneme/T2IPA.py | bea6fa1f85527c824c85986d8b7bfa3e3efd120a | #Grapheme
Rime_tone=[ "a","ă","â","e","ê","i","o","ô","ơ","u","ư","y","iê","oa","oă","oe","oo","uâ","uê","uô","uơ","uy","ươ","uyê","yê", #blank
"á","ắ","ấ","é","ế","í","ó","ố","ớ","ú","ứ","ý","iế","óa","oắ","óe","oó","uấ","uế","uố","ướ","úy","ướ","uyế","yế", #grave
... | [((53180, 53206), 'sys.path.append', 'sys.path.append', (['"""./Rules"""'], {}), "('./Rules')\n", (53195, 53206), False, 'import sys, codecs, re\n'), ((54939, 54965), 'sys.path.append', 'sys.path.append', (['"""./Rules"""'], {}), "('./Rules')\n", (54954, 54965), False, 'import sys, codecs, re\n'), ((60447, 60464), 'und... |
retmas-dv/deftcore | taskengine/sessions.py | 23052549e8948bbedfb958a96683b84b46820b09 | __author__ = 'Dmitry Golubkov'
from django.contrib.sessions.base_session import AbstractBaseSession
from django.contrib.sessions.backends.db import SessionStore as DBStore
class CustomSession(AbstractBaseSession):
@classmethod
def get_session_store_class(cls):
return SessionStore
class Meta:
... | [] |
acc-cosc-1336/cosc-1336-spring-2018-vcruz350 | tests/assignments/test_assign7.py | 0cee9fde3d4129c51626c4e0c870972aebec9b95 | import unittest
#write the import for function for assignment7 sum_list_values
from src.assignments.assignment7 import sum_list_values
class Test_Assign7(unittest.TestCase):
def sample_test(self):
self.assertEqual(1,1)
#create a test for the sum_list_values function with list elements:
# bill 23 ... | [((441, 467), 'src.assignments.assignment7.sum_list_values', 'sum_list_values', (['test_list'], {}), '(test_list)\n', (456, 467), False, 'from src.assignments.assignment7 import sum_list_values\n')] |
kgriffs/setec | setec/__init__.py | c6701ffd757cdfe1cfb9c3919b0fd3aa02396f54 | # Copyright 2018 by Kurt Griffiths
#
# 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 writ... | [((1922, 1977), 'msgpack.packb', 'msgpack.packb', (['doc'], {'encoding': '"""utf-8"""', 'use_bin_type': '(True)'}), "(doc, encoding='utf-8', use_bin_type=True)\n", (1935, 1977), False, 'import msgpack\n'), ((2747, 2799), 'msgpack.unpackb', 'msgpack.unpackb', (['packed'], {'raw': '(False)', 'encoding': '"""utf-8"""'}), ... |
niacdoial/armory | blender/arm/logicnode/native/LN_detect_mobile_browser.py | 3f9b633fbf772017c576a3f77695a6c28d9956e1 | from arm.logicnode.arm_nodes import *
class DetectMobileBrowserNode(ArmLogicTreeNode):
"""Determines the mobile browser or not (works only for web browsers)."""
bl_idname = 'LNDetectMobileBrowserNode'
bl_label = 'Detect Mobile Browser'
arm_version = 1
def init(self, context):
super(DetectMobileBrowserNode, sel... | [] |
andyasne/commcare-hq | corehq/apps/dump_reload/tests/test_sql_dump_load.py | c59a24e57bdd4d2536493f9ecdcc9906f4ae1b88 | import inspect
import json
import uuid
from collections import Counter
from datetime import datetime
from io import StringIO
import mock
from django.contrib.admin.utils import NestedObjects
from django.db import transaction, IntegrityError
from django.db.models.signals import post_delete, post_save
from django.test im... | [((26813, 26878), 'mock.patch', 'mock.patch', (['"""corehq.apps.dump_reload.sql.load.ENQUEUE_TIMEOUT"""', '(1)'], {}), "('corehq.apps.dump_reload.sql.load.ENQUEUE_TIMEOUT', 1)\n", (26823, 26878), False, 'import mock\n'), ((5470, 5526), 'corehq.apps.dump_reload.sql.dump.get_model_iterator_builders_to_dump', 'get_model_i... |
the-moliver/keras | tests/keras/test_activations.py | 4fa7e5d454dd4f3f33f1d756a2a8659f2e789141 | import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras import backend as K
from keras import activations
def get_standard_values():
'''
These are just a set of floats used for testing the activation
functions, and are useful in multiple tests.
'''
return np.array([[... | [((575, 596), 'keras.backend.placeholder', 'K.placeholder', ([], {'ndim': '(2)'}), '(ndim=2)\n', (588, 596), True, 'from keras import backend as K\n'), ((761, 806), 'numpy.testing.assert_allclose', 'assert_allclose', (['result', 'expected'], {'rtol': '(1e-05)'}), '(result, expected, rtol=1e-05)\n', (776, 806), False, '... |
robertsawko/proteus | scripts/H5toXMF.py | 6f1e4c2ca1af85a906b35a5162430006f0343861 |
#import numpy
#import os
#from xml.etree.ElementTree import *
import tables
#from Xdmf import *
def H5toXMF(basename,size,start,finaltime,stride):
# Open XMF files
for step in range(start,finaltime+1,stride):
XMFfile = open(basename+"."+str(step)+".xmf","w")
XMFfile.write(r"""<?xml version="1.0... | [] |
agustinhenze/mibs.snmplabs.com | pysnmp-with-texts/CISCO-TRUSTSEC-POLICY-MIB.py | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | #
# PySNMP MIB module CISCO-TRUSTSEC-POLICY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-TRUSTSEC-POLICY-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:14:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | [] |
lrahmani/agents-aea | tests/test_cli/test_generate/test_generate.py | 9bd1d51530fc21bf41b5adea031cda19a94b048b | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | [((1142, 1185), 'unittest.mock.patch', 'mock.patch', (['"""aea.cli.generate.ConfigLoader"""'], {}), "('aea.cli.generate.ConfigLoader')\n", (1152, 1185), False, 'from unittest import TestCase, mock\n'), ((1187, 1258), 'unittest.mock.patch', 'mock.patch', (['"""aea.cli.generate.os.path.join"""'], {'return_value': '"""joi... |
PeerHerholz/smobsc | sphinx/ext/napoleon/__init__.py | db34d2bb96b80579bd4a3f4c198a6b524c5a134a | """
sphinx.ext.napoleon
~~~~~~~~~~~~~~~~~~~
Support for NumPy and Google style docstrings.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from sphinx import __display_version__ as __version__
from sphinx.application import Sphinx
from ... | [((13152, 13223), 'sphinx.ext.napoleon.docstring.NumpyDocstring', 'NumpyDocstring', (['result_lines', 'app.config', 'app', 'what', 'name', 'obj', 'options'], {}), '(result_lines, app.config, app, what, name, obj, options)\n', (13166, 13223), False, 'from sphinx.ext.napoleon.docstring import GoogleDocstring, NumpyDocstr... |
skodapetr/viset | plugins/similarity/rdkit/tanimoto/lbvs-entry.py | 87863ed6cde63392b2d503ceda53bb2cea367d69 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from rdkit import DataStructs
import plugin_api
__license__ = "X11"
class LbvsEntry(plugin_api.PluginInterface):
"""
Compute Tanimoto similarity.
"""
def __init__(self):
self.stream = None
self.counter = 0
self.first_... | [((1496, 1585), 'json.dump', 'json.dump', (["{'query': query['id'], 'id': item['id'], 'value': similarity}", 'self.stream'], {}), "({'query': query['id'], 'id': item['id'], 'value': similarity},\n self.stream)\n", (1505, 1585), False, 'import json\n'), ((2021, 2071), 'rdkit.DataStructs.cDataStructs.IntSparseIntVect'... |
524243642/taobao_spider | mall_spider/spiders/actions/proxy_service.py | 9cdaed1c7a67fc1f35ee2af2e18313cedf3b1e5e | # coding: utf-8
import time
from config.config_loader import global_config
from mall_spider.spiders.actions.context import Context
from mall_spider.spiders.actions.direct_proxy_action import DirectProxyAction
__proxy_service = None
class ProxyService(object):
proxies_set = set()
proxies_list = ['https://' +... | [((2086, 2095), 'mall_spider.spiders.actions.context.Context', 'Context', ([], {}), '()\n', (2093, 2095), False, 'from mall_spider.spiders.actions.context import Context\n'), ((2113, 2132), 'mall_spider.spiders.actions.direct_proxy_action.DirectProxyAction', 'DirectProxyAction', ([], {}), '()\n', (2130, 2132), False, '... |
joedanz/flask-weather | app/weather_tests.py | fe35aa359da6f5d7f942d97837403e153b5c5ede | import os
import weather
import datetime
import unittest
import tempfile
class WeatherTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, weather.app.config['DATABASE'] = tempfile.mkstemp()
weather.app.config['TESTING'] = True
self.app = weather.app.test_client()
weather.init... | [((949, 964), 'unittest.main', 'unittest.main', ([], {}), '()\n', (962, 964), False, 'import unittest\n'), ((191, 209), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (207, 209), False, 'import tempfile\n'), ((274, 299), 'weather.app.test_client', 'weather.app.test_client', ([], {}), '()\n', (297, 299), Fals... |
memristor/mep2 | modules/sensors/Activator.py | bc5cddacba3d740f791f3454b8cb51bda83ce202 | import asyncio
class Activator:
def __init__(self, name, packet_stream=None):
self.ps = None
self.name = name
self.future = None
self.data = 0
self.state = ''
if packet_stream:
self.set_packet_stream(packet_stream)
@_core.module_cmd
def wait_activator(self):
pass
@_core.module_cmd
def check... | [] |
ArthurCamara/beir | examples/retrieval/evaluation/sparse/evaluate_deepct.py | 2739990b719f2d4814d88473cf9965d92d4f4c18 | """
This example shows how to evaluate DeepCT (using Anserini) in BEIR.
For more details on DeepCT, refer here: https://arxiv.org/abs/1910.10687
The original DeepCT repository is not modularised and only works with Tensorflow 1.x (1.15).
We modified the DeepCT repository to work with Tensorflow latest (2.x).
We do not... | [((2165, 2202), 'beir.util.download_and_unzip', 'util.download_and_unzip', (['url', 'out_dir'], {}), '(url, out_dir)\n', (2188, 2202), False, 'from beir import util, LoggingHandler\n'), ((2571, 2619), 'beir.util.download_and_unzip', 'util.download_and_unzip', (['base_model_url', 'out_dir'], {}), '(base_model_url, out_d... |
AmirHosseinNamadchi/PyNite | Examples/Space Truss - Nodal Load.py | 8cc1fe3262e1efe029c6860394d2436601272e33 | # Engineering Mechanics: Statics, 4th Edition
# Bedford and Fowler
# Problem 6.64
# Units for this model are meters and kilonewtons
# Import 'FEModel3D' and 'Visualization' from 'PyNite'
from PyNite import FEModel3D
from PyNite import Visualization
# Create a new model
truss = FEModel3D()
# Define the nodes
truss.Ad... | [((280, 291), 'PyNite.FEModel3D', 'FEModel3D', ([], {}), '()\n', (289, 291), False, 'from PyNite import FEModel3D\n'), ((2933, 3022), 'PyNite.Visualization.RenderModel', 'Visualization.RenderModel', (['truss'], {'text_height': '(0.05)', 'render_loads': '(True)', 'case': '"""Case 1"""'}), "(truss, text_height=0.05, rend... |
CodeMaster7000/Sending-Emails-in-Python | Using Yagmail to make sending emails easier.py | 2ec44f6520a6b98508c8adf372a191f2577fbf98 | import yagmail
receiver = "your@gmail.com" #Receiver's gmail address
body = "Hello there from Yagmail"
filename = "document.pdf"
yag = yagmail.SMTP("my@gmail.com")#Your gmail address
yag.send(
to=receiver,
subject="Yagmail test (attachment included",
contents=body,
attachments=filename,
)... | [((143, 171), 'yagmail.SMTP', 'yagmail.SMTP', (['"""my@gmail.com"""'], {}), "('my@gmail.com')\n", (155, 171), False, 'import yagmail\n')] |
markendr/esys-escript.github.io | pycad/py_src/transformations.py | 0023eab09cd71f830ab098cb3a468e6139191e8d |
##############################################################################
#
# Copyright (c) 2003-2020 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development unt... | [((3484, 3590), 'numpy.array', 'numpy.array', (['[x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y[1] - x[1] *\n y[0]]', '_TYPE'], {}), '([x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y\n [1] - x[1] * y[0]], _TYPE)\n', (3495, 3590), False, 'import numpy\n'), ((1623, 1640), 'numpy.zer... |
ThomasHelfer/BosonStar | example/complex_scalar_star_solver.py | 5442a6e6171122a3ba1d6b079e6483ab72aa7338 | from bosonstar.ComplexBosonStar import Complex_Boson_Star
# =====================
# All imporntnat definitions
# =====================
# Physics defintions
phi0 = 0.40 # centeral phi
D = 5.0 # Dimension (total not only spacial)
Lambda = -0.2 # Cosmological constant
# Solver definitions
Rst... | [((561, 630), 'bosonstar.ComplexBosonStar.Complex_Boson_Star', 'Complex_Boson_Star', (['e_pow_minus_delta_guess', 'phi0', 'D', 'Lambda', 'verbose'], {}), '(e_pow_minus_delta_guess, phi0, D, Lambda, verbose)\n', (579, 630), False, 'from bosonstar.ComplexBosonStar import Complex_Boson_Star\n')] |
ouyhlan/fastNLP | setup.py | cac13311e28c1e8e3c866d50656173650eb5c7a1 | #!/usr/bin/env python
# coding=utf-8
from setuptools import setup, find_packages
with open('README.md', encoding='utf-8') as f:
readme = f.read()
with open('LICENSE', encoding='utf-8') as f:
license = f.read()
with open('requirements.txt', encoding='utf-8') as f:
reqs = f.read()
pkgs = [p for p in find_... | [((315, 330), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (328, 330), False, 'from setuptools import setup, find_packages\n')] |
ory/sdk-generator | clients/client/python/ory_client/__init__.py | 958314d130922ad6f20f439b5230141a832231a5 | # flake8: noqa
"""
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v0.0.1-alpha.187
Contact: support@ory.sh
... | [] |
ambiata/atmosphere-python-sdk | atmosphere/custom_activity/base_class.py | 48880a8553000cdea59d63b0fba49e1f0f482784 | from abc import ABC, abstractmethod
from typing import Tuple
from requests import Response
from .pydantic_models import (AppliedExclusionConditionsResponse,
BiasAttributeConfigListResponse,
ComputeRewardResponse, DefaultPredictionResponse,
... | [] |
modulo16/PfNE | Module1/file3.py | 9706afc42c44dcfd1490e5ac074156f41e5515a8 | from __future__ import print_function, unicode_literals
#Ensures Unicode is used for all strings.
my_str = 'whatever'
#Shows the String type, which should be unicode
type(my_str)
#declare string:
ip_addr = '192.168.1.1'
#check it with boolean:(True)
ip_addr == '192.168.1.1'
#(false)
ip_addr == '10.1.1.1'
#is this su... | [] |
arcticmatter/pipresents-beep | pp_io_plugins/pp_kbddriver_plus.py | e5945f929b47249f19b0cb3433a138e874b592db | #enhanced keyboard driver
import copy
import os
import configparser
from pp_displaymanager import DisplayManager
class pp_kbddriver_plus(object):
# control list items
NAME=0 # symbolic name for input and output
DIRECTION = 1 # in/out
MATCH = 2 # for input the charac... | [((884, 900), 'pp_displaymanager.DisplayManager', 'DisplayManager', ([], {}), '()\n', (898, 900), False, 'from pp_displaymanager import DisplayManager\n'), ((9565, 9589), 'os.path.exists', 'os.path.exists', (['filepath'], {}), '(filepath)\n', (9579, 9589), False, 'import os\n'), ((2132, 2173), 'copy.deepcopy', 'copy.de... |
akshay-kapase/shopping | grocery/migrations/0003_alter_item_comments.py | 7bf3bac4a78d07bca9a9f9d44d85e11bb826a366 | # Generated by Django 3.2.6 on 2021-09-03 15:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('grocery', '0002_alter_item_comments'),
]
operations = [
migrations.AlterField(
model_name='item',
name='comments',
... | [((337, 397), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'default': '"""null"""', 'max_length': '(200)'}), "(blank=True, default='null', max_length=200)\n", (353, 397), False, 'from django.db import migrations, models\n')] |
yjf18340/webots | projects/objects/buildings/protos/textures/colored_textures/textures_generator.py | 60d441c362031ab8fde120cc0cd97bdb1a31a3d5 | #!/usr/bin/env python
# Copyright 1996-2019 Cyberbotics Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [((975, 1010), 'glob.glob', 'glob.glob', (['"""*_diffuse_template.jpg"""'], {}), "('*_diffuse_template.jpg')\n", (984, 1010), False, 'import glob\n'), ((1915, 1938), 'PIL.Image.open', 'Image.open', (['template[0]'], {}), '(template[0])\n', (1925, 1938), False, 'from PIL import Image\n'), ((1950, 1973), 'PIL.Image.open'... |
viz4biz/PyDataNYC2015 | tutorial/test_env.py | 066154ea9f1837c355e6108a28b85889f3020da3 | """
test local env
"""
import os
for k, v in os.environ.iteritems():
print k, '=', v
| [] |
filipefborba/MarriageNSFG | project2/marriage.py | d550301fbb9d80ddabf391a6168d2c8636113ed9 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
import bisect
import numpy as np
import pandas as pd
import scipy.sta... | [((888, 937), 'pandas.concat', 'pd.concat', (['samples'], {'ignore_index': '(True)', 'sort': '(False)'}), '(samples, ignore_index=True, sort=False)\n', (897, 937), True, 'import pandas as pd\n'), ((2280, 2330), 'survival.EstimateHazardFunction', 'survival.EstimateHazardFunction', (['complete', 'ongoing'], {}), '(comple... |
ErwinP/cctbx_project | xfel/merging/application/reflection_table_utils.py | 58f9fb5ed38c7391510e892f0ca9520467b692c1 | from __future__ import absolute_import, division, print_function
from six.moves import range
from dials.array_family import flex
import math
class reflection_table_utils(object):
@staticmethod
def get_next_hkl_reflection_table(reflections):
'''Generate asu hkl slices from an asu hkl-sorted reflection table'''... | [((926, 937), 'dials.array_family.flex.bool', 'flex.bool', ([], {}), '()\n', (935, 937), False, 'from dials.array_family import flex\n'), ((1258, 1269), 'dials.array_family.flex.bool', 'flex.bool', ([], {}), '()\n', (1267, 1269), False, 'from dials.array_family import flex\n'), ((1505, 1528), 'dials.array_family.flex.r... |
jptomo/pypy-lang-scheme | rpython/memory/test/test_transformed_gc.py | 55edb2cec69d78f86793282a4566fcbc1ef9fcac | import py
import inspect
from rpython.rlib.objectmodel import compute_hash, compute_identity_hash
from rpython.translator.c import gc
from rpython.annotator import model as annmodel
from rpython.rtyper.llannotation import SomePtr
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, llgroup
from rpython.memo... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.