repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
Eli-Tarrago/radssh
radssh/hostkey.py
ebf3c8f17c3768268dcd483e899a590698de4452
# # Copyright (c) 2014, 2016, 2018, 2020 LexisNexis Risk Data Management Inc. # # This file is part of the RadSSH software package. # # RadSSH is free software, released under the Revised BSD License. # You are permitted to use, modify, and redsitribute this software # according to the Revised BSD License, a copy of wh...
[((2479, 2495), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (2493, 2495), False, 'import threading\n'), ((2586, 2622), 'os.path.expanduser', 'os.path.expanduser', (['known_hosts_file'], {}), '(known_hosts_file)\n', (2604, 2622), False, 'import os\n'), ((2634, 2671), 'os.path.exists', 'os.path.exists', (['self...
jfpanisset/Cryptomatte
nuke/pymmh3.py
d7c71cff17a4e8895eb17520115aa45ff66b8540
''' pymmh3 was written by Fredrik Kihlander and enhanced by Swapnil Gusani, and is placed in the public domain. The authors hereby disclaim copyright to this source code. pure python implementation of the murmur3 hash algorithm https://code.google.com/p/smhasher/wiki/MurmurHash3 This was written for the times when y...
[((13790, 13865), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""pymurmur3"""', '"""pymurmur [options] "string to hash\\""""'], {}), '(\'pymurmur3\', \'pymurmur [options] "string to hash"\')\n', (13813, 13865), False, 'import argparse\n')]
pscff/dlite
bindings/python/tests/test_factory.py
4365d828dcaa1736cc78ff6ed9a65592f198ba25
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import dlite thisdir = os.path.abspath(os.path.dirname(__file__)) class Person: def __init__(self, name, age, skills): self.name = name self.age = age self.skills = skills def __repr__(self): return 'Person(%r, %r, %r)'...
[((450, 485), 'dlite.classfactory', 'dlite.classfactory', (['Person'], {'url': 'url'}), '(Person, url=url)\n', (468, 485), False, 'import dlite\n'), ((836, 884), 'dlite.loadfactory', 'dlite.loadfactory', (['Person', '"""json://persons.json"""'], {}), "(Person, 'json://persons.json')\n", (853, 884), False, 'import dlite...
bky373/elice-racer-1st
week_11_DS_N_Algorithm/03_Thr_Lecture/실습6_연속 부분 최대합.py
ddea8079a1083796ed4f59c38650ff8f4333e6ef
''' 연속 부분 최대합 nn개의 숫자가 주어질 때, 연속 부분을 선택하여 그 합을 최대화 하는 프로그램을 작성하시오. 예를 들어, 다음과 같이 8개의 숫자가 있다고 하자. 1 2 -4 5 3 -2 9 -10 이 때, 연속 부분이란 연속하여 숫자를 선택하는 것을 말한다. 가능한 연속 부분으로써 [1, 2, -4], [5, 3, -2, 9], [9, -10] 등이 있을 수 있다. 이 연속 부분들 중에서 가장 합이 큰 연속 부분은 [5, 3, -2, 9] 이며, 이보다 더 합을 크게 할 수는 없다. 따라서 연속 부분 최대합은 5+3+(-2)+9 = 15 이다...
[]
jensstein/mockdock
tests/test_dns.py
4eec294f33d929d361973c1708d2aa856a9900a0
#!/usr/bin/env python3 import unittest from mockdock import dns class DNSTest(unittest.TestCase): def test_build_packet(self): data = b"^4\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x06google\x03com\x00\x00\x01\x00\x01" packet = dns.build_packet(data, "192.168.0.1") expeced_result = b"^4\x81...
[((249, 286), 'mockdock.dns.build_packet', 'dns.build_packet', (['data', '"""192.168.0.1"""'], {}), "(data, '192.168.0.1')\n", (265, 286), False, 'from mockdock import dns\n')]
zhongnansu/es-cli
tests/conftest.py
e0656c21392e52a8b9cfafa69acfa0c13b743a9c
""" Copyright 2019, Amazon Web Services Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
[((773, 805), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (787, 805), False, 'import pytest\n'), ((961, 993), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (975, 993), False, 'import pytest\n'), ((1215, 1260), 'pytest.fi...
Damiian1/techwizardshardware
Cogs/ServerStats.py
97ceafc15036be4136e860076d73d74f1887f041
import asyncio import discord from datetime import datetime from operator import itemgetter from discord.ext import commands from Cogs import Nullify from Cogs import DisplayName from Cogs import UserTime from Cogs import Message def setup(bot): # Add the bot...
[((1159, 1194), 'discord.ext.commands.command', 'commands.command', ([], {'pass_context': '(True)'}), '(pass_context=True)\n', (1175, 1194), False, 'from discord.ext import commands\n'), ((6950, 6985), 'discord.ext.commands.command', 'commands.command', ([], {'pass_context': '(True)'}), '(pass_context=True)\n', (6966, ...
Rseiji/TCC-2020
chess_commentary_model/transformers_model/dataset_preprocessing.py
da68a49da38adf1bcf590b3028894d7834a28157
"""Métodos de preprocessamento de testes individuais """ import pandas as pd import numpy as np import math def test_1(df, seed=0): """training: balanced; test: balanced training: 80k (40k 0, 40k 1) test: 20k (10k 0, 10k 1) """ df_ones = df[df['label'] == 1] df_zeros = df[df['label'] ...
[((685, 733), 'pandas.concat', 'pd.concat', (['[df_ones_training, df_zeros_training]'], {}), '([df_ones_training, df_zeros_training])\n', (694, 733), True, 'import pandas as pd\n'), ((816, 856), 'pandas.concat', 'pd.concat', (['[df_ones_test, df_zeros_test]'], {}), '([df_ones_test, df_zeros_test])\n', (825, 856), True,...
kubakoziczak/gasSteamPowerPlant
venv/Lib/site-packages/CoolProp/constants.py
e6c036cc66ee2ff0b3f2fc923d0991bf57295d61
# This file is automatically generated by the generate_constants_module.py script in wrappers/Python. # DO NOT MODIFY THE CONTENTS OF THIS FILE! from __future__ import absolute_import from . import _constants INVALID_PARAMETER = _constants.INVALID_PARAMETER igas_constant = _constants.igas_constant imolar_mass = _cons...
[]
mingruimingrui/torch-datasets
torch_datasets/samplers/balanced_batch_sampler.py
2640b8c4fa82156e68e617fc545a546b4e08dc4e
import random import torch.utils.data.sampler class BalancedBatchSampler(torch.utils.data.sampler.BatchSampler): def __init__( self, dataset_labels, batch_size=1, steps=None, n_classes=0, n_samples=2 ): """ Create a balanced batch sampler for label based...
[((1796, 1845), 'random.sample', 'random.sample', (['self.labels_subset', 'self.n_classes'], {}), '(self.labels_subset, self.n_classes)\n', (1809, 1845), False, 'import random\n'), ((2535, 2576), 'random.sample', 'random.sample', (['batch_ids', 'self.batch_size'], {}), '(batch_ids, self.batch_size)\n', (2548, 2576), Fa...
likenamehaojie/Apache-Ambari-ZH
ambari-common/src/main/python/resource_management/libraries/functions/get_bare_principal.py
5973025bd694cdbb4b49fb4c4e0d774782811ff6
#!/usr/bin/env python """ 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");...
[((1272, 1337), 're.match', 're.match', (['"""([^/@]+)(?:/[^@])?(?:@.*)?"""', 'normalized_principal_name'], {}), "('([^/@]+)(?:/[^@])?(?:@.*)?', normalized_principal_name)\n", (1280, 1337), False, 'import re\n')]
study-machine-learning/dongheon.shin
04/cross_validation.01.py
6103ef9c73b162603bc39a27e4ecca0f1ac35e57
from sklearn import svm, metrics import random import re def split(rows): data = [] labels = [] for row in rows: data.append(row[0:4]) labels.append(row[4]) return (data, labels) def calculate_score(train, test): train_data, train_label = split(train) test_data, test_la...
[((783, 802), 'random.shuffle', 'random.shuffle', (['csv'], {}), '(csv)\n', (797, 802), False, 'import random\n'), ((356, 365), 'sklearn.svm.SVC', 'svm.SVC', ([], {}), '()\n', (363, 365), False, 'from sklearn import svm, metrics\n'), ((466, 509), 'sklearn.metrics.accuracy_score', 'metrics.accuracy_score', (['test_label...
wix/wix-oss-infra
third_party/org_specs2.bzl
b57ac2f0f66487cfdd08293a8fa389efe3d42c43
load("@wix_oss_infra//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external") def dependencies(): import_external( name = "org_specs2_specs2_fp_2_12", artifact = "org.specs2:specs2-fp_2.12:4.8.3", artifact_sha256 = "777962ca58054a9ea86e294e025453ecf394c60084c28bd61...
[]
beregok/pythontask
task/w2/trenirovka/12-rivnist 2.py
50394ff2b52ab4f3273ec9ddc4b504d1f7b3159e
a = int(input()) b = int(input()) c = int(input()) d = int(input()) if a == 0 and b == 0: print("INF") else: if (d - b * c / a) != 0 and (- b / a) == (- b // a): print(- b // a) else: print("NO")
[]
atif-hassan/Regression_ReSampling
src/reg_resampler.py
194b2ae8efea7598a6690792d40e42aba74c111b
class resampler: def __init__(self): import pandas as pd from sklearn.preprocessing import LabelEncoder from collections import Counter import numpy as np self.bins = 3 self.pd = pd self.LabelEncoder = LabelEncoder self.Counter = Counter ...
[]
patrick-kidger/generalised_shapelets
get_data/speech_commands.py
04930c89dc4673e2af402895fe67655f8375a808
import os import pathlib import sklearn.model_selection import tarfile import torch import torchaudio import urllib.request here = pathlib.Path(__file__).resolve().parent def _split_data(tensor, stratify): # 0.7/0.15/0.15 train/val/test split (train_tensor, testval_tensor, train_stratify, testval_strati...
[((2082, 2101), 'os.path.exists', 'os.path.exists', (['loc'], {}), '(loc)\n', (2096, 2101), False, 'import os\n'), ((2489, 2517), 'torch.empty', 'torch.empty', (['(34975)', '(16000)', '(1)'], {}), '(34975, 16000, 1)\n', (2500, 2517), False, 'import torch\n'), ((2526, 2562), 'torch.empty', 'torch.empty', (['(34975)'], {...
duch94/spark_crud_test
app/endpoints/products.py
94a514797700c2e929792f0424fb0e9e911489b7
from datetime import datetime from typing import List from flask import Blueprint, jsonify, request, json from app.models.products import Product, Category, products_categories from app import db products_blueprint = Blueprint('products', __name__) def create_or_get_categories(p: dict) -> List[Category]...
[((228, 259), 'flask.Blueprint', 'Blueprint', (['"""products"""', '__name__'], {}), "('products', __name__)\n", (237, 259), False, 'from flask import Blueprint, jsonify, request, json\n'), ((1282, 1298), 'flask.json.loads', 'json.loads', (['data'], {}), '(data)\n', (1292, 1298), False, 'from flask import Blueprint, jso...
giuseppe/quay
util/config/validators/test/test_validate_bitbucket_trigger.py
a1b7e4b51974edfe86f66788621011eef2667e6a
import pytest from httmock import urlmatch, HTTMock from util.config import URLSchemeAndHostname from util.config.validator import ValidatorContext from util.config.validators import ConfigValidationException from util.config.validators.validate_bitbucket_trigger import BitbucketTriggerValidator from test.fixtures i...
[((753, 780), 'util.config.validators.validate_bitbucket_trigger.BitbucketTriggerValidator', 'BitbucketTriggerValidator', ([], {}), '()\n', (778, 780), False, 'from util.config.validators.validate_bitbucket_trigger import BitbucketTriggerValidator\n'), ((952, 984), 'httmock.urlmatch', 'urlmatch', ([], {'netloc': '"""bi...
silkoch42/Geometric-Optics-from-QM
Refraction.py
baf41b54c37835b527d5b98cb480d68bc2ff68c3
# -*- coding: utf-8 -*- """ Created on Fri Mar 15 16:51:16 2019 @author: Silvan """ import numpy as np import scipy import matplotlib.pyplot as plt k=1000 n1=2.0 n2=1.0 alpha=np.pi/6.0 beta=np.arcsin(n2/n1*np.sin(alpha)) ya=1.0 xa=-ya*np.tan(alpha) yb=-1.0 xb=-yb*np.tan(beta) def s(x): ...
[((1421, 1437), 'numpy.mean', 'np.mean', (['K2[25:]'], {}), '(K2[25:])\n', (1428, 1437), True, 'import numpy as np\n'), ((1441, 1504), 'matplotlib.pyplot.plot', 'plt.plot', (['x', '(K2 / M)'], {'label': '"""$|\\\\int_{-R}^{R}e^{i k s(x)}dx|^2$"""'}), "(x, K2 / M, label='$|\\\\int_{-R}^{R}e^{i k s(x)}dx|^2$')\n", (1449,...
italia/readthedocs.org
readthedocs/docsitalia/management/commands/clear_elasticsearch.py
440d3885380d20ec24081f76e26d20701749e179
"""Remove the readthedocs elasticsearch index.""" from __future__ import absolute_import from django.conf import settings from django.core.management.base import BaseCommand from elasticsearch import Elasticsearch class Command(BaseCommand): """Clear elasticsearch index.""" def handle(self, *args, **opti...
[((370, 402), 'elasticsearch.Elasticsearch', 'Elasticsearch', (['settings.ES_HOSTS'], {}), '(settings.ES_HOSTS)\n', (383, 402), False, 'from elasticsearch import Elasticsearch\n')]
vnbot2/BigGAN-PyTorch
train.py
1725269d52e05fbd4d06dac64aa4906a8ae7a760
""" BigGAN: The Authorized Unofficial PyTorch release Code by A. Brock and A. Andonian This code is an unofficial reimplementation of "Large-Scale GAN Training for High Fidelity Natural Image Synthesis," by A. Brock, J. Donahue, and K. Simonyan (arXiv 1809.11096). Let's go. """ import datetime impor...
[((1194, 1227), 'utils.update_config_roots', 'utils.update_config_roots', (['config'], {}), '(config)\n', (1219, 1227), False, 'import utils\n'), ((1267, 1297), 'utils.seed_rng', 'utils.seed_rng', (["config['seed']"], {}), "(config['seed'])\n", (1281, 1297), False, 'import utils\n'), ((1342, 1368), 'utils.prepare_root'...
geocam/geocamUtilWeb
geocamUtil/tempfiles.py
b64fc063c64b4b0baa140db4c126f2ff980756ab
# __BEGIN_LICENSE__ #Copyright (c) 2015, United States Government, as represented by the #Administrator of the National Aeronautics and Space Administration. #All rights reserved. # __END_LICENSE__ import os import time import random import shutil from glob import glob import traceback import sys from geocamUtil im...
[((692, 723), 'glob.glob', 'glob', (["('%s/*' % settings.TMP_DIR)"], {}), "('%s/*' % settings.TMP_DIR)\n", (696, 723), False, 'from glob import glob\n'), ((734, 745), 'time.time', 'time.time', ([], {}), '()\n', (743, 745), False, 'import time\n'), ((1337, 1355), 'geocamUtil.FileUtil.mkdirP', 'FileUtil.mkdirP', (['d'], ...
Lludion/Exercises-SE
Ex1:Tests/ex2.py
4d5b2b4f2989a3e2c7891ba2b766394dbfb43973
# Ce fichier contient (au moins) cinq erreurs. # Instructions: # - tester jusqu'à atteindre 100% de couverture; # - corriger les bugs;" # - envoyer le diff ou le dépôt git par email.""" import hypothesis from hypothesis import given, settings from hypothesis.strategies import integers, lists class BinHeap: #st...
[((2854, 2880), 'hypothesis.settings', 'settings', ([], {'max_examples': '(100)'}), '(max_examples=100)\n', (2862, 2880), False, 'from hypothesis import given, settings\n'), ((3612, 3639), 'hypothesis.settings', 'settings', ([], {'max_examples': '(1000)'}), '(max_examples=1000)\n', (3620, 3639), False, 'from hypothesis...
svalder/snewpy
python/snewpy/snowglobes.py
5723189ae3dce3506f2fab056bbef24c9ab1a31f
# -*- coding: utf-8 -*- """The ``snewpy.snowglobes`` module contains functions for interacting with SNOwGLoBES. `SNOwGLoBES <https://github.com/SNOwGLoBES/snowglobes>`_ can estimate detected event rates from a given input supernova neutrino flux. It supports many different neutrino detectors, detector materials and in...
[((2128, 2155), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2145, 2155), False, 'import logging\n'), ((16677, 16735), 're.compile', 're.compile', (['"""nu(e|mu|tau)(bar|)_([A-Z][a-z]*)(\\\\d*)_?(.*)"""'], {}), "('nu(e|mu|tau)(bar|)_([A-Z][a-z]*)(\\\\d*)_?(.*)')\n", (16687, 16735), Fal...
cyoon1729/Rlcycle
rlcycle/dqn_base/loss.py
5c65b9dd61a6fd5d6dfe92f0b3e04bf309828569
from typing import List, Tuple from omegaconf import DictConfig import torch import torch.nn as nn import torch.nn.functional as F from rlcycle.common.abstract.loss import Loss class DQNLoss(Loss): """Compute double DQN loss""" def __init__(self, hyper_params: DictConfig, use_cuda: bool): Loss.__in...
[((311, 354), 'rlcycle.common.abstract.loss.Loss.__init__', 'Loss.__init__', (['self', 'hyper_params', 'use_cuda'], {}), '(self, hyper_params, use_cuda)\n', (324, 354), False, 'from rlcycle.common.abstract.loss import Loss\n'), ((1206, 1249), 'rlcycle.common.abstract.loss.Loss.__init__', 'Loss.__init__', (['self', 'hyp...
raphischer/probgf
scripts/gap_filling_viewer.py
01bd2be85aa98afd79fc05c1eb3e260b2bcd2ebd
"""viewer application which allows to interactively view spatio-temporal gap filling results""" import os import argparse from datetime import datetime, timedelta from tkinter import Canvas, Tk, Button, RAISED, DISABLED, SUNKEN, NORMAL import numpy as np from PIL import Image, ImageTk import probgf.media as media cla...
[((10181, 10225), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (10204, 10225), False, 'import argparse\n'), ((12304, 12308), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (12306, 12308), False, 'from tkinter import Canvas, Tk, Button, RAISED, DISABLED, SUNKE...
pdfcrowd/django-paypal
paypal/pro/tests.py
0ea56dc6c799204f0f8719481f94d0c79de6eff5
#!/usr/bin/python # -*- coding: utf-8 -*- from django.conf import settings from django.core.handlers.wsgi import WSGIRequest from django.forms import ValidationError from django.http import QueryDict from django.test import TestCase from django.test.client import Client from paypal.pro.fields import CreditCardField fr...
[((879, 899), 'django.core.handlers.wsgi.WSGIRequest', 'WSGIRequest', (['environ'], {}), '(environ)\n', (890, 899), False, 'from django.core.handlers.wsgi import WSGIRequest\n'), ((1552, 1569), 'paypal.pro.fields.CreditCardField', 'CreditCardField', ([], {}), '()\n', (1567, 1569), False, 'from paypal.pro.fields import ...
madhurgupta96/Algorithmic-Journey
Hackerrank_Bot_Saves_Princess.py
75868af1050c99fc25e295812ba1a47468c6737f
# -*- coding: utf-8 -*- """ Created on Mon Dec 7 19:46:40 2020 @author: Intel """ def displayPathtoPrincess(n,grid): me_i=n//2 me_j=n//2 for i in range(n): if 'p' in grid[i]: pe_i=i for j in range(n): if 'p'==grid[i][j]: pe...
[]
HiDiHlabs/gelviz
gelviz/basic.py
515f0462738b44609679c2a26c7d8ac3ed3b4b2b
import matplotlib.pyplot as plt import pybedtools import pandas as pnd import numpy as np import tabix import matplotlib.ticker as ticker from matplotlib.patches import Rectangle from matplotlib.patches import Arrow from matplotlib.path import Path from matplotlib.patches import PathPatch import matplotlib.cm as cm imp...
[((28555, 28569), 'matplotlib.pyplot.ylim', 'plt.ylim', (['(0)', '(1)'], {}), '(0, 1)\n', (28563, 28569), True, 'import matplotlib.pyplot as plt\n'), ((28574, 28592), 'matplotlib.pyplot.yticks', 'plt.yticks', (['[]', '[]'], {}), '([], [])\n', (28584, 28592), True, 'import matplotlib.pyplot as plt\n'), ((33629, 33652), ...
djrochford/toc
toc/fsa/fsa.py
934d19b4acda55a6d4610c8a91b1a6005ff7b683
""" File containing DFA and NFA public classes """ import collections.abc from itertools import product, chain, combinations from string import printable from typing import ( AbstractSet, Container, FrozenSet, Iterable, List, Mapping, MutableMapping, Optional, Set, Tuple, Uni...
[((14811, 14846), 'itertools.product', 'product', (['state_sets', 'self._alphabet'], {}), '(state_sets, self._alphabet)\n', (14818, 14846), False, 'from itertools import product, chain, combinations\n'), ((26336, 26370), 'itertools.product', 'product', (['self_states', 'other_states'], {}), '(self_states, other_states)...
fossabot/IdeaBag2-Solutions
Numbers/Roman Number Generator/tests.py
73b554d9796510fc86e5fc55016732aa866266c6
#!/usr/bin/env python3 import unittest from roman_number_generator import arabic_to_roman class Test(unittest.TestCase): def _start_arabic_to_roman(self): self.assertRaises(ValueError, arabic_to_roman, 4000) self.assertEqual(arabic_to_roman(4), "IV") self.assertEqual(arabic_to_roman(12),...
[((413, 428), 'unittest.main', 'unittest.main', ([], {}), '()\n', (426, 428), False, 'import unittest\n'), ((249, 267), 'roman_number_generator.arabic_to_roman', 'arabic_to_roman', (['(4)'], {}), '(4)\n', (264, 267), False, 'from roman_number_generator import arabic_to_roman\n'), ((300, 319), 'roman_number_generator.ar...
saintaardvark/glouton-satnogs-data-downloader
modules/moduleBase.py
dc8671340f558b1a21b41b9b04bab05fc15c7809
from infrastructure.satnogClient import SatnogClient import os class ModuleBase: def __init__(self, working_dir): self.working_dir = working_dir def runAfterDownload(self, file_name, full_path, observation): raise NotImplementedError()
[]
MrNaif2018/Oregano
oregano_plugins/fusion/server.py
cc08f813f9cbdb80d1ac607892f8439ec064ee04
#!/usr/bin/env python3 # # Oregano - a lightweight Ergon client # CashFusion - an advanced coin anonymizer # # Copyright (C) 2020 Mark B. Lundeberg # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the So...
[((4927, 4942), 'random.Random', 'random.Random', ([], {}), '()\n', (4940, 4942), False, 'import random\n'), ((4952, 4975), 'secrets.token_bytes', 'secrets.token_bytes', (['(32)'], {}), '(32)\n', (4971, 4975), False, 'import secrets\n'), ((6656, 6678), 'collections.defaultdict', 'defaultdict', (['TagStatus'], {}), '(Ta...
jtorrenth/CienciaDades
Excercici4Package/ex4.py
81f005ed1ddcc218dcde8c5e2f1a297444389a82
import matplotlib.pyplot as plt def countvalues(dataframe, subject): # Filtrem i tractem el dataset economydf = filtrar(dataframe, "economy") # el printem printar(economydf, subject) # Filtrem ara per subject infected i ho desem en un altre df infectedf = filtrar(dataframe, "infected") #...
[((1885, 1906), 'matplotlib.pyplot.bar', 'plt.bar', (['eje_x', 'eje_y'], {}), '(eje_x, eje_y)\n', (1892, 1906), True, 'import matplotlib.pyplot as plt\n'), ((1938, 1958), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['leyenday'], {}), '(leyenday)\n', (1948, 1958), True, 'import matplotlib.pyplot as plt\n'), ((1990, 2010)...
filmil/bazel-ebook
build/rules.bzl
433f1e157c6c1b7867abf72bc0e882c07477d60d
# Copyright (C) 2020 Google Inc. # # This file has been licensed under Apache 2.0 license. Please see the LICENSE # file at the root of the repository. # Build rules for building ebooks. # This is the container CONTAINER = "filipfilmar/ebook-buildenv:1.1" # Use this for quick local runs. #CONTAINER = "ebook-builden...
[]
castrolimoeiro/Uri-exercise
1094 EXPERIENCIAS.py
7a9227c55a79f14fe8bde4aa0ebb4c268bbda4bb
n = int(input()) coelho = rato = sapo = contador = 0 for i in range(0, n): q, t = input().split(' ') t = t.upper() q = int(q) if 1 <= q <= 15: contador += q if t == 'C': coelho += q elif t == 'R': rato += q elif t == 'S': sapo += q po...
[]
F483/gravur
gravur/common/amountinput.py
575c268d9ac28aa0ba00f1e5109bd74c3b7b69a5
# coding: utf-8 # Copyright (c) 2015 Fabian Barkhau <fabian.barkhau@gmail.com> # License: MIT (see LICENSE file) from kivy.uix.boxlayout import BoxLayout from gravur.common.labelbox import LabelBox # NOQA from gravur.utils import load_widget @load_widget class AmountInput(BoxLayout): pass
[]
4dn-dcic/tibanna
tibanna/top.py
bb84597c425a481a230be30cb0ed9b99c774e53d
import datetime class Top(object): """class TopSeries stores the information of a series of top commands :: echo -n 'Timestamp: '; date +%F-%H:%M:%S top -b -n1 [-i] [-c] over short intervals to monitor the same set of processes over time. An example input content looks like below, ...
[((15937, 15996), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['timestamp', 'cls.timestamp_format'], {}), '(timestamp, cls.timestamp_format)\n', (15963, 15996), False, 'import datetime\n')]
ajayiagbebaku/NFL-Model
venv/Lib/site-packages/zmq/tests/test_draft.py
afcc67a85ca7138c58c3334d45988ada2da158ed
# -*- coding: utf8 -*- # Copyright (C) PyZMQ Developers # Distributed under the terms of the Modified BSD License. import os import platform import time import pytest import zmq from zmq.tests import BaseZMQTestCase, skip_pypy class TestDraftSockets(BaseZMQTestCase): def setUp(self): if not zmq.DRAFT_AP...
[((341, 377), 'pytest.skip', 'pytest.skip', (['"""draft api unavailable"""'], {}), "('draft api unavailable')\n", (352, 377), False, 'import pytest\n'), ((1258, 1273), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (1268, 1273), False, 'import time\n')]
he0119/smart-home
home/push/mipush/APIError.py
bdd3a59a8c46c0fdc07ac3049bf589c7f95a2683
class APIError(Exception): """ raise APIError if receiving json message indicating failure. """ def __init__(self, error_code, error, request): self.error_code = error_code self.error = error self.request = request Exception.__init__(self, error) def __str__(self): ...
[]
adoggie/Tibet.6
pythonlibs/mantis/templates/webapp/src/webapp/base.py
3c53060edafd80b9c4dafa10699a68d86a410c66
#coding:utf-8 class SystemDeviceType(object): InnerBox = 1 # 主屏分离的室内主机 InnerScreen = 2 # 主屏分离的室内屏 OuterBox = 3 # 室外机 PropCallApp = 4 # 物业值守 PropSentryApp = 5 # 物业岗亭机 Others = 10 ValidatedList = (1,2,3,4,5) class Constants(object): SUPER_ACCESS_TOKEN = 'YTU3NzV...
[]
edisonlz/fastor
base/site-packages/django_qbe/urls.py
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
# -*- coding: utf-8 -*- from django.conf.urls.defaults import patterns, url from django_qbe.exports import formats urlpatterns = patterns('django_qbe.views', url(r'^$', 'qbe_form', name="qbe_form"), url(r'^js/$', 'qbe_js', name="qbe_js"), url(r'^results/bookmark/$', 'qbe_bookmark', name="qbe_bookma...
[((163, 201), 'django.conf.urls.defaults.url', 'url', (['"""^$"""', '"""qbe_form"""'], {'name': '"""qbe_form"""'}), "('^$', 'qbe_form', name='qbe_form')\n", (166, 201), False, 'from django.conf.urls.defaults import patterns, url\n'), ((208, 245), 'django.conf.urls.defaults.url', 'url', (['"""^js/$"""', '"""qbe_js"""'],...
docongminh/Text-Image-Augmentation-python
augment.py
da27e8346ce2339f801335923faf7b14e026fd90
# -*- coding:utf-8 -*- # Author: RubanSeven # import cv2 import numpy as np # from transform import get_perspective_transform, warp_perspective from warp_mls import WarpMLS def distort(src, segment): img_h, img_w = src.shape[:2] cut = img_w // segment thresh = cut // 3 # thresh = img_h...
[((934, 958), 'numpy.arange', 'np.arange', (['(1)', 'segment', '(1)'], {}), '(1, segment, 1)\n', (943, 958), True, 'import numpy as np\n'), ((1373, 1417), 'warp_mls.WarpMLS', 'WarpMLS', (['src', 'src_pts', 'dst_pts', 'img_w', 'img_h'], {}), '(src, src_pts, dst_pts, img_w, img_h)\n', (1380, 1417), False, 'from warp_mls ...
ikaushikpal/DS-450-python
Graph/print all paths from two vertices in a directed graph.py
9466f77fb9db9e6a5bb3f20aa89ba6332f49e848
from collections import defaultdict class Graph: def __init__(self): self.graph = defaultdict(list) def addEdge(self, starting_vertex, end_vertex): self.graph[starting_vertex].append(end_vertex) def printAllPaths(self, starting_vertex, target_vertex): visitedVertices = defaultdic...
[((96, 113), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (107, 113), False, 'from collections import defaultdict\n'), ((310, 327), 'collections.defaultdict', 'defaultdict', (['bool'], {}), '(bool)\n', (321, 327), False, 'from collections import defaultdict\n')]
kamyarrasta/berrl
tests/pipegeojson_test/test_pipegeojson.py
1cf2ba8194498ec8f80d2908399ad00f1e963d83
# testing the output of pipegeojson against different input types import berrl as bl import itertools # making line with csv file location line1=bl.make_line('csvs/line_example.csv') # making line with list testlist=bl.read('csvs/line_example.csv') line2=bl.make_line(testlist,list=True) # testing each line geojson ...
[]
mgh17/tierpsy-tracker
tierpsy/debugging/catch_infinite_loop.py
a18c06aa80a5fb22fd51563d82c639b520742777
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 8 16:19:07 2017 @author: ajaver """ import os import cv2 import sys import glob import threading from functools import partial main_dir = '/Volumes/behavgenom_archive$/Celine/raw/' fnames = glob.glob(os.path.join(main_dir, '**', '*.avi')) fnames =...
[((273, 310), 'os.path.join', 'os.path.join', (['main_dir', '"""**"""', '"""*.avi"""'], {}), "(main_dir, '**', '*.avi')\n", (285, 310), False, 'import os\n'), ((532, 560), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video_file'], {}), '(video_file)\n', (548, 560), False, 'import cv2\n'), ((725, 753), 'cv2.VideoCapture',...
guaacoelho/devito
devito/passes/iet/languages/C.py
7e0b873114675752c4a49ed9076ee5d52997833c
from devito.ir import Call from devito.passes.iet.definitions import DataManager from devito.passes.iet.langbase import LangBB __all__ = ['CBB', 'CDataManager'] class CBB(LangBB): mapper = { 'aligned': lambda i: '__attribute__((aligned(%d)))' % i, 'host-alloc': lambda i, j, k: ...
[((326, 359), 'devito.ir.Call', 'Call', (['"""posix_memalign"""', '(i, j, k)'], {}), "('posix_memalign', (i, j, k))\n", (330, 359), False, 'from devito.ir import Call\n'), ((404, 422), 'devito.ir.Call', 'Call', (['"""free"""', '(i,)'], {}), "('free', (i,))\n", (408, 422), False, 'from devito.ir import Call\n')]
Freakwill/ell
tests/_test_image.py
8aa510cefb5d63db35071820208971013fac154c
#!/usr/bin/env python3 """Test methods about image process Make sure the existance of the images """ from ell import * import numpy as np _filter = Filter.from_name('db4') def test_resize(): chennal=0 c = ImageRGB.open('src/lenna.jpg') d=c.resize(minInd=(-100,-100), maxInd=(100,100)) d.to_image() ...
[]
adricl/donkeycar
donkeycar/parts/pytorch/torch_data.py
8eb2705ed4161c0d6a9cfd9c7b0a1c0ca5abaeef
# PyTorch import torch from torch.utils.data import IterableDataset, DataLoader from donkeycar.utils import train_test_split from donkeycar.parts.tub_v2 import Tub from torchvision import transforms from typing import List, Any from donkeycar.pipeline.types import TubRecord, TubDataset from donkeycar.pipeline.sequence ...
[((1394, 1429), 'torchvision.transforms.Compose', 'transforms.Compose', (['transform_items'], {}), '(transform_items)\n', (1412, 1429), False, 'from torchvision import transforms\n'), ((1223, 1244), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ([], {}), '()\n', (1242, 1244), False, 'from torchvision import...
CleverInsight/sparx-lite
lite/__init__.py
1b729e8d11292e9737d57e092ee8916999ab1338
import os from tornado.template import Template __SNIPPET__ = os.path.join(os.path.dirname(os.path.abspath(__file__)), '_snippet') def T(name, **kw): t = Template(open(os.path.join(__SNIPPET__, name + '.html'), 'rb').read()) return t.generate(**dict([('template_file', name)] + globals().items() + kw.items()))
[((92, 117), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (107, 117), False, 'import os\n'), ((172, 213), 'os.path.join', 'os.path.join', (['__SNIPPET__', "(name + '.html')"], {}), "(__SNIPPET__, name + '.html')\n", (184, 213), False, 'import os\n')]
mdonoughe/home-assistant
homeassistant/components/sensor/hddtemp.py
d9805160bc787146bff0c434fdcab995716f0f8c
""" Support for getting the disk temperature of a host. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.hddtemp/ """ import logging from datetime import timedelta from telnetlib import Telnet import voluptuous as vol import homeassistant.helpers....
[((577, 604), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (594, 604), False, 'import logging\n'), ((767, 787), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(1)'}), '(minutes=1)\n', (776, 787), False, 'from datetime import timedelta\n'), ((836, 872), 'voluptuous.Optional', 'vol....
JohnnySn0w/BabbleBot
boomer.py
03a383b063e4f28049f27f8ec669f22767ed8a87
import random prefix = [ 'Look at you! ', 'Bless ', 'Bless! ', 'I heard about that! ', 'Amen!', 'You and the kids doing alright?', 'Miss ya\'ll!' ] suffix = [ '. Amen!', '. God bless america', '. God bless!', ' haha', '. love ya!', '. love ya\'ll!', ] def add_pre_suf(sentence): if random.randint(1,10) <= 6: ...
[((761, 782), 'random.randint', 'random.randint', (['(1)', '(10)'], {}), '(1, 10)\n', (775, 782), False, 'import random\n'), ((289, 310), 'random.randint', 'random.randint', (['(1)', '(10)'], {}), '(1, 10)\n', (303, 310), False, 'import random\n'), ((327, 348), 'random.randint', 'random.randint', (['(1)', '(10)'], {}),...
eyobofficial/COVID-19-Mutual-Aid
bot/views.py
42d30ce95b0e9c717c5eda3ecaafea2812ec34f7
import telegram from django.conf import settings from django.shortcuts import redirect from django.utils.decorators import method_decorator from django.views.generic import View from django.views.decorators.csrf import csrf_exempt from braces.views import CsrfExemptMixin from rest_framework.authentication import Bas...
[((580, 626), 'django.utils.decorators.method_decorator', 'method_decorator', (['csrf_exempt'], {'name': '"""dispatch"""'}), "(csrf_exempt, name='dispatch')\n", (596, 626), False, 'from django.utils.decorators import method_decorator\n'), ((1264, 1299), 'rest_framework.response.Response', 'Response', ([], {'status': 's...
dummyxyz1/re_counterfactual_generative
code/counterfactual_generative_networks-main/imagenet/train_cgn.py
4dda8e17a1123a564d60be82c17e9589155fb2e2
import os from datetime import datetime from os.path import join import pathlib from tqdm import tqdm import argparse import torch from torch import nn, optim from torch.autograd import Variable import torchvision from torchvision.transforms import Pad from torchvision.utils import make_grid import repackage repackage...
[((311, 325), 'repackage.up', 'repackage.up', ([], {}), '()\n', (323, 325), False, 'import repackage\n'), ((1569, 1619), 'os.path.join', 'join', (['sample_path', "(f'cls_sheet_' + ep_str + '.png')"], {}), "(sample_path, f'cls_sheet_' + ep_str + '.png')\n", (1573, 1619), False, 'from os.path import join\n'), ((3970, 401...
ramza007/Ramza.io
portfolio/urls.py
2172d9ac13e87becbc8644ad5755070f48fab8da
from django.conf.urls import url from django.urls import path, include,re_path from . import views from rest_framework.authtoken.views import obtain_auth_token urlpatterns = [ path('', views.index, name='index'), path('about', views.about, name='about'), path('projects', views.projects, name='projects'),...
[((183, 218), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (187, 218), False, 'from django.urls import path, include, re_path\n'), ((224, 264), 'django.urls.path', 'path', (['"""about"""', 'views.about'], {'name': '"""about"""'}), "('about', view...
iPieter/kiwi
tests/resources/mlflow-test-plugin/mlflow_test_plugin/file_store.py
76b66872fce68873809a0dea112e2ed552ae5b63
from six.moves import urllib from kiwi.store.tracking.file_store import FileStore class PluginFileStore(FileStore): """FileStore provided through entrypoints system""" def __init__(self, store_uri=None, artifact_uri=None): path = urllib.parse.urlparse(store_uri).path if store_uri else None s...
[((250, 282), 'six.moves.urllib.parse.urlparse', 'urllib.parse.urlparse', (['store_uri'], {}), '(store_uri)\n', (271, 282), False, 'from six.moves import urllib\n')]
YuhangCh/terracotta
tests/server/test_flask_api.py
867ba5f7425fa88881f4c161d81cc7311f4f9c4e
from io import BytesIO import json import urllib.parse from collections import OrderedDict from PIL import Image import numpy as np import pytest @pytest.fixture(scope='module') def flask_app(): from terracotta.server import create_app return create_app() @pytest.fixture(scope='module') def client(flask_a...
[((151, 181), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (165, 181), False, 'import pytest\n'), ((271, 301), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (285, 301), False, 'import pytest\n'), ((255, 267), 'terracotta.server.c...
matthieucan/shorturl
url.py
a7f7fab61e8b23b352590797ca4959ed166c865e
def base_conv(n, input_base=10, output_base=10): """ Converts a number n from base input_base to base output_base. The following symbols are used to represent numbers: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ n can be an int if input_base <= 10, and a string otherwise. ...
[]
codecrap/qtt
src/qtt/qiskit/passes.py
39a8bf21f7bcab94940a66f4d553a14bf34f82b0
import logging from typing import Dict, List, Optional import numpy as np import qiskit from qiskit.circuit import Barrier, Delay, Reset from qiskit.circuit.library import (CRXGate, CRYGate, CRZGate, CZGate, PhaseGate, RXGate, RYGate, RZGate, U1Gate, ...
[((785, 812), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (802, 812), False, 'import logging\n'), ((5004, 5021), 'qiskit.circuit.quantumcircuit.QuantumCircuit', 'QuantumCircuit', (['(1)'], {}), '(1)\n', (5018, 5021), False, 'from qiskit.circuit.quantumcircuit import QuantumCircuit\n'),...
JonathanAlis/IAFNNESTA
IAFNNESTA.py
6845bed7e41a162a60e65d709f37cf975c8c8a4e
def help(): return ''' Isotropic-Anisotropic Filtering Norm Nesterov Algorithm Solves the filtering norm minimization + quadratic term problem Nesterov algorithm, with continuation: argmin_x || iaFN(x) ||_1/2 subjected to ||b - Ax||_2^2 < delta If no filter is provided, solves the L1. Continuation is perf...
[((4800, 4835), 'numpy.power', 'np.power', (['(muf / mu0)', '(1 / MaxIntIter)'], {}), '(muf / mu0, 1 / MaxIntIter)\n', (4808, 4835), True, 'import numpy as np\n'), ((4856, 4894), 'numpy.power', 'np.power', (['(TolVar / 0.1)', '(1 / MaxIntIter)'], {}), '(TolVar / 0.1, 1 / MaxIntIter)\n', (4864, 4894), True, 'import nump...
pfw/hypatia
hypatia/util/__init__.py
407cd62e4817c85188aa6abdf204c5aaff5ab570
import itertools import BTrees from persistent import Persistent from ZODB.broken import Broken from zope.interface import implementer _marker = object() from .. import exc from ..interfaces import ( IResultSet, STABLE, ) @implementer(IResultSet) class ResultSet(object): """Implements :class:`hypatia.i...
[((236, 259), 'zope.interface.implementer', 'implementer', (['IResultSet'], {}), '(IResultSet)\n', (247, 259), False, 'from zope.interface import implementer\n'), ((1846, 1878), 'itertools.chain', 'itertools.chain', (['[id_]', 'self.ids'], {}), '([id_], self.ids)\n', (1861, 1878), False, 'import itertools\n'), ((2225, ...
relaxxpls/Music-Control
backend/listings/migrations/0001_initial.py
76f5d10904f820607b3eb756850d5c5d7d89d875
# Generated by Django 3.2.3 on 2021-05-30 04:28 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ('realtors', '0001_initial'), ] operations = [ migrations.Cr...
[((403, 499), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (422, 499), False, 'from django.db import migrations, m...
LeConstellationniste/DiscordFramework
examples/example_without_CommandSet/my_listeners.py
24d4b9b7cb0a21d3cec9d5362ab0828c5e15a3af
import asyncio import discord # Just with a function to add to the bot. async def on_message(message): if not message.author.bot: await message.channel.send(f"{message.author.mention} a envoyé un message!") # A Listener already created with the function from discordEasy.objects import Listener async def on_messa...
[((463, 483), 'discordEasy.objects.Listener', 'Listener', (['on_message'], {}), '(on_message)\n', (471, 483), False, 'from discordEasy.objects import Listener\n')]
robgon-art/pianonet
pianonet/serving/app.py
8d8a827bc8d310b8ce3f66259bbdf72648e9ca32
import os import random from flask import Flask, request, send_from_directory from werkzeug.utils import secure_filename from pianonet.core.pianoroll import Pianoroll from pianonet.model_inspection.performance_from_pianoroll import get_performance_from_pianoroll app = Flask(__name__) base_path = "/app/" # base_pat...
[((272, 287), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (277, 287), False, 'from flask import Flask, request, send_from_directory\n'), ((387, 434), 'os.path.join', 'os.path.join', (['base_path', '"""data"""', '"""performances"""'], {}), "(base_path, 'data', 'performances')\n", (399, 434), False, 'impo...
rafalbigaj/epidemic-model-visualization
app.py
35829180b5a53697b336e8615d854a21b3395f59
import dash import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html import plotly.graph_objects as go from plotly.subplots import make_subplots import logging import json import os import pandas as pd from datetime import datetime from datetime import timedelta fro...
[((369, 396), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (386, 396), False, 'import logging\n'), ((552, 606), 'os.environ.get', 'os.environ.get', (['"""CF_INSTANCE_INTERNAL_IP"""', '"""127.0.0.1"""'], {}), "('CF_INSTANCE_INTERNAL_IP', '127.0.0.1')\n", (566, 606), False, 'import os\n')...
paulyhedral/sweetrpg-library-api
src/sweetrpg_library_api/application/blueprints/systems/manager.py
0105e963ef4321398aa66d7cb3aa9c2df1c4f375
# -*- coding: utf-8 -*- __author__ = "Paul Schifferer <dm@sweetrpg.com>" """ """ from flask_rest_jsonapi import ResourceList, ResourceDetail, ResourceRelationship from sweetrpg_library_objects.api.system.schema import SystemAPISchema from sweetrpg_api_core.data import APIData from sweetrpg_library_objects.model.syste...
[]
deepio-oc/pabot
tests/test_ordering.py
ebf1894c6d35b2ddd5c4bca01bceb25189358106
from robot import __version__ as ROBOT_VERSION import sys import tempfile import textwrap import unittest import shutil import subprocess class PabotOrderingGroupTest(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp() def tearDown(self): shutil.rmtree(self.tmpdir) def ...
[((232, 250), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (248, 250), False, 'import tempfile\n'), ((284, 310), 'shutil.rmtree', 'shutil.rmtree', (['self.tmpdir'], {}), '(self.tmpdir)\n', (297, 310), False, 'import shutil\n'), ((457, 482), 'textwrap.dedent', 'textwrap.dedent', (['testfile'], {}), '(testfi...
Commonists/pageview-api
setup.py
39e8b3c3c82f64a500e3dd4f306451c81c7e31b7
#!/usr/bin/python # -*- coding: latin-1 -*- """Setup script.""" try: from setuptools import setup except ImportError: from distutils.core import setup try: import pageviewapi version = pageviewapi.__version__ except ImportError: version = 'Undefined' classifiers = [ 'Development Status :: 4...
[]
juby-gif/assignment1
task1b.py
3d39478fdc371e80a546caac545561145afbb080
#a2_t1b.py #This program is to convert Celsius to Kelvin def c_to_k(c): k = c + 273.15 #Formula to convert Celsius to Kelvin return k def f_to_c(f): fa = (f-32) * 5/9 #Formula to convert Fareheit to Celsius return fa c = 25.0 f = 100.0 k = c_to_k(c) fa = f_to_c(f) print("Celsius of " + str(c) + " is...
[]
jajodiaraghav/TWLight
TWLight/emails/views.py
22359ab0b95ee3653e8ffa0eb698acd7bb8ebf70
from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from django.core.urlresolvers import reverse, reverse_lazy from django.core.mail import BadHeaderError, send_mail from django.http import HttpResponse, HttpResponseRedirect f...
[((570, 615), 'django.utils.decorators.method_decorator', 'method_decorator', (['login_required'], {'name': '"""post"""'}), "(login_required, name='post')\n", (586, 615), False, 'from django.utils.decorators import method_decorator\n'), ((738, 761), 'django.core.urlresolvers.reverse_lazy', 'reverse_lazy', (['"""contact...
lcbm/cs-data-ingestion
frontend/config.py
314525285bfefe726d86c232937b05d273e44e7f
"""Flask App configuration file.""" import logging import os import dotenv import frontend.constants as constants dotenv.load_dotenv(os.path.join(constants.BASEDIR, "frontend.env")) class Base: """Configuration class used as base for all environments.""" DEBUG = False TESTING = False LOGGING_FO...
[((138, 185), 'os.path.join', 'os.path.join', (['constants.BASEDIR', '"""frontend.env"""'], {}), "(constants.BASEDIR, 'frontend.env')\n", (150, 185), False, 'import os\n'), ((430, 476), 'os.environ.get', 'os.environ.get', (['"""LOGGING_LEVEL"""', 'logging.DEBUG'], {}), "('LOGGING_LEVEL', logging.DEBUG)\n", (444, 476), ...
goodreferences/ElasticQuery
tests/test_dsl.py
579e387c5a7c1cbbeab999050c0d2faa80ded821
# ElasticQuery # File: tests/test_dsl.py # Desc: tests for ElasticQuery DSL objects (Filter, Query, Aggregate) from os import path from unittest import TestCase from jsontest import JsonTest from elasticquery import Query, Aggregate, Suggester from elasticquery.exceptions import ( NoQueryError, NoAggregateError,...
[((1230, 1259), 'os.path.join', 'path.join', (['"""tests"""', '"""queries"""'], {}), "('tests', 'queries')\n", (1239, 1259), False, 'from os import path\n'), ((1467, 1499), 'os.path.join', 'path.join', (['"""tests"""', '"""aggregates"""'], {}), "('tests', 'aggregates')\n", (1476, 1499), False, 'from os import path\n'),...
xianjian-xie/pose-generation
models/SelectionGAN/person_transfer/tool/rm_insnorm_running_vars.py
ad0495e80c6fe1e7690fa8691f1eb11b4e9bca32
import torch ckp_path = './checkpoints/fashion_PATN/latest_net_netG.pth' save_path = './checkpoints/fashion_PATN_v1.0/latest_net_netG.pth' states_dict = torch.load(ckp_path) states_dict_new = states_dict.copy() for key in states_dict.keys(): if "running_var" in key or "running_mean" in key: del states_dict_new[key]...
[((154, 174), 'torch.load', 'torch.load', (['ckp_path'], {}), '(ckp_path)\n', (164, 174), False, 'import torch\n'), ((322, 360), 'torch.save', 'torch.save', (['states_dict_new', 'save_path'], {}), '(states_dict_new, save_path)\n', (332, 360), False, 'import torch\n')]
amazon-picking-challenge/team_pfn
script/dummy/arm_control.py
2f76524b067d816d8407f6c4fae4e6d33939c024
#!/usr/bin/python # Copyright 2016 Preferred Networks, 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 applicab...
[]
rompdodger/RompDodger
cogs/events.py
9c8b481d9f69e05c15f01271f6c18e09ab2723e6
import json import discord from utils.time import format_time from utils import utilities from discord.ext import commands from discord import Embed class Events(commands.Cog): """Event Handler for RompDodger""" def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_command_error(self,...
[((263, 286), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (284, 286), False, 'from discord.ext import commands\n'), ((1058, 1081), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (1079, 1081), False, 'from discord.ext import commands\n'), ((1245, 1268)...
LaudateCorpus1/RosettaCodeData
Task/Parallel-calculations/Python/parallel-calculations-2.py
9ad63ea473a958506c041077f1d810c0c7c8c18d
import multiprocessing # ========== #Python3 - concurrent from math import floor, sqrt numbers = [ 112272537195293, 112582718962171, 112272537095293, 115280098190773, 115797840077099, 1099726829285419] # numbers = [33, 44, 55, 275] def lowest_factor(n, _start=3): if n % 2 == 0: re...
[((749, 782), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {'processes': '(5)'}), '(processes=5)\n', (769, 782), False, 'import multiprocessing\n'), ((354, 361), 'math.sqrt', 'sqrt', (['n'], {}), '(n)\n', (358, 361), False, 'from math import floor, sqrt\n')]
clin366/airpollutionnowcast
setup.py
f9152583eebc4ad747c8d0510460334a5fb23ff9
from setuptools import find_packages, setup setup( name='src', packages=find_packages(), version='0.1.0', description='Project: Nowcasting the air pollution using online search log', author='Emory University(IR Lab)', license='MIT', )
[((81, 96), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (94, 96), False, 'from setuptools import find_packages, setup\n')]
ahrarmonsur/euler
problems/p0048/s48.py
4174790637806521a4ea2973abeb76c96c64a782
""" Project Euler Problem 48 Self powers Solved by Ahrar Monsur The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317. Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. """ def main(): max_digits = 1000 sum = 0 for i in range(1, max_digits+1): sum += i**i print str(...
[]
Rainstyd/rainsty
BigData/sparkTask/test.py
9a0d5f46c20faf909c4194f315fb9960652cffc6
#!/usr/bin/python # -*- coding: utf-8 -*- """ @author: rainsty @file: test.py @time: 2020-01-04 18:36:57 @description: """ import os from pyspark.sql import SparkSession os.environ['JAVA_HOME'] = '/root/jdk' os.environ['SPARK_HOME'] = '/root/spark' os.environ['PYTHON_HOME'] = "/root/python" os.environ['PYSPARK_P...
[((430, 478), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', (['"""TestSparkSession"""'], {}), "('TestSparkSession')\n", (458, 478), False, 'from pyspark.sql import SparkSession\n')]
gdv/python-alfabetizzazione
esercizi/areaSottesaCompareNumPy.py
d87561222de8a230db11d8529c49cf1702aec326
import numpy as np import timeit def effe(x): y = -x * (x - 1.0) return y numIntervalli = input('inserire il numero di intervalli in [0.0, 1.0] ') deltaIntervallo = 1.0 / float(numIntervalli) print "larghezza intervallo", deltaIntervallo start = timeit.default_timer() xIntervalli = [] yIntervalli = [] i =...
[]
expobrain/json-schema-codegen
json_codegen/generators/python3_marshmallow/object_generator.py
e22b386333c6230e5d6f5984fd947fdd7b947e82
import ast from json_codegen.generators.python3_marshmallow.utils import Annotations, class_name class ObjectGenerator(object): @staticmethod def _get_property_name(node_assign): name = node_assign.targets[0] return name.id @staticmethod def _nesting_class(node_assign): for n...
[((327, 348), 'ast.walk', 'ast.walk', (['node_assign'], {}), '(node_assign)\n', (335, 348), False, 'import ast\n'), ((2112, 2133), 'ast.walk', 'ast.walk', (['node_assign'], {}), '(node_assign)\n', (2120, 2133), False, 'import ast\n'), ((2511, 2532), 'ast.walk', 'ast.walk', (['node_assign'], {}), '(node_assign)\n', (251...
xylar/cdat
testing/regrid/testEsmfGridToMeshRegridCsrv.py
8a5080cb18febfde365efc96147e25f51494a2bf
#!/usr/bin/env python # # $Id: ESMP_GridToMeshRegridCsrv.py,v 1.5 2012/04/23 23:00:14 rokuingh Exp $ #=============================================================================== # ESMP/examples/ESMP_GridToMeshRegrid.py #=============================================================================== """...
[]
ariffyasri/lale
test/mock_module.py
326012c3c3dd884fae0093fe0c45596e4f9c0d72
# Copyright 2019 IBM Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[]
lukaschoebel/POTUSgen
scripts/beautify.py
7b88ba63f0ddab199937df909c5af3271a833cf3
import json import re import sys def beautify(name): ''' Loading, filtering and saving the JSON tweet file to a newly generated .txt file :type: name: String :rtype: output: .txt ''' filename = name + '.json' output_name = name + "_filtered.txt" with open(filename, "r", encoding="utf-8")...
[((1937, 1964), 're.sub', 're.sub', (['"""http[\\\\S]*"""', '""""""', 's'], {}), "('http[\\\\S]*', '', s)\n", (1943, 1964), False, 'import re\n'), ((2044, 2073), 're.sub', 're.sub', (['"""\\\\\\\\u2026"""', '"""..."""', 's'], {}), "('\\\\\\\\u2026', '...', s)\n", (2050, 2073), False, 'import re\n'), ((2081, 2099), 're....
G-Naughty/Fine-grained-OBB-Detection
result2gaofentype/pkl2txt_ggm.py
8c82c4c178f0b6bba077ff9d906a81bf8e04789c
import BboxToolkit as bt import pickle import copy import numpy as np path1="/home/hnu1/GGM/OBBDetection/work_dir/oriented_obb_contrast_catbalance/dets.pkl" path2="/home/hnu1/GGM/OBBDetection/data/FaIR1M/test/annfiles/ori_annfile.pkl"# with open(path2,'rb') as f: #/home/disk/FAIR1M_1000_split/val/annfiles/ori_...
[((344, 358), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (355, 358), False, 'import pickle\n'), ((402, 416), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (413, 416), False, 'import pickle\n'), ((430, 452), 'copy.deepcopy', 'copy.deepcopy', (['obbdets'], {}), '(obbdets)\n', (443, 452), False, 'import cop...
HarperCallahan/taichi_ferrofluid
initializer_3d.py
6113f6c7d9d9d612b6dadc500cf91b576c2d05ea
import taichi as ti import utils from apic_extension import * @ti.data_oriented class Initializer3D: # tmp initializer def __init__(self, res, x0, y0, z0, x1, y1, z1): self.res = res self.x0 = int(res * x0) self.y0 = int(res * y0) self.z0 = int(res * z0) self.x1 = int(res * ...
[((443, 456), 'taichi.template', 'ti.template', ([], {}), '()\n', (454, 456), True, 'import taichi as ti\n')]
MilesCranmer/bifrost_paper
copy_block_example.py
654408cd7e34e7845cee58100fe459e1422e4859
from copy import deepcopy import bifrost as bf from bifrost.pipeline import TransformBlock from bifrost.ndarray import copy_array class CopyBlock(TransformBlock):# $\tikzmark{block-start}$ """Copy the input ring to output ring""" def __init__(self, iring, space): ...
[((666, 683), 'bifrost.BlockChainer', 'bf.BlockChainer', ([], {}), '()\n', (681, 683), True, 'import bifrost as bf\n'), ((1135, 1160), 'bifrost.get_default_pipeline', 'bf.get_default_pipeline', ([], {}), '()\n', (1158, 1160), True, 'import bifrost as bf\n'), ((467, 488), 'copy.deepcopy', 'deepcopy', (['iseq.header'], {...
zhangjianweibj/monasca-persister
monasca_persister/conf/influxdb.py
0c5d8a7c5553001f2d38227347f482201f92c8e1
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP # Copyright 2017 FUJITSU 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 License at # # http://www.apache.org/licenses/LICENSE...
[((1281, 1328), 'oslo_config.cfg.OptGroup', 'cfg.OptGroup', ([], {'name': '"""influxdb"""', 'title': '"""influxdb"""'}), "(name='influxdb', title='influxdb')\n", (1293, 1328), False, 'from oslo_config import cfg\n'), ((697, 790), 'oslo_config.cfg.StrOpt', 'cfg.StrOpt', (['"""database_name"""'], {'help': '"""database na...
huangsen365/boto3-docker
test_print_json.py
42d46ce4433dd037006d6b8d01db3fe444b9d8dd
import json your_json = '["foo", {"bar":["baz", null, 1.0, 2]}]' parsed = json.loads(your_json) print(type(your_json)) print(type(parsed)) #print(json.dumps(parsed, indent=4, sort_keys=True))
[((75, 96), 'json.loads', 'json.loads', (['your_json'], {}), '(your_json)\n', (85, 96), False, 'import json\n')]
goubertbrent/oca-backend
src/solutions/common/integrations/cirklo/api.py
b9f59cc02568aecb55d4b54aec05245790ea25fd
# -*- coding: utf-8 -*- # Copyright 2020 Green Valley Belgium NV # # 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...
[((2628, 2686), 'mcfw.restapi.rest', 'rest', (['"""/common/vouchers/cities"""', '"""get"""'], {'silent_result': '(True)'}), "('/common/vouchers/cities', 'get', silent_result=True)\n", (2632, 2686), False, 'from mcfw.restapi import rest\n'), ((2688, 2703), 'mcfw.rpc.returns', 'returns', (['[dict]'], {}), '([dict])\n', (...
nbrunett/aplpy
aplpy/tests/test_grid.py
f5d128faf3568adea753d52c11ba43014d25d90a
import matplotlib matplotlib.use('Agg') import numpy as np from astropy.tests.helper import pytest from .. import FITSFigure def test_grid_addremove(): data = np.zeros((16, 16)) f = FITSFigure(data) f.add_grid() f.remove_grid() f.add_grid() f.close() def test_grid_showhide(): data = np...
[((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((167, 185), 'numpy.zeros', 'np.zeros', (['(16, 16)'], {}), '((16, 16))\n', (175, 185), True, 'import numpy as np\n'), ((318, 336), 'numpy.zeros', 'np.zeros', (['(16, 16)'], {}), '((16, 16))\n', (3...
ponyatov/vz
vz.py
f808dd0dca9b6aa7a3e492d2ee0797ab96cd23a1
import os, sys class Object: ## @name constructor def __init__(self, V): self.value = V self.nest = [] def box(self, that): if isinstance(that, Object): return that if isinstance(that, str): return S(that) raise TypeError(['box', type(that), that]) ## @name d...
[((2736, 2755), 'os.mkdir', 'os.mkdir', (['self.path'], {}), '(self.path)\n', (2744, 2755), False, 'import os, sys\n'), ((4051, 4062), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (4060, 4062), False, 'import os, sys\n'), ((7619, 7633), 'os.urandom', 'os.urandom', (['(34)'], {}), '(34)\n', (7629, 7633), False, 'import o...
FlakM/fastai_text_serving
src/server.py
8262c2c1192c5e11df2e06b494ab9cf88c1dcd2a
import asyncio import logging import aiohttp import uvicorn from fastai.vision import * from starlette.applications import Starlette from starlette.middleware.cors import CORSMiddleware from starlette.responses import JSONResponse # put your url here here model_file_url = 'https://www.dropbox.com/s/...?raw=1' model_f...
[]
justforbalance/CSnet
tcpserver.py
c1e049f63d245c5d464a2d6e9aa7d3daf15bf2b6
from socket import * serverPort = 12001 serverSocket = socket(AF_INET, SOCK_STREAM) serverSocket.bind(('', serverPort)) serverSocket.listen(1) print("the server is ready to receive") while True: connectionSocket,addr = serverSocket.accept() sentence = connectionSocket.recv(1024).decode() sentence = sentence...
[]
jhphan/geneflow2
src/geneflow/extend/local_workflow.py
a39ab97e6425ee45584cfc15b5740e94a5bf7512
"""This module contains the GeneFlow LocalWorkflow class.""" class LocalWorkflow: """ A class that represents the Local Workflow objects. """ def __init__( self, job, config, parsed_job_work_uri ): """ Instantiate LocalWorkflow class....
[]
abishek-raju/EVA4B2
S12/tensornet/engine/ops/lr_scheduler.py
189f4062c85d91f43c1381087a9c89ff794e5428
from torch.optim.lr_scheduler import StepLR, ReduceLROnPlateau, OneCycleLR def step_lr(optimizer, step_size, gamma=0.1, last_epoch=-1): """Create LR step scheduler. Args: optimizer (torch.optim): Model optimizer. step_size (int): Frequency for changing learning rate. gamma (float): Fa...
[((512, 586), 'torch.optim.lr_scheduler.StepLR', 'StepLR', (['optimizer'], {'step_size': 'step_size', 'gamma': 'gamma', 'last_epoch': 'last_epoch'}), '(optimizer, step_size=step_size, gamma=gamma, last_epoch=last_epoch)\n', (518, 586), False, 'from torch.optim.lr_scheduler import StepLR, ReduceLROnPlateau, OneCycleLR\n...
youngmit/armi
armi/reactor/tests/test_zones.py
67688e4e67d2a217dfc7b1ccfa64028c20b57a5b
# Copyright 2019 TerraPower, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
[((1049, 1087), 'armi.utils.pathTools.armiAbsDirFromName', 'pathTools.armiAbsDirFromName', (['__name__'], {}), '(__name__)\n', (1077, 1087), False, 'from armi.utils import pathTools\n'), ((10873, 10888), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10886, 10888), False, 'import unittest\n'), ((1164, 1187), 'arm...
OmarEhab177/Islam_fitz
islam_fitz/survey/migrations/0005_auto_20210712_2132.py
6ad0eb21549895a6fe537e8413022b82bc530c57
# Generated by Django 3.1.12 on 2021-07-12 19:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('survey', '0004_lastpage_whatsapp_button'), ] operations = [ migrations.RemoveField( model_name='lastpage', name='wh...
[((241, 310), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""lastpage"""', 'name': '"""whatsapp_button"""'}), "(model_name='lastpage', name='whatsapp_button')\n", (263, 310), False, 'from django.db import migrations, models\n'), ((465, 507), 'django.db.models.CharField', 'models.C...
Muzammil-khan/Aspose.Email-Python-Dotnet
Examples/WorkingWithOutlookMSGs/CreateAndSaveOutlookNote.py
04ca3a6f440339f3ddf316218f92d15d66f24e7e
import aspose.email.mapi.msg as msg from aspose.email.mapi import MapiNote, NoteSaveFormat, NoteColor def run(): dataDir = "Data/" #ExStart: CreateAndSaveOutlookNote note3 = MapiNote() note3.subject = "Blue color note" note3.body = "This is a blue color note"; note3.color = NoteColor.YELLOW note3.height = 500 ...
[((179, 189), 'aspose.email.mapi.MapiNote', 'MapiNote', ([], {}), '()\n', (187, 189), False, 'from aspose.email.mapi import MapiNote, NoteSaveFormat, NoteColor\n')]
mobyw/nonebot2
nonebot/internal/adapter/template.py
36663f1a8a51bd89f4a60110047e73719adcc73d
import functools from string import Formatter from typing import ( TYPE_CHECKING, Any, Set, Dict, List, Type, Tuple, Union, Generic, Mapping, TypeVar, Callable, Optional, Sequence, cast, overload, ) if TYPE_CHECKING: from .message import Message, Mess...
[((337, 367), 'typing.TypeVar', 'TypeVar', (['"""TM"""'], {'bound': '"""Message"""'}), "('TM', bound='Message')\n", (344, 367), False, 'from typing import TYPE_CHECKING, Any, Set, Dict, List, Type, Tuple, Union, Generic, Mapping, TypeVar, Callable, Optional, Sequence, cast, overload\n'), ((373, 402), 'typing.TypeVar', ...