repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
Darkcybe/attack_range | modules/aws_service.py | b135251cc40e527e78e6e826759e421fb3834577 | import sys
import re
import boto3
from botocore.exceptions import ClientError
import uuid
import time
import yaml
import os
def get_instance_by_name(ec2_name, config):
instances = get_all_instances(config)
for instance in instances:
str = instance['Tags'][0]['Value']
if str == ec2_name:
... | [((630, 669), 'boto3.client', 'boto3.client', (['"""ec2"""'], {'region_name': 'region'}), "('ec2', region_name=region)\n", (642, 669), False, 'import boto3\n'), ((1998, 2037), 'boto3.client', 'boto3.client', (['"""ec2"""'], {'region_name': 'region'}), "('ec2', region_name=region)\n", (2010, 2037), False, 'import boto3\... |
KevinMichaelSchindler/pystacknet | pystacknet/metrics.py | bb723511787be6a0828d2ec5ef141fa76b80ef84 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 31 18:33:58 2018
@author: Marios Michailidis
metrics and method to check metrics used within StackNet
"""
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score , mean_squared_log_error #regression metrics
from sklearn.metrics import roc_auc_sco... | [((651, 709), 'sklearn.metrics.roc_auc_score', 'roc_auc_score', (['y_true', 'y_pred'], {'sample_weight': 'sample_weight'}), '(y_true, y_pred, sample_weight=sample_weight)\n', (664, 709), False, 'from sklearn.metrics import roc_auc_score, log_loss, accuracy_score, f1_score, matthews_corrcoef\n'), ((788, 856), 'sklearn.m... |
stdevel/nagios-plugins | check_logstash_pipeline.py | 5ea0e186fa6fdd0e70681c7fed02c6d46d50bbb5 | #!/usr/bin/env python
# coding=utf-8
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2017-11-24 21:10:35 +0100 (Fri, 24 Nov 2017)
#
# https://github.com/harisekhon/nagios-plugins
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on Linke... | [((1192, 1221), 'os.path.join', 'os.path.join', (['srcdir', '"""pylib"""'], {}), "(srcdir, 'pylib')\n", (1204, 1221), False, 'import os\n'), ((1222, 1245), 'sys.path.append', 'sys.path.append', (['libdir'], {}), '(libdir)\n', (1237, 1245), False, 'import sys\n'), ((1156, 1181), 'os.path.dirname', 'os.path.dirname', (['... |
rvacaru/airflow-training-skeleton | dags/mailsdag.py | 45fc6a8938d055b98c62c85b7c8085cb7d6f23ba | # -*- coding: utf-8 -*-
#
# 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
#... | [((1461, 1536), 'airflow.operators.dummy_operator.DummyOperator', 'DummyOperator', ([], {'task_id': '"""run_this_last"""', 'dag': 'dag', 'trigger_rule': '"""one_success"""'}), "(task_id='run_this_last', dag=dag, trigger_rule='one_success')\n", (1474, 1536), False, 'from airflow.operators.dummy_operator import DummyOper... |
speedplane/python-compat-runtime | appengine-compat/exported_appengine_sdk/google/storage/speckle/proto/jdbc_type.py | 743ade7e1350c790c4aaa48dd2c0893d06d80cee | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [] |
osabogal10/GestiREDBackend | GestiRED/views.py | 99aa3b01bd67910cc0f96751c88d0f4e83763392 | from django.http import HttpResponse
from django.core.mail import send_mail
import json
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from GestiRED.models import User
from GestiRED.models import QualityControl, Phase, Resource, ResourceType,PhaseType
from django.core import se... | [((420, 451), 'django.http.HttpResponse', 'HttpResponse', (['"""GestiRED app UP"""'], {}), "('GestiRED app UP')\n", (432, 451), False, 'from django.http import HttpResponse\n'), ((2349, 2403), 'django.http.HttpResponse', 'HttpResponse', (['qs_json'], {'content_type': '"""application/json"""'}), "(qs_json, content_type=... |
sipeed/python3-maix | ext_modules/_maix_nn/example/yolo2_camera.py | 9ced31b8f1c1e4ef93b6a57bbfced27ae9e3361e |
from maix import nn
from PIL import Image, ImageDraw, ImageFont
from maix import display, camera
import time
from maix.nn import decoder
def draw_rectangle_with_title(draw, box, disp_str, bg_color=(255, 0, 0, 255), font_color=(255, 255, 255, 255)):
# draw = ImageDraw.Draw(img)
font = ImageFont.load_defaul... | [((645, 675), 'maix.camera.config', 'camera.config', ([], {'size': '(224, 224)'}), '(size=(224, 224))\n', (658, 675), False, 'from maix import display, camera\n'), ((1061, 1088), 'maix.nn.load', 'nn.load', (['model'], {'opt': 'options'}), '(model, opt=options)\n', (1068, 1088), False, 'from maix import nn\n'), ((299, 3... |
Fatal1ty/mashumaro | tests/test_metadata_options.py | f32acf98f7cc7cdf638b921fe3fde96bef4fbefb | from dataclasses import dataclass, field
from datetime import date, datetime, time, timezone
from pathlib import Path
from typing import Any, Dict, Optional, Union
import ciso8601
import pytest
from mashumaro import DataClassDictMixin
from mashumaro.exceptions import UnserializableField
from mashumaro.types import Se... | [((562, 605), 'dataclasses.field', 'field', ([], {'metadata': "{'deserialize': 'ciso8601'}"}), "(metadata={'deserialize': 'ciso8601'})\n", (567, 605), False, 'from dataclasses import dataclass, field\n'), ((895, 938), 'dataclasses.field', 'field', ([], {'metadata': "{'deserialize': 'ciso8601'}"}), "(metadata={'deserial... |
yashrajt/college_FAQ-chatbot | Intent model/Intent_model.py | b3a2a1b4958068b652d019c13f31f6329b093c0a | import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.metrics import accuracy_score, confusion_matrix
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.pipeline import Pipeline
from skle... | [((535, 588), 'pandas.read_csv', 'pd.read_csv', (['"""Training Data/intent_training_data.csv"""'], {}), "('Training Data/intent_training_data.csv')\n", (546, 588), True, 'import pandas as pd\n'), ((2905, 2946), 'joblib.dump', 'joblib.dump', (['sgd', '"""intent_model_1.joblib"""'], {}), "(sgd, 'intent_model_1.joblib')\n... |
owennewo/kfserving | vendor/github.com/tensorflow/tensorflow/tensorflow/python/ops/list_ops.py | 89f73c87525b8e06ea799f69f2979c4ad272fcb3 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [((1248, 1294), 'tensorflow.python.framework.ops.NotDifferentiable', 'ops.NotDifferentiable', (['"""TensorListConcatLists"""'], {}), "('TensorListConcatLists')\n", (1269, 1294), False, 'from tensorflow.python.framework import ops\n'), ((1295, 1342), 'tensorflow.python.framework.ops.NotDifferentiable', 'ops.NotDifferent... |
flaeppe/astunparse | tests/test_dump.py | 754ec7d113fa273625ccc7b6c5d65aa7700ab8a9 | import ast
import re
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import astunparse
from tests.common import AstunparseCommonTestCase
class DumpTestCase(AstunparseCommonTestCase, unittest.TestCase):
def assertASTEqual(self, dump1, dump2):
# undo the ... | [((352, 393), 're.sub', 're.sub', (['"""(?<=[\\\\(\\\\[])\\\\n\\\\s+"""', '""""""', 'dump1'], {}), "('(?<=[\\\\(\\\\[])\\\\n\\\\s+', '', dump1)\n", (358, 393), False, 'import re\n'), ((407, 436), 're.sub', 're.sub', (['"""\\\\n\\\\s+"""', '""" """', 'dump1'], {}), "('\\\\n\\\\s+', ' ', dump1)\n", (413, 436), False, 'im... |
addgene/giraffe | src/django/giraffe/blat/management/commands/reset_app.py | c7d3b1f000ceea83e6c98cce06cd2a0f9e4f4c2c | from django.core.management.base import AppCommand, CommandError
from django.core.management.sql import sql_reset
from django.core.management.color import no_style
from django.db import connections
class Command(AppCommand):
help = "**********\nThis command resets data for any django app, the difference with the b... | [] |
JordanBRoberts/python-theBand | webBlog/apps.py | 1e475a45a42b210c722ab43c0b966d7b58d97a9d | from django.apps import AppConfig
class WebblogConfig(AppConfig):
name = 'webBlog'
| [] |
lydaaa/fzutils | requires.py | 5f775d046876e3ce35d0b1174b5a3db96e9d627e | # coding:utf-8
'''
@author = super_fazai
@File : requires.py
@Time : 2016/8/3 12:59
@connect : superonesfazai@gmail.com
'''
install_requires = [
'ipython',
'wheel',
'utils',
'db',
'greenlet==0.4.13',
'web.py==0.40.dev1',
'pytz',
'requests',
'selenium==3.8.0', # 3.8.1及其以上版... | [] |
venkatarjun/Python3 | m15_dos/dos.py | 606adf8588a74a53d592e62e07e81a5a1530b993 | import subprocess
import requests
import argparse
from concurrent.futures import ThreadPoolExecutor
from time import sleep
from datetime import datetime
ICMP_ATTACK = "ICMP"
HTTP_ATTACK = "HTTP"
valid_attacks = {HTTP_ATTACK, ICMP_ATTACK}
parser = argparse.ArgumentParser(description="DoS HTTP")
parser.add_argument('-P... | [((249, 296), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""DoS HTTP"""'}), "(description='DoS HTTP')\n", (272, 296), False, 'import argparse\n'), ((1024, 1041), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1036, 1041), False, 'import requests\n'), ((1487, 1553), 'subproce... |
estudio89/maestro-python | maestro/backends/django/contrib/signals.py | 331079cb3f0c10de2e19210cbade793544510f33 | from django.apps import apps
from django.db import models
from django.db.models.signals import post_save, pre_delete
from typing import Type, Optional, List, cast, TYPE_CHECKING
from maestro.backends.django.settings import maestro_settings
from maestro.backends.django.contrib.factory import create_django_data_store
fro... | [((928, 954), 'maestro.backends.django.contrib.factory.create_django_data_store', 'create_django_data_store', ([], {}), '()\n', (952, 954), False, 'from maestro.backends.django.contrib.factory import create_django_data_store\n'), ((973, 1003), 'maestro.backends.django.utils.model_to_entity_name', 'model_to_entity_name'... |
pbexe/nextbike-top | top/urls.py | eca086406cf6b96d6e086dd0fa9ecae5b6364f4d | from django.urls import include, path
from .views import home, bike
urlpatterns = [
path("", home),
path("bike/<int:number>", bike)
] | [((89, 103), 'django.urls.path', 'path', (['""""""', 'home'], {}), "('', home)\n", (93, 103), False, 'from django.urls import include, path\n'), ((109, 140), 'django.urls.path', 'path', (['"""bike/<int:number>"""', 'bike'], {}), "('bike/<int:number>', bike)\n", (113, 140), False, 'from django.urls import include, path\... |
mike72353/FragFeatureNet | Scripts/ReduceFragments.py | ef61ae52e3d6dcc6d2d56df2a6bd5fe1a298c930 | """
Remove Fragments not in Knowledgebase
"""
__author__ = "Michael Suarez"
__email__ = "masv@connect.ust.hk"
__copyright__ = "Copyright 2019, Hong Kong University of Science and Technology"
__license__ = "3-clause BSD"
from argparse import ArgumentParser
import numpy as np
import pickle
parser = ArgumentParser(desc... | [((301, 342), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Build Files"""'}), "(description='Build Files')\n", (315, 342), False, 'from argparse import ArgumentParser\n'), ((592, 726), 'numpy.loadtxt', 'np.loadtxt', (["('../%s/%s/%s.Homogenised.boundfrags_zeros.txt' % (args.datadir, args.\n ... |
vbohinc/CommunityCellularManager | client/core/tests/billing_tests.py | ab330fcb1bc70ee3a8e9bcdac2846ab6c327f87c | """Tests for core.billing.
Run this test from the project root
$ nosetests core.tests.billing_tests
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of ... | [((1081, 1107), 'core.config_database.ConfigDB', 'config_database.ConfigDB', ([], {}), '()\n', (1105, 1107), False, 'from core import config_database\n'), ((3018, 3059), 'core.billing.process_prices', 'process_prices', (['price_data', 'cls.config_db'], {}), '(price_data, cls.config_db)\n', (3032, 3059), False, 'from co... |
s-i-l-k-e/django-data-interrogator | data_interrogator/admin/views.py | 0284168b81aaa31a8df84f3ea52166eded8a4362 | from django.contrib.auth.decorators import user_passes_test
from django.utils.decorators import method_decorator
from data_interrogator.admin.forms import AdminInvestigationForm, AdminPivotTableForm
from data_interrogator.interrogators import Allowable
from data_interrogator.views import InterrogationView, Interrogati... | [((648, 690), 'django.contrib.auth.decorators.user_passes_test', 'user_passes_test', (['(lambda u: u.is_superuser)'], {}), '(lambda u: u.is_superuser)\n', (664, 690), False, 'from django.contrib.auth.decorators import user_passes_test\n')] |
heytanay/mmsegmentation | configs/pspnet/pspnet_r18-d8_512x512_80k_loveda.py | 7ddd2fe2ecff9c95999bd00ec05cc37eafb558f8 | _base_ = './pspnet_r50-d8_512x512_80k_loveda.py'
model = dict(
backbone=dict(
depth=18,
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://resnet18_v1c')),
decode_head=dict(
in_channels=512,
channels=128,
),
auxiliary_head=dict(in_channels=256, channel... | [] |
TheGenocides/BBA | bba/objects.py | 1617756ed9224027d7225ea68364f6568c56ed23 | from typing import Dict, Any
class ResponseObject:
def __init__(self, data: Dict[str, Any]):
self.payload = data
for k, v in data.items():
setattr(self, k, v) | [] |
BR0kEN-/admin-portal | apps/greencheck/forms.py | 0c38dc0d790031f45bf07660bce690e972fe2858 | from django import forms
from django.forms import ModelForm
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from .choices import ActionChoice
from .choices import StatusApproval
from .models import GreencheckIp
from .models import GreencheckIpApprove
from .models impor... | [((366, 382), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (380, 382), False, 'from django.contrib.auth import get_user_model\n'), ((2116, 2135), 'django.forms.HiddenInput', 'forms.HiddenInput', ([], {}), '()\n', (2133, 2135), False, 'from django import forms\n'), ((2711, 2730), 'django.for... |
think-wang/osroom | apps/utils/format/url_format.py | 67bb5bbd7a63fbaeb0d919738859444b54500152 | #!/usr/bin/env python
# -*-coding:utf-8-*-
from tld import get_tld
__author__ = "Allen Woo"
def get_domain(url):
'''
获取url中的全域名
:param url:
:return:
'''
res = get_tld(url, as_object=True)
return "{}.{}".format(res.subdomain, res.tld) | [((185, 213), 'tld.get_tld', 'get_tld', (['url'], {'as_object': '(True)'}), '(url, as_object=True)\n', (192, 213), False, 'from tld import get_tld\n')] |
Tjev/freeipa-manager | ipamanager/entities.py | 0d40e64d81a86d4312b4e22cd57dcaecf25d0801 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: BSD-3-Clause
# Copyright © 2017-2019, GoodData Corporation. All rights reserved.
"""
FreeIPA Manager - entity module
Object representations of the entities configured in FreeIPA.
"""
import os
import re
import voluptuous
import yaml
from abc imp... | [((10197, 10241), 'voluptuous.Schema', 'voluptuous.Schema', (['schemas.schema_hostgroups'], {}), '(schemas.schema_hostgroups)\n', (10214, 10241), False, 'import voluptuous\n'), ((10484, 10528), 'voluptuous.Schema', 'voluptuous.Schema', (['schemas.schema_usergroups'], {}), '(schemas.schema_usergroups)\n', (10501, 10528)... |
weknowtraining/athena-glue-service-logs | test/test_catalog_manager.py | b7cf77408486f2bfa941b8609617ed47aa3e2d02 | # pylint: skip-file
from athena_glue_service_logs.catalog_manager import BaseCatalogManager
def test_class_init(mocker):
mocker.patch.multiple(BaseCatalogManager, __abstractmethods__=set())
base_catalog = BaseCatalogManager('us-west-2', 'dbname', 'tablename', 's3://somewhere')
assert base_catalog.databas... | [((216, 288), 'athena_glue_service_logs.catalog_manager.BaseCatalogManager', 'BaseCatalogManager', (['"""us-west-2"""', '"""dbname"""', '"""tablename"""', '"""s3://somewhere"""'], {}), "('us-west-2', 'dbname', 'tablename', 's3://somewhere')\n", (234, 288), False, 'from athena_glue_service_logs.catalog_manager import Ba... |
fiddlerwoaroof/sandbox | unsorted/pythonsnippets_0013.py | 652acaf710a8b60f005769bde317e7bbf548cc2b | from twisted.internet import reactor
reactor.listenTCP(8789, factory)
reactor.run() | [((37, 69), 'twisted.internet.reactor.listenTCP', 'reactor.listenTCP', (['(8789)', 'factory'], {}), '(8789, factory)\n', (54, 69), False, 'from twisted.internet import reactor\n'), ((70, 83), 'twisted.internet.reactor.run', 'reactor.run', ([], {}), '()\n', (81, 83), False, 'from twisted.internet import reactor\n')] |
SHUcream00/MLBPitchVisual | __main__.py | a3092cef7cbd4e73f8d0010dd62811df6cc36cac | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def visualize(dataframe, balltype):
df = dataframe
#Filter by balltype
res = df[df["pitch_type"] == balltype]
#Group by results
groups = res.groupby("description")
for name, group in groups:
if name ==... | [((1524, 1545), 'pandas.read_csv', 'pd.read_csv', (['file_src'], {}), '(file_src)\n', (1535, 1545), True, 'import pandas as pd\n'), ((1552, 1569), 'pandas.DataFrame', 'pd.DataFrame', (['raw'], {}), '(raw)\n', (1564, 1569), True, 'import pandas as pd\n'), ((665, 674), 'matplotlib.pyplot.gca', 'plt.gca', ([], {}), '()\n'... |
Toonwire/infancy_eye_tracking | shape_similarity.py | 7b96a9d832f60f83fd5098ada2117ab1d0f56fed | # -*- coding: utf-8 -*-
"""
Created on Sat May 25 13:17:49 2019
@author: Toonw
"""
import numpy as np
def vlen(a):
return (a[0]**2 + a[1]**2)**0.5
def add(v1,v2):
return (v1[0]+v2[0], v1[1]+v2[1])
def sub(v1,v2):
return (v1[0]-v2[0], v1[1]-v2[1])
def unit_vector(v):
vu = v / np.linalg.norm(v)
... | [((300, 317), 'numpy.linalg.norm', 'np.linalg.norm', (['v'], {}), '(v)\n', (314, 317), True, 'import numpy as np\n'), ((394, 408), 'numpy.dot', 'np.dot', (['v1', 'v2'], {}), '(v1, v2)\n', (400, 408), True, 'import numpy as np\n')] |
aldwyn/effigia | apps/chats/apps.py | eb456656949bf68934530bbec9c15ebc6d0236b8 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class ChatsConfig(AppConfig):
name = 'apps.chats'
def ready(self):
from actstream import registry
registry.register(*self.get_models())
| [] |
JayJJChen/LoveXueXiQiangGuo | utils/ghost.py | 648a38cd73d1eb7ed7267721f1a23c90afb0daee | import os
import time
from utils.eye import Eye
from utils.finger import Finger
class Ghost:
"""class to navigate the app, with Eye and Finger"""
def __init__(self, adb_path, temp_path, sleep_sec=2):
self.eye = Eye(adb_path, temp_path)
self.finger = Finger(adb_path, sleep_sec=sleep_sec)
... | [((231, 255), 'utils.eye.Eye', 'Eye', (['adb_path', 'temp_path'], {}), '(adb_path, temp_path)\n', (234, 255), False, 'from utils.eye import Eye\n'), ((278, 315), 'utils.finger.Finger', 'Finger', (['adb_path'], {'sleep_sec': 'sleep_sec'}), '(adb_path, sleep_sec=sleep_sec)\n', (284, 315), False, 'from utils.finger import... |
sanja7s/SR_Twitter | src_taxonomy/bubble_tree_map.py | 2eb499c9aa25ba6e9860cd77eac6832890d2c126 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import random
from ete2 import Tree, TreeStyle, NodeStyle, faces, AttrFace, CircleFace, TextFace
def layout(node):
if not node.is_root():
# Add node name to laef nodes
#N = AttrFace("name", fsize=14, fgcolor="black")
#faces.add_face_to_node(N, node, 0)
#pass
fa... | [] |
MrNoScript/compass-interface-core | compass/core/_scrapers/member.py | 8c945ef36f7bee396bd5a744404eaa88d280a845 | from __future__ import annotations
import re
import time
from typing import get_args, Literal, TYPE_CHECKING, Union
from lxml import html
from compass.core.interface_base import InterfaceBase
from compass.core.logger import logger
from compass.core.schemas import member as schema
from compass.core.settings import Se... | [((4589, 4614), 'lxml.html.fromstring', 'html.fromstring', (['response'], {}), '(response)\n', (4604, 4614), False, 'from lxml import html\n'), ((8345, 8415), 'compass.core.logger.logger.debug', 'logger.debug', (['f"""getting roles tab for member number: {membership_num}"""'], {}), "(f'getting roles tab for member numb... |
Quran-Tafseer/tafseer_api | quran_text/urls.py | 49eede15a6e50812a4bab1e0e1e38069fcb0da4d | from django.urls import path
from . import views
urlpatterns = [
path('',
view=views.SuraListView.as_view(), name='sura-list'),
path('<int:sura_num>/<int:number>/',
view=views.AyahTextView.as_view(), name='ayah-detail'),
path('<int:sura_num>/<int:number>',
view=views.AyahTextVie... | [] |
IanSeng/CMPUT404_PROJECT | konnection/settings/local.py | 80acd2c57de4b091e0e66ad9f5f2df17801bf09e | from konnection.settings.base import *
from pathlib import Path
import os
import dotenv
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
SECRET_KEY = 'temporaryKey'... | [((646, 676), 'os.path.join', 'os.path.join', (['BASE_DIR', '""".env"""'], {}), "(BASE_DIR, '.env')\n", (658, 676), False, 'import os\n'), ((680, 707), 'os.path.isfile', 'os.path.isfile', (['dotenv_file'], {}), '(dotenv_file)\n', (694, 707), False, 'import os\n'), ((1009, 1037), 'os.getenv', 'os.getenv', (['"""GITHUB_W... |
PotentialParadox/PyReparm | main.py | 70062e351eebacb9c6cb3dc0262e97256c52be3d | import random
from evaluation import Evaluator
from generator import generator
from mutate import mutateset
from deap import base
from deap import creator
from deap import tools
from parameter_group import ParameterGroup
import gaussian_output
from analysis import Analysis
from gaussian_input import GaussianInput
from ... | [((922, 938), 'reparm_data.ReparmData', 'ReparmData', (['file'], {}), '(file)\n', (932, 938), False, 'from reparm_data import ReparmData\n'), ((2206, 2240), 'evaluation.Evaluator', 'Evaluator', ([], {'reparm_data': 'reparm_data'}), '(reparm_data=reparm_data)\n', (2215, 2240), False, 'from evaluation import Evaluator\n'... |
arenius/pyx12 | pyx12/test/test_x12context.py | 537493deaa0b8e18a3fa72eb1b3eeae9ef043b11 | import unittest
#import tempfile
try:
from StringIO import StringIO
except:
from io import StringIO
import pyx12.error_handler
from pyx12.errors import EngineError # , X12PathError
import pyx12.x12context
import pyx12.params
from pyx12.test.x12testdata import datafiles
class X12fileTestCase(unittest.TestCas... | [((482, 498), 'io.StringIO', 'StringIO', (['x12str'], {}), '(x12str)\n', (490, 498), False, 'from io import StringIO\n'), ((538, 548), 'io.StringIO', 'StringIO', ([], {}), '()\n', (546, 548), False, 'from io import StringIO\n'), ((609, 643), 'io.StringIO', 'StringIO', (['x12str'], {'encoding': '"""ascii"""'}), "(x12str... |
Hades01/Addons | repo/script.module.liveresolver/lib/liveresolver/resolvers/finecast.py | 710da97ac850197498a3cd64be1811c593610add | # -*- coding: utf-8 -*-
import re,urlparse,cookielib,os,urllib
from liveresolver.modules import client,recaptcha_v2,control,constants, decryptionUtils
from liveresolver.modules.log_utils import log
cookieFile = os.path.join(control.dataPath, 'finecastcookie.lwp')
def resolve(url):
#try:
try:
... | [((213, 265), 'os.path.join', 'os.path.join', (['control.dataPath', '"""finecastcookie.lwp"""'], {}), "(control.dataPath, 'finecastcookie.lwp')\n", (225, 265), False, 'import re, urlparse, cookielib, os, urllib\n'), ((610, 653), 'liveresolver.modules.client.request', 'client.request', (['url'], {'referer': 'referer', '... |
crylearner/RIDE3X | src/robotide/publish/__init__.py | 767f45b0c908f18ecc7473208def8dc7489f43b0 | # Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 appl... | [((5093, 5118), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (5108, 5118), False, 'import os\n')] |
pizzapanther/google-actions-python-example | app.py | 40d13fc1821e1e11f15cc7413571cb5bd6327024 | #!/usr/bin/env python
import os
import json
import tornado.ioloop
import tornado.log
import tornado.web
from google.oauth2 import id_token
from google.auth.transport import requests as google_requests
import jwt
import requests
API_KEY = os.environ.get('OPEN_WEATHER_MAP_KEY', None)
PROJECT_ID = os.environ.get('PRO... | [((243, 287), 'os.environ.get', 'os.environ.get', (['"""OPEN_WEATHER_MAP_KEY"""', 'None'], {}), "('OPEN_WEATHER_MAP_KEY', None)\n", (257, 287), False, 'import os\n'), ((301, 335), 'os.environ.get', 'os.environ.get', (['"""PROJECT_ID"""', 'None'], {}), "('PROJECT_ID', None)\n", (315, 335), False, 'import os\n'), ((1119,... |
EVEprosper/ProsperCookiecutters | ProsperFlask/{{cookiecutter.project_name}}/tests/conftest.py | 569ca0c311a5ead2b49f0cdde4cb2ad14dcd3a2c | # AUTOGENERATED BY: ProsperCookiecutters/ProsperFlask
# TEMPLATE VERSION: {{cookiecutter.template_version}}
# AUTHOR: {{cookiecutter.author_name}}
"""PyTest fixtures and modifiers"""
import pytest
from {{cookiecutter.library_name}}.endpoints import APP
@pytest.fixture
def app():
"""flask test hook for dry-runni... | [] |
RealOrangeOne/yuri | zoloto/coords.py | 6ed55bdf97c6add22cd6c71c39ca30e2229337cb | from typing import Iterator, NamedTuple, Tuple
from cached_property import cached_property
from cv2 import Rodrigues
from pyquaternion import Quaternion
class Coordinates(NamedTuple):
"""
:param float x: X coordinate
:param float y: Y coordinate
"""
x: float
y: float
class ThreeDCoordinate... | [((1153, 1179), 'cv2.Rodrigues', 'Rodrigues', (['(e_x, e_y, e_z)'], {}), '((e_x, e_y, e_z))\n', (1162, 1179), False, 'from cv2 import Rodrigues\n'), ((1207, 1241), 'pyquaternion.Quaternion', 'Quaternion', ([], {'matrix': 'rotation_matrix'}), '(matrix=rotation_matrix)\n', (1217, 1241), False, 'from pyquaternion import Q... |
JonathanGailliez/azure-sdk-for-python | azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/bms_container_query_object.py | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | # 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 ... | [] |
rdenadai/ia870p3 | ia870/iagradm.py | c4823efc4b8e5f187a64f8a4e9962e328bf86967 | # -*- encoding: utf-8 -*-
# Module iagradm
def iagradm(f, Bdil=None, Bero=None):
from ia870 import iasubm,iadil,iaero,iasecross
if Bdil is None: Bdil = iasecross()
if Bero is None: Bero = iasecross()
y = iasubm( iadil(f,Bdil),iaero(f,Bero))
return y
| [((162, 173), 'ia870.iasecross', 'iasecross', ([], {}), '()\n', (171, 173), False, 'from ia870 import iasubm, iadil, iaero, iasecross\n'), ((202, 213), 'ia870.iasecross', 'iasecross', ([], {}), '()\n', (211, 213), False, 'from ia870 import iasubm, iadil, iaero, iasecross\n'), ((231, 245), 'ia870.iadil', 'iadil', (['f',... |
ChristchurchCityWeightlifting/lifter-api | backend/api/tests/test_models/test_utils/test_ranking_suffixes.py | a82b79c75106e7f4f8ea4b4e3e12d727213445e3 | import pytest
from api.models.utils import rankings
@pytest.fixture
def test_data():
return [1, 11, 101]
def test_rankings(test_data):
"""Tests if ranking works
e.g. 1 returns 1st
11 returns 11th
101 return 101st
"""
assert rankings(test_data[0]) == "1st"
assert rankings(t... | [((267, 289), 'api.models.utils.rankings', 'rankings', (['test_data[0]'], {}), '(test_data[0])\n', (275, 289), False, 'from api.models.utils import rankings\n'), ((310, 332), 'api.models.utils.rankings', 'rankings', (['test_data[1]'], {}), '(test_data[1])\n', (318, 332), False, 'from api.models.utils import rankings\n'... |
NoXLaw/RaRCTF2021-Challenges-Public | web/web-lemonthinker/src/app/app.py | 1a1b094359b88f8ebbc83a6b26d27ffb2602458f | from flask import Flask, request, redirect, url_for
import os
import random
import string
import time # lemonthink
clean = time.time()
app = Flask(__name__)
chars = list(string.ascii_letters + string.digits)
@app.route('/')
def main():
return open("index.html").read()
@app.route('/generate', methods=['POST'])
de... | [((124, 135), 'time.time', 'time.time', ([], {}), '()\n', (133, 135), False, 'import time\n'), ((142, 157), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (147, 157), False, 'from flask import Flask, request, redirect, url_for\n'), ((586, 639), 'os.system', 'os.system', (['f"""python3 generate.py {filename... |
renatodev95/Python | aprendizado/codewars/descending_order.py | 2adee4a01de41f8bbb68fce563100c135a5ab549 | # Your task is to make a function that can take any non-negative integer as an argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number.
# Função que recebe um número inteiro (não negativo) como argumento e o retorna com os dígitos em ordem des... | [] |
Schramp/dmarc-monitoring | dmarc_storage.py | 619a162f71a788e81d92ca281ec0bdcf13c2e8e8 | import sqlite3
import os
import datetime
__all__ = ['DMARCStorage', 'totimestamp']
def totimestamp(datetime_object):
if datetime_object.utcoffset() is not None:
utc_naive = datetime_object.replace(tzinfo=None) - datetime_object.utcoffset()
else:
utc_naive = datetime_object
return (utc_nai... | [((562, 613), 'os.path.join', 'os.path.join', (['database_directory', 'database_filename'], {}), '(database_directory, database_filename)\n', (574, 613), False, 'import os\n'), ((730, 760), 'sqlite3.connect', 'sqlite3.connect', (['database_path'], {}), '(database_path)\n', (745, 760), False, 'import sqlite3\n'), ((629,... |
mcdruid/sumologic-python-sdk | setup.py | cb1d649d0166976fb104866e9174a41bd558b817 | from setuptools import setup, find_packages
setup(
name="sumologic-sdk",
version="0.1.9",
packages=find_packages(),
install_requires=['requests>=2.2.1'],
# PyPI metadata
author="Yoway Buorn, Melchi Salins",
author_email="it@sumologic.com, melchisalins@icloud.com",
description="Sumo Logi... | [((112, 127), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (125, 127), False, 'from setuptools import setup, find_packages\n')] |
urm8/django-translations | docs/conf.py | e8f66710af9433044937b75c061e1988add398a5 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | [((1054, 1068), 'django.setup', 'django.setup', ([], {}), '()\n', (1066, 1068), False, 'import django\n'), ((1294, 1307), 'json.load', 'json.load', (['fh'], {}), '(fh)\n', (1303, 1307), False, 'import json\n'), ((1856, 1879), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1877, 1879), False, 'impo... |
orchardbirds/skorecard-1 | skorecard/metrics/__init__.py | 0f5375a6c159bb35f4b62c5be75a742bf50885e2 | """Import required Metric."""
from .metrics import IV_scorer
__all__ = ["IV_scorer"]
| [] |
geant-multicloud/MCMS-mastermind | src/waldur_core/core/tests/helpers.py | 81333180f5e56a0bc88d7dad448505448e01f24e | import copy
from django.conf import settings
from django.test.utils import override_settings
from rest_framework import status, test
class PermissionsTest(test.APITransactionTestCase):
"""
Abstract class for permissions tests.
Methods `get_urls_configs`, `get_users_with_permission`,
`get_users_witho... | [((5168, 5203), 'copy.deepcopy', 'copy.deepcopy', (['settings.WALDUR_CORE'], {}), '(settings.WALDUR_CORE)\n', (5181, 5203), False, 'import copy\n'), ((5250, 5296), 'django.test.utils.override_settings', 'override_settings', ([], {'WALDUR_CORE': 'waldur_settings'}), '(WALDUR_CORE=waldur_settings)\n', (5267, 5296), False... |
Gummary/denet | data/benchmark.py | 00d814d75eea54d5b259fce128ae7b625a900140 | """
CutBlur
Copyright 2020-present NAVER corp.
MIT license
"""
import os
import glob
import data
class BenchmarkSR(data.BaseDataset):
def __init__(self, phase, opt):
root = opt.dataset_root
self.scale = opt.scale
dir_HQ, dir_LQ = self.get_subdir()
self.HQ_paths = sorted(glob.glob(o... | [((319, 354), 'os.path.join', 'os.path.join', (['root', 'dir_HQ', '"""*.png"""'], {}), "(root, dir_HQ, '*.png')\n", (331, 354), False, 'import os\n'), ((398, 433), 'os.path.join', 'os.path.join', (['root', 'dir_LQ', '"""*.png"""'], {}), "(root, dir_LQ, '*.png')\n", (410, 433), False, 'import os\n')] |
iTeam-co/pytglib | pytglib/api/types/update_chat_is_pinned.py | e5e75e0a85f89b77762209b32a61b0a883c0ae61 |
from ..utils import Object
class UpdateChatIsPinned(Object):
"""
A chat was pinned or unpinned
Attributes:
ID (:obj:`str`): ``UpdateChatIsPinned``
Args:
chat_id (:obj:`int`):
Chat identifier
is_pinned (:obj:`bool`):
New value of is_pinned
... | [] |
jairhenrique/todoist-python | tests/test_api.py | 755b9bd8a4fdf4e96b2381613ac0c4bed99731e5 | import io
import time
import todoist
def test_stats_get(api_endpoint, api_token):
api = todoist.api.TodoistAPI(api_token, api_endpoint)
response = api.completed.get_stats()
assert 'days_items' in response
assert 'week_items' in response
assert 'karma_trend' in response
assert 'karma_last_upda... | [((95, 142), 'todoist.api.TodoistAPI', 'todoist.api.TodoistAPI', (['api_token', 'api_endpoint'], {}), '(api_token, api_endpoint)\n', (117, 142), False, 'import todoist\n'), ((395, 442), 'todoist.api.TodoistAPI', 'todoist.api.TodoistAPI', (['api_token', 'api_endpoint'], {}), '(api_token, api_endpoint)\n', (417, 442), Fa... |
dylancrockett/iot.io | setup.py | 472767186a5500e05b02d821f32e1208f3652418 | from setuptools import setup
import iotio
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="iot.io",
version=iotio.__version__,
packages=["iotio"],
author="Dylan Crockett",
author_email="dylanrcrockett@gmail.com",
license="MIT",
description="A management API ... | [((112, 890), 'setuptools.setup', 'setup', ([], {'name': '"""iot.io"""', 'version': 'iotio.__version__', 'packages': "['iotio']", 'author': '"""Dylan Crockett"""', 'author_email': '"""dylanrcrockett@gmail.com"""', 'license': '"""MIT"""', 'description': '"""A management API for connecting and managing Clients via websoc... |
xnoder/trellominer | trellominer/api/trello.py | 629d8f916486aa94a5bfa3a9497c36316c2864ed | import os
import requests
from trellominer.config import yaml
class HTTP(object):
def __init__(self):
self.config = yaml.read(os.getenv("TRELLO_CONFIG", default=os.path.join(os.path.expanduser('~'), ".trellominer.yaml")))
self.api_url = os.getenv("TRELLO_URL", default=self.config['api']['url'])... | [((262, 320), 'os.getenv', 'os.getenv', (['"""TRELLO_URL"""'], {'default': "self.config['api']['url']"}), "('TRELLO_URL', default=self.config['api']['url'])\n", (271, 320), False, 'import os\n'), ((344, 406), 'os.getenv', 'os.getenv', (['"""TRELLO_API_KEY"""'], {'default': "self.config['api']['key']"}), "('TRELLO_API_K... |
wezteoh/face_perception_thru_backprop | alexnet_guided_bp_vanilla.py | 449f78ce330876ff25fbcdf892023fd2ba86005c | import numpy as np
import tensorflow as tf
import os
from scipy.io import savemat
from scipy.io import loadmat
from scipy.misc import imread
from scipy.misc import imsave
from alexnet_face_classifier import *
import matplotlib.pyplot as plt
plt.switch_backend('agg')
class backprop_graph:
def __init__(self, num_... | [((243, 268), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (261, 268), True, 'import matplotlib.pyplot as plt\n'), ((1967, 1991), 'numpy.expand_dims', 'np.expand_dims', (['image', '(0)'], {}), '(image, 0)\n', (1981, 1991), True, 'import numpy as np\n'), ((2006, 2032), 'num... |
AferriDaniel/coaster | tests/test_sqlalchemy_registry.py | 3ffbc9d33c981284593445299aaee0c3cc0cdb0b | """Registry and RegistryMixin tests."""
from types import SimpleNamespace
import pytest
from coaster.db import db
from coaster.sqlalchemy import BaseMixin
from coaster.sqlalchemy.registry import Registry
# --- Fixtures -------------------------------------------------------------------------
@pytest.fixture()
def... | [((300, 316), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (314, 316), False, 'import pytest\n'), ((503, 519), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (517, 519), False, 'import pytest\n'), ((723, 739), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (737, 739), False, 'import pytest\n'), (... |
RomanMahar/personalsite | home/migrations/0010_auto_20180206_1625.py | ad0c7880e0ccfe81ea53b8bad8e0d4fcf0c5830b | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-02-06 16:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0028_merge'),
('home', '0009_remove_... | [((952, 1039), 'django.db.models.SlugField', 'models.SlugField', ([], {'default': '"""homepage-section"""', 'help_text': '"""no spaces"""', 'max_length': '(100)'}), "(default='homepage-section', help_text='no spaces',\n max_length=100)\n", (968, 1039), False, 'from django.db import migrations, models\n'), ((1164, 12... |
anniyanvr/nesta | nesta/packages/misc_utils/tests/test_guess_sql_type.py | 4b3ae79922cebde0ad33e08ac4c40b9a10e8e7c3 | import pytest
from nesta.packages.misc_utils.guess_sql_type import guess_sql_type
@pytest.fixture
def int_data():
return [1,2,4,False]
@pytest.fixture
def text_data():
return ['a', True, 2,
('A very long sentence A very long sentence A '
'very long sentence A very long sentence'), 'd... | [((502, 526), 'nesta.packages.misc_utils.guess_sql_type.guess_sql_type', 'guess_sql_type', (['int_data'], {}), '(int_data)\n', (516, 526), False, 'from nesta.packages.misc_utils.guess_sql_type import guess_sql_type\n'), ((595, 621), 'nesta.packages.misc_utils.guess_sql_type.guess_sql_type', 'guess_sql_type', (['float_d... |
DXCChina/pms | api/controller/activity.py | c779a69f25fb08101593c6ff0451debc0abce6e4 | # -*- coding: utf-8 -*-
'''活动管理接口'''
from flask import request
from model.db import database, Activity, ActivityMember, Demand, ActivityBase, ProjectMember, User
from model.role import identity
from flask_jwt_extended import (fresh_jwt_required)
def demand_activity_add(activity_id, data):
'''添加活动需求'''
for d... | [((1287, 1330), 'model.role.identity.check_permission', 'identity.check_permission', (['"""create"""', '"""task"""'], {}), "('create', 'task')\n", (1312, 1330), False, 'from model.role import identity\n'), ((2114, 2157), 'model.role.identity.check_permission', 'identity.check_permission', (['"""update"""', '"""task"""'... |
Rage-ops/Leetcode-Solutions | math/9. Palindrome number.py | 48d4ecbb92a0bb7a7bb74a1445b593a67357ac02 | # Easy
# https://leetcode.com/problems/palindrome-number/
# Time Complexity: O(log(x) to base 10)
# Space Complexity: O(1)
class Solution:
def isPalindrome(self, x: int) -> bool:
temp = x
rev = 0
while temp > 0:
rev = rev * 10 + temp % 10
temp //= 10
return re... | [] |
Eyepea/panoramisk | panoramisk/__init__.py | c10725e358f5b802faa9df1d22de6710927735a0 | from .manager import Manager # NOQA
from .call_manager import CallManager # NOQA
from . import fast_agi # NOQA
| [] |
kevinschoon/prtg-py | prtg/client.py | 714e0750606e55b2cd4c7dff8770d94057fa932b | # -*- coding: utf-8 -*-
"""
Python library for Paessler's PRTG (http://www.paessler.com/)
"""
import logging
import xml.etree.ElementTree as Et
from urllib import request
from prtg.cache import Cache
from prtg.models import Sensor, Device, Status, PrtgObject
from prtg.exceptions import BadTarget, UnknownResponse
cl... | [((2027, 2066), 'urllib.request.Request', 'request.Request', ([], {'url': 'req', 'method': 'method'}), '(url=req, method=method)\n', (2042, 2066), False, 'from urllib import request\n'), ((2702, 2709), 'prtg.cache.Cache', 'Cache', ([], {}), '()\n', (2707, 2709), False, 'from prtg.cache import Cache\n'), ((2304, 2324), ... |
da-h/tf-boilerplate | template/misc.py | ab8409c935d3fcbed07bbefd1cb0049d45283222 | import tensorflow as tf
from tensorflow.python.training.session_run_hook import SessionRunArgs
# Define data loaders #####################################
# See https://gist.github.com/peterroelants/9956ec93a07ca4e9ba5bc415b014bcca
class IteratorInitializerHook(tf.train.SessionRunHook):
"""Hook to initialise data... | [((1490, 1514), 'tensorflow.python.training.session_run_hook.SessionRunArgs', 'SessionRunArgs', (['requests'], {}), '(requests)\n', (1504, 1514), False, 'from tensorflow.python.training.session_run_hook import SessionRunArgs\n'), ((2691, 2715), 'tensorflow.python.training.session_run_hook.SessionRunArgs', 'SessionRunAr... |
uibcdf/pyunitwizard | pyunitwizard/_private_tools/parsers.py | 54cdce7369e1f2a3771a1f05a4a6ba1d7610a5e7 | parsers = ['openmm.unit', 'pint', 'unyt']
def digest_parser(parser: str) -> str:
""" Check if parser is correct."""
if parser is not None:
if parser.lower() in parsers:
return parser.lower()
else:
raise ValueError
else:
from pyunitwizard.kernel import default... | [] |
bartonlin/MWSD | metric_wsd/utils/data_utils.py | 70ad446ee7f00a11988acb290270e32d8e6af925 | '''
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.
Code taken from: https://github.com/facebookresearch/wsd-biencoders/blob/master/wsd_models/util.py
'''
import os
import re
impo... | [((5585, 5605), 'random.shuffle', 'random.shuffle', (['data'], {}), '(data)\n', (5599, 5605), False, 'import random\n'), ((2451, 2480), 'torch.split', 'torch.split', (['output', '(1)'], {'dim': '(0)'}), '(output, 1, dim=0)\n', (2462, 2480), False, 'import torch\n'), ((2952, 2986), 'torch.cat', 'torch.cat', (['combined_... |
TorgeirUstad/dlite | examples/dehydrogenation/3-property-mappings/mappings_from_ontology/run_w_onto.py | 1d7b4ccec0e76799a25992534cd295a80d83878a | #!/usr/bin/env python3
from typing import Dict, AnyStr
from pathlib import Path
from ontopy import get_ontology
import dlite
from dlite.mappings import make_instance
# Setup dlite paths
thisdir = Path(__file__).parent.absolute()
rootdir = thisdir.parent.parent
workflow1dir = rootdir / '1-simple-workflow'
entitiesdir... | [((391, 441), 'dlite.storage_path.append', 'dlite.storage_path.append', (['f"""{entitiesdir}/*.json"""'], {}), "(f'{entitiesdir}/*.json')\n", (416, 441), False, 'import dlite\n'), ((1602, 1660), 'dlite.get_instance', 'dlite.get_instance', (['"""http://onto-ns.com/meta/0.1/Molecule"""'], {}), "('http://onto-ns.com/meta/... |
lendoo73/my_idea_boxes | forms.py | c0d0e7bbd0b64ae35146f3792cd477d1ec8461b5 | from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed, FileRequired
from wtforms import StringField, PasswordField, BooleanField, TextAreaField, SubmitField, RadioField, HiddenField
from wtforms.fields.html5 import DateField, IntegerField
from wtforms.validators import ValidationError, DataR... | [((1442, 1478), 'wtforms.SubmitField', 'SubmitField', (['"""Register your Company"""'], {}), "('Register your Company')\n", (1453, 1478), False, 'from wtforms import StringField, PasswordField, BooleanField, TextAreaField, SubmitField, RadioField, HiddenField\n'), ((2323, 2346), 'wtforms.SubmitField', 'SubmitField', ([... |
fullmooncj/textmining_edu | 5.analysis/scikit-multilearn-master/skmultilearn/adapt/brknn.py | b1402fd96fbde945f48c52d71ba4dfe51fd96602 | from builtins import range
from ..base import MLClassifierBase
from ..utils import get_matrix_in_format
from sklearn.neighbors import NearestNeighbors
import scipy.sparse as sparse
import numpy as np
class BinaryRelevanceKNN(MLClassifierBase):
"""Binary Relevance adapted kNN Multi-Label Classifier."""
def __i... | [((3022, 3082), 'scipy.sparse.lil_matrix', 'sparse.lil_matrix', (['(X.shape[0], self.num_labels)'], {'dtype': '"""i8"""'}), "((X.shape[0], self.num_labels), dtype='i8')\n", (3039, 3082), True, 'import scipy.sparse as sparse\n'), ((3233, 3250), 'builtins.range', 'range', (['X.shape[0]'], {}), '(X.shape[0])\n', (3238, 32... |
eric-gro/api-client | groclient/constants.py | 0ca73422c25b5065907d068a44b72bdc43fea79f | """Constants about the Gro ontology that can be imported and re-used anywhere."""
REGION_LEVELS = {
'world': 1,
'continent': 2,
'country': 3,
'province': 4, # Equivalent to state in the United States
'district': 5, # Equivalent to county in the United States
'city': 6,
'market': 7,
'o... | [] |
CitizenB/pandas | asv_bench/benchmarks/tslibs/period.py | ee1efb6d923a2c3e5a912efe20a336179614993d | """
Period benchmarks that rely only on tslibs. See benchmarks.period for
Period benchmarks that rely on other parts fo pandas.
"""
from pandas import Period
from pandas.tseries.frequencies import to_offset
class PeriodProperties:
params = (
["M", "min"],
[
"year",
"mont... | [((731, 762), 'pandas.Period', 'Period', (['"""2012-06-01"""'], {'freq': 'freq'}), "('2012-06-01', freq=freq)\n", (737, 762), False, 'from pandas import Period\n'), ((966, 997), 'pandas.Period', 'Period', (['"""2012-06-01"""'], {'freq': 'freq'}), "('2012-06-01', freq=freq)\n", (972, 997), False, 'from pandas import Per... |
csadsl/poc_exp | Bugscan_exploits-master/exp_list/exp-1788.py | e3146262e7403f19f49ee2db56338fa3f8e119c9 | #/usr/bin/python
#-*- coding: utf-8 -*-
#Refer http://www.wooyun.org/bugs/wooyun-2015-0137140
#__Author__ = 上善若水
#_PlugName_ = whezeip Plugin
#_FileName_ = whezeip.py
def assign(service, arg):
if service == "whezeip":
return True, arg
def audit(arg):
raw = '''
POST /defaultroot/custom... | [] |
thecodingsim/learn-python | 3-working-with-lists/zip_tuples.py | bf8e98f40e73ebf7dcf5641312c2c0296d886952 | # Use zip() to create a new variable called names_and_dogs_names that combines owners and dogs_names lists into a zip object.
# Then, create a new variable named list_of_names_and_dogs_names by calling the list() function on names_and_dogs_names.
# Print list_of_names_and_dogs_names.
owners = ["Jenny", "Alexus", "Sa... | [] |
abhiomkar/couchdbkit | setup.py | 035062b504b57c1cc6e576be47fb05423fb1ddb3 | # -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
import os
import sys
if not hasattr(sys, 'version_info') or sys.version_info < (2, 5, 0, 'final'):
raise SystemExit("couchdbkit requires Python 2.5 or later.")
from setuptools import ... | [((1213, 1245), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests']"}), "(exclude=['tests'])\n", (1226, 1245), False, 'from setuptools import setup, find_packages\n'), ((540, 565), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (555, 565), False, 'import os\n')] |
othercodes/sample-todo-list-hexagonal-achitecture | tests/integration/test_infrastructure_persistence.py | a958c6906d8e777e837c8348c754b637b89a7031 | from typing import Optional
from complexheart.domain.criteria import Criteria
from sqlalchemy import create_engine
from sqlalchemy.engine import Engine
from sqlalchemy.orm import sessionmaker
from to_do_list.tasks.domain.models import Task
from to_do_list.tasks.infrastructure.persistence.relational import RelationalT... | [((444, 479), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///:memory:"""'], {}), "('sqlite:///:memory:')\n", (457, 479), False, 'from sqlalchemy import create_engine\n'), ((651, 684), 'to_do_list.tasks.infrastructure.persistence.relational.RelationalTaskRepository', 'RelationalTaskRepository', (['session'... |
minervaproject/wagtail-jinja2-extensions | wagtail_jinja2/extensions.py | 708f2f873273312ead80d67c3eff0555f152d072 | from jinja2.ext import Extension
from jinja2 import nodes
from jinja2 import Markup
from wagtail.wagtailadmin.templatetags.wagtailuserbar import wagtailuserbar as original_wagtailuserbar
from wagtail.wagtailimages.models import Filter, SourceImageIOError
class WagtailUserBarExtension(Extension):
tags = set(['wag... | [((1541, 1587), 'wagtail.wagtailimages.models.Filter.objects.get_or_create', 'Filter.objects.get_or_create', ([], {'spec': 'filter_spec'}), '(spec=filter_spec)\n', (1569, 1587), False, 'from wagtail.wagtailimages.models import Filter, SourceImageIOError\n'), ((587, 619), 'wagtail.wagtailadmin.templatetags.wagtailuserba... |
XiaoguTech/rta-sandbox | rta/provision/__init__.py | 2783a3ba8920bf64273761ce7392e51c9c8fb1f7 | from rta.provision.utils import *
from rta.provision.passwd import *
from rta.provision.influxdb import *
from rta.provision.grafana import *
from rta.provision.kapacitor import *
| [] |
Pingziwalk/nn_dataflow | nn_dataflow/tests/unit_test/test_network.py | 5ae8eeba4e243df6e9a69127073513a852a62d17 | """ $lic$
Copyright (C) 2016-2020 by Tsinghua University and The Board of Trustees of
Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it wi... | [((987, 1006), 'nn_dataflow.core.Network', 'Network', (['"""test_net"""'], {}), "('test_net')\n", (994, 1006), False, 'from nn_dataflow.core import Network\n'), ((1327, 1346), 'nn_dataflow.core.Network', 'Network', (['"""test_net"""'], {}), "('test_net')\n", (1334, 1346), False, 'from nn_dataflow.core import Network\n'... |
Jingil-Integrated-Management/JIM_backend | apps/division/urls.py | f0e7860d57eddaee034531a52ab91d6715d12c18 | from django.urls import path
from .views import DivisionListCreateAPIView, DivisionRetrieveUpdateDestroyAPIView, MainDivisionListAPIView
urlpatterns = [
path('division/', DivisionListCreateAPIView.as_view()),
path('division/<division_pk>', DivisionRetrieveUpdateDestroyAPIView.as_view()),
path('division/m... | [] |
nashalex/sympy | sympy/solvers/tests/test_pde.py | aec3e6512be46f0558f5dbcf2b4d723496c91649 | from sympy import (Derivative as D, Eq, exp, sin,
Function, Symbol, symbols, cos, log)
from sympy.core import S
from sympy.solvers.pde import (pde_separate, pde_separate_add, pde_separate_mul,
pdsolve, classify_pde, checkpdesol)
from sympy.testing.pytest import raises
a, b, c, x, y = symbols('a b c x y')
def... | [((295, 315), 'sympy.symbols', 'symbols', (['"""a b c x y"""'], {}), "('a b c x y')\n", (302, 315), False, 'from sympy import Derivative as D, Eq, exp, sin, Function, Symbol, symbols, cos, log\n'), ((363, 381), 'sympy.symbols', 'symbols', (['"""x,y,z,t"""'], {}), "('x,y,z,t')\n", (370, 381), False, 'from sympy import D... |
EasternJournalist/learn-deep-learning | GCN/GCN.py | cc424713ffc57b8a796ebd81354a1b887f9c5092 | import torch
import torch.nn.functional as F
import pandas as pd
import numpy as np
from torch_geometric.data import Data
from torch_geometric.nn import GCNConv, PairNorm
from torch_geometric.utils.undirected import to_undirected
import random
import matplotlib.pyplot as plt
data_name = 'citeseer' # 'cora' or 'ci... | [((466, 532), 'pandas.read_table', 'pd.read_table', (['data_content_path'], {'header': 'None', 'dtype': '{(0): np.str}'}), '(data_content_path, header=None, dtype={(0): np.str})\n', (479, 532), True, 'import pandas as pd\n'), ((541, 597), 'pandas.read_table', 'pd.read_table', (['data_edge_path'], {'header': 'None', 'dt... |
ESG-Leipzig/Homepage-2015 | esg_leipzig_homepage_2015/views.py | 6b77451881031dcb640d2e61ce862617d634f9ac | import datetime
import json
from django.conf import settings
from django.http import Http404
from django.utils import timezone
from django.views import generic
from .models import Event, FlatPage, News
class HomeView(generic.ListView):
"""
View for the first page called 'Home'.
"""
context_object_na... | [((2115, 2137), 'json.dumps', 'json.dumps', (['event_list'], {}), '(event_list)\n', (2125, 2137), False, 'import json\n'), ((609, 623), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (621, 623), False, 'from django.utils import timezone\n'), ((626, 685), 'datetime.timedelta', 'datetime.timedelta', ([], ... |
ronniechong/tensorflow-trainer | train.py | 79e58d224ce1e5ae687abee2bfd81deb49bd41dd | from dotenv import load_dotenv
load_dotenv()
from flask import Flask, flash, request, redirect, url_for
from flask_ngrok import run_with_ngrok
from flask_cors import CORS
from werkzeug.utils import secure_filename
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.applications import vgg16
fro... | [((31, 44), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (42, 44), False, 'from dotenv import load_dotenv\n'), ((546, 561), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (551, 561), False, 'from flask import Flask, flash, request, redirect, url_for\n'), ((579, 601), 'os.getenv', 'os.getenv', (['... |
sandorfoldi/chess_positions_recognition | src/models/train_model.py | b051f5ba066876d54c435d96cf7e339dfc369b3b | import random
import matplotlib.pyplot as plt
import wandb
import hydra
import torch
import torch.utils.data as data_utils
from model import ChessPiecePredictor
from torch import nn, optim
from google.cloud import storage
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datas... | [((346, 401), 'hydra.main', 'hydra.main', ([], {'config_path': '"""../conf"""', 'config_name': '"""config"""'}), "(config_path='../conf', config_name='config')\n", (356, 401), False, 'import hydra\n'), ((552, 564), 'wandb.init', 'wandb.init', ([], {}), '()\n', (562, 564), False, 'import wandb\n'), ((570, 597), 'torch.m... |
fairseq-FT/fairseq | fairseq/scoring/__init__.py | 18725499144c1bba7c151b796ba774e59d36eaa9 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import os
from abc import ABC, abstractmethod
from fairseq import registry
from omegaconf import DictConfig
class BaseSco... | [((714, 766), 'fairseq.registry.setup_registry', 'registry.setup_registry', (['"""--scoring"""'], {'default': '"""bleu"""'}), "('--scoring', default='bleu')\n", (737, 766), False, 'from fairseq import registry\n'), ((1197, 1222), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1212, 1222), Fa... |
richardhaslam/discrete-fracture-network | dfn/tests/test_FractureNetworkThermal.py | 2a235fdd3aedfb80dbd9f441d07c5713a6d6c74f | import copy
import unittest
import networkx as nx
import numpy as np
from scipy.special import erf
from dfn import Fluid, FractureNetworkThermal
class TestFractureNetworkThermal(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestFractureNetworkThermal, self).__init__(*args, **kwargs)
... | [((10801, 10816), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10814, 10816), False, 'import unittest\n'), ((432, 488), 'dfn.Fluid', 'Fluid', ([], {'density': 'rho_w', 'viscosity': 'mu_w', 'heat_capacity': 'cp_w'}), '(density=rho_w, viscosity=mu_w, heat_capacity=cp_w)\n', (437, 488), False, 'from dfn import Flu... |
gusamarante/Quantequim | dataapi/AWS/getawsdata.py | 3968d9965e8e2c3b5850f1852b56c485859a9c89 | """
Author: Gustavo Amarante
"""
import numpy as np
import pandas as pd
from datetime import datetime
class TrackerFeeder(object):
"""
Feeder for the trackers of the FinanceHub database.
"""
def __init__(self, db_connect):
"""
Feeder construction
:param db_connect: sql connec... | [((1266, 1307), 'pandas.read_sql', 'pd.read_sql', ([], {'sql': 'sql_query', 'con': 'self.conn'}), '(sql=sql_query, con=self.conn)\n', (1277, 1307), True, 'import pandas as pd\n'), ((1490, 1514), 'pandas.to_datetime', 'pd.to_datetime', (['df.index'], {}), '(df.index)\n', (1504, 1514), True, 'import pandas as pd\n'), ((1... |
mklew/quickstart-data-lake-qubole | assets/utils/config.py | bb9b4a559815fc293b0fa06aa7e536fe14ced6dd | from configparser import ConfigParser
CONFIG_INT_KEYS = {
'hadoop_max_nodes_count',
'hadoop_ebs_volumes_count',
'hadoop_ebs_volume_size',
'spark_max_nodes_count',
'spark_ebs_volumes_count',
'spark_ebs_volume_size'
}
def read_config(config_path):
parser = ConfigParser()
parser.read(con... | [((286, 300), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (298, 300), False, 'from configparser import ConfigParser\n')] |
lvyaoo/api-demo | app/blueprints/admin_api/__init__.py | f45c05c154385510572b5200b74dcbbfdb7e234c | from flask import Blueprint
from .hooks import admin_auth
from ...api_utils import *
bp_admin_api = Blueprint('bp_admin_api', __name__)
bp_admin_api.register_error_handler(APIError, handle_api_error)
bp_admin_api.register_error_handler(500, handle_500_error)
bp_admin_api.register_error_handler(400, handle_400_error)... | [((103, 138), 'flask.Blueprint', 'Blueprint', (['"""bp_admin_api"""', '__name__'], {}), "('bp_admin_api', __name__)\n", (112, 138), False, 'from flask import Blueprint\n')] |
nihaagarwalla/nd320-c1-emr-data-starter | project/starter_code/student_utils.py | 6ce6bb65e89b38f1c2119a739b892ad2504adf7d | import pandas as pd
import numpy as np
import os
import tensorflow as tf
import functools
####### STUDENTS FILL THIS OUT ######
#Question 3
def reduce_dimension_ndc(df, ndc_df):
'''
df: pandas dataframe, input dataset
ndc_df: pandas dataframe, drug code dataset used for mapping in generic names
return:... | [((1638, 1688), 'pandas.merge', 'pd.merge', (['df', 'ndc_df'], {'on': "['ndc_code']", 'how': '"""inner"""'}), "(df, ndc_df, on=['ndc_code'], how='inner')\n", (1646, 1688), True, 'import pandas as pd\n'), ((4976, 5044), 'functools.partial', 'functools.partial', (['normalize_numeric_with_zscore'], {'mean': 'MEAN', 'std':... |
peendebak/core_tools | core_tools/utility/plotting/plot_1D.py | 2e43edf0bbc1d7ceb7042559db499535e8f6a076 | import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import copy
from core_tools.utility.plotting.plot_settings import plot_layout, graph_settings_1D, _1D_raw_plot_data
from core_tools.utility.plotting.plot_general import _data_plotter
class plotter_1D(_data_plotter):
def __init__(self, plt_la... | [((3136, 3155), 'core_tools.utility.plotting.plot_settings.graph_settings_1D', 'graph_settings_1D', ([], {}), '()\n', (3153, 3155), False, 'from core_tools.utility.plotting.plot_settings import plot_layout, graph_settings_1D, _1D_raw_plot_data\n'), ((327, 340), 'core_tools.utility.plotting.plot_settings.plot_layout', '... |
Forec/lan-ichat | v0.3/achat.py | f2ae85ef6a8f2b30126be787e52785971c926d8c | # last edit date: 2016/11/2
# author: Forec
# LICENSE
# Copyright (c) 2015-2017, Forec <forec@bupt.edu.cn>
# Permission to use, copy, modify, and/or distribute this code for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
... | [((1164, 1195), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (1189, 1195), False, 'import threading\n'), ((1437, 1454), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (1452, 1454), False, 'import pyaudio\n'), ((2347, 2367), 'struct.calcsize', 'struct.calcsize', (['"""L"... |
dennereed/paleocore | gdb/util.py | d6da6c39cde96050ee4b9e7213ec1200530cbeee | from gdb.models import *
| [] |
razortheory/who-iwg-webapp | iwg_blog/blog/views/__init__.py | e2318d286cd9ab87d4d8103bc7b3072cfb99bf76 | from .base import ArticleView, ArticlePreviewView, ArticleListView, SearchView, LandingView, \
CategoryView, TagView, SubscribeForUpdates, UnsubscribeFromUpdates
from .ajax import GetArticleSlugAjax, TagsAutocompleteAjax
from .errors import page_not_found, server_error
| [] |
snake-biscuits/io_import_rbsp | io_import_rbsp/rbsp/rpak_materials.py | 0de47dc70c373cc0417cc222d5d83e6dde72068b | # by MrSteyk & Dogecore
# TODO: extraction instructions & testing
import json
import os.path
from typing import List
import bpy
loaded_materials = {}
MATERIAL_LOAD_PATH = "" # put your path here
# normal has special logic
MATERIAL_INPUT_LINKING = {
"color": "Base Color",
"rough": "Roughness",
"spec": ... | [((718, 749), 'bpy.data.images.load', 'bpy.data.images.load', (['full_path'], {}), '(full_path)\n', (738, 749), False, 'import bpy\n'), ((1090, 1142), 'bpy.data.materials.new', 'bpy.data.materials.new', (["('materials/' + material_name)"], {}), "('materials/' + material_name)\n", (1112, 1142), False, 'import bpy\n')] |
alldevic/mtauksync | initcmds/models.py | 1a5d325ca8a7878aba5b292d7835546b24bb554c | from django.db import models
TASK_STATUS = (
("c", "created"),
("p", "progress"),
("s", "success"),
("f", "failed")
)
class TaskModel(models.Model):
lastrunned = models.DateTimeField(
"lastrunned", auto_now=False, auto_now_add=False)
taskname = models.CharField("taskname", max_lengt... | [((187, 257), 'django.db.models.DateTimeField', 'models.DateTimeField', (['"""lastrunned"""'], {'auto_now': '(False)', 'auto_now_add': '(False)'}), "('lastrunned', auto_now=False, auto_now_add=False)\n", (207, 257), False, 'from django.db import models\n'), ((282, 325), 'django.db.models.CharField', 'models.CharField',... |
ttsiouts/aardvark | aardvark/conf/reaper_conf.py | cbf29f332df86814dd581152faf863c0d29ae41c | # Copyright (c) 2018 European Organization for Nuclear Research.
# 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/LIC... | [((708, 820), 'oslo_config.cfg.OptGroup', 'cfg.OptGroup', (['"""reaper"""'], {'title': '"""Aardvark Service Options"""', 'help': '"""Configuration options for Aardvark service"""'}), "('reaper', title='Aardvark Service Options', help=\n 'Configuration options for Aardvark service')\n", (720, 820), False, 'from oslo_... |
jhlee93/WNet-cGAN-Keras | src/Data.py | 89666be91083735c3259e04907bbfbe1c89fc8f8 | import glob
import numpy as np
class Data:
def __init__(self, path, random=False):
"""
input:
path: path to the folder with subfolders: DSM, PAN, LABEL
max_num: int, num of samples
random: bool, to load samples randomly or from 0 to num_max
... | [((2176, 2196), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (2190, 2196), True, 'import numpy as np\n'), ((2446, 2460), 'numpy.arange', 'np.arange', (['num'], {}), '(num)\n', (2455, 2460), True, 'import numpy as np\n'), ((353, 383), 'glob.glob', 'glob.glob', (["(path + '/DSM/*.tif')"], {}), "(pat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.