id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1705538
from pymixconf.mixconf import MixConf def test_config_merge(): tests = [ ({"a": 1}, {}, {"a": 1}), ({"a": 1}, {"a": 2}, {"a":2}), ({"a": 1}, {"b": 2}, {"a": 1, "b": 2}), ({"a": {"b": 1}}, {"a": {"b": 2}}, {"a": {"b": 2}}), ({"a": {"b": 1}}, {"a": {"b": 2, "c": 3}}, {"a": {"b...
StarcoderdataPython
1661449
my_name = "<NAME>" my_age = 21 my_height = 67 my_weight = 180 my_eyes = "Blue" my_teeth = "White" my_hair = "Brown" print "Let's talk about %s." % my_name print "He's %d inches tall," % my_height print "When converted to feet, because he's not a heathen. makes him:" , my_height / 12 , "feet tall" print "He'...
StarcoderdataPython
4801151
<gh_stars>1-10 """ TopHub: Tensor Operator Hub To get the best performance, we typically need auto-tuning for the specific devices. TVM releases pre-tuned parameters in TopHub for some common networks and hardware targets. TVM will download these parameters for you when you create the target for the first time. """ # p...
StarcoderdataPython
3347082
__author__ = 'iammai'
StarcoderdataPython
3307526
import bisect from biicode.common.utils.serializer import ListDeserializer class TimeBaseMap(tuple): ''' Two lists, first of time, second of ID or BlockVersionTable or set or Renames ''' def __new__(cls, data=None): if not data: obj = super(TimeBaseMap, cls).__new__(cls, ([], [])) ...
StarcoderdataPython
1685431
from fastapi import FastAPI, status, Depends, HTTPException, UploadFile, File from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse, FileResponse from fastapi_users import FastAPIUsers from fastapi_users.authentication import JWTAuthentication import utils from database import D...
StarcoderdataPython
192657
<reponame>Giving-Tuesday/wbpy # -*- coding: utf-8 -*- import datetime import wbpy class InstrumentalData(object): def __init__(self): self.dataset = wbpy.InstrumentalDataset(self.data, self.data_stat, self.data_type, self.date) class InstrumentalMonth(InstrumentalData): date = datetime.d...
StarcoderdataPython
3310363
<filename>util/storage.py<gh_stars>1-10 #!/usr/bin/env python3 import os def storagePath(url): url = url.split("//")[1] folderName = url.split("/")[0] dirPath = '/tmp/' + folderName if not os.path.exists(dirPath): os.mkdir(dirPath) return dirPath
StarcoderdataPython
3233180
import numpy as np import torch import logging import sys import os from datetime import datetime import copy import argparse import tensorboardX from tensorboardX import SummaryWriter import shutil import pickle import pandas as pd import joblib import yaml import random def seed_all(seed=None): """Set seed for ...
StarcoderdataPython
3235801
from .testing_constants import * from .testing_data import *
StarcoderdataPython
155293
""" This module contains all the code that is necessary to facilitate the updating of the simulation and other objects from the interface, and also for sending information back to the interface. """ import copy from twisted.logger import Logger from ..util.dict import difference, merge class Handler(): """ The...
StarcoderdataPython
123339
import sys import os import subprocess import errno print("########## Chi-Tech Dependency installer ##########") ####################################### Setting install dir cwd = os.getcwd() install_dir = cwd + "/chi-dependencies" log_str = ">>" + install_dir + "log.txt" if (len(sys.argv) == 1): print("Install dire...
StarcoderdataPython
1749983
############################################################################## # Copyright (c) 2017 ZTE Corporation and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is avail...
StarcoderdataPython
1788916
#!/usr/bin/env python # -*- coding: cp1252 -*- # XSSA is a Cross Site Scripting Scanner & Vulnerability Confirmation # By <NAME> - twitter.com/@Yehia1mamdouh / Facebook/yehia.mamdouh.98 import colorama from colorama import init from colorama import Fore, Back, Style colorama.init() def Apache(): print Fore.GREEN...
StarcoderdataPython
42357
<reponame>isoleph/ARK #!/usr/bin/env python3 # script to plot and compare second order RK4 results import matplotlib.pyplot as plt import numpy as np import pandas as pd # purely cosmetic import seaborn as sns sns.set(); def main(): # create dataframe from C++ outfile df = pd.read_csv("ARK2.csv", header=0);...
StarcoderdataPython
3258028
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Evedom Packaging Settings """ __author__ = '(nam4dev) <NAME>' __created__ = '08/11/2017' from distutils.core import setup setup( name='evedom', version='0.0.1', packages=['evedom', 'evedom.helpers'], url='https://github.com/nam4dev/evedom', licen...
StarcoderdataPython
4803334
# -*- coding: utf-8 -*- # Copyright (c) 2017, Caitlah Technology and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe, json from frappe.utils import cstr, flt, fmt_money, formatdate from frappe import msgprint, _, scrub from frappe.model.document impo...
StarcoderdataPython
95410
<gh_stars>10-100 from django.conf import settings from django.urls import include, path, re_path from helusers import admin from wagtail.admin import urls as wagtailadmin_urls from wagtail.core import urls as wagtail_urls from wagtail.documents import urls as wagtaildocs_urls from digi.views import sitemap_view from e...
StarcoderdataPython
1718760
from django.contrib import admin from django.apps import apps for model in apps.get_app_config("recruiter").get_models(): admin.site.register(model)
StarcoderdataPython
3229264
<reponame>fdm1/advent_of_code """ http://adventofcode.com/2015/day/5 """ from string import ascii_lowercase VOWELS = ['a', 'e', 'i', 'o', 'u'] BAD_STRINGS = ['ab', 'cd', 'pq', 'xy'] DOUBLE_LETTERS = [i*2 for i in ascii_lowercase] def is_good_string(string): """Test all the rules""" return (has_three_vowels(s...
StarcoderdataPython
3337239
<reponame>TheDeveloperMask/age-gender-recognition-mobilenet-groups-64x64-flask-server # Copyright © 2020 by Spectrico model_file = "model-weights-spectrico-age-gender-recognition-groups-mobilenet-64x64-9CFFCA00.pb" # path to the age and gender classifier label_file = "labels.txt" # path to the text file, contai...
StarcoderdataPython
1668066
from sklearn.linear_model import RidgeCV from sklearn.model_selection import train_test_split import pandas as pd # Aplica cross-validation K-fold, analisando a predição dos dados com a flag 'revision' def crossValidationKFold(dataExpected, dataPredicted, dataFrame1, dataFrame2): expectedFrame = pd.DataFrame.fro...
StarcoderdataPython
197269
import time import datetime import numpy as np import matplotlib.pyplot as plt from collections import OrderedDict import psutil import threading from pynvml import (nvmlInit, nvmlDeviceGetCount, nvmlDeviceGetHandleByIndex, nvmlDeviceGetUtilizationRates, ...
StarcoderdataPython
1658080
<reponame>OpenTreeOfLife/opentree from gluon.storage import Storage settings = Storage() settings.migrate = True settings.title = 'opentree' settings.subtitle = 'front page of web site and web services associated with the Open Tree of Life project' settings.author = 'Open Tree of Life developers' settings.author_email...
StarcoderdataPython
67276
import sqlite3, json from sqlite3 import Error def create_connection(database): try: conn = sqlite3.connect(database, isolation_level=None, check_same_thread = False) conn.row_factory = lambda c, r: dict(zip([col[0] for col in c.description], r)) return conn except Error as e: ...
StarcoderdataPython
3240135
<filename>setup.py from setuptools import setup, find_packages with open("README.md", "r") as fh: long_description = fh.read() setup( name='py-moc', version='0.0.1rc5', description="A simple model suite for the MOC", long_description=long_description, long_description_content_type="text/markdown...
StarcoderdataPython
1636742
<gh_stars>100-1000 # -*- coding: utf-8 -*- import mock import pytest from bravado_core.response import IncomingResponse from bravado.config import bravado_config_from_config_dict from bravado.config import RequestConfig from bravado.exception import BravadoTimeoutError from bravado.exception import ForcedFallbackResul...
StarcoderdataPython
3365202
import math from service.fake_api_results import ALL_TITLES, OFFICIAL_COPY_RESULT, SELECTED_FULL_RESULTS SEARCH_RESULTS_PER_PAGE = 20 def get_title(title_number): return SELECTED_FULL_RESULTS.get(title_number) def _get_titles(page_number): nof_results = len(ALL_TITLES) number_pages = math.ceil(nof_resu...
StarcoderdataPython
2931
import logging import logging.handlers import os class Logger(object): def __init__(self, name, default_loglevel='INFO', fmt=None, syslog=None): self.name = name self.syslog = syslog self.fmt = fmt if fmt is not None else "%(asctime)-15s %(name)s %(levelname)s %(message)s" if 'LOGLEVEL' in os.env...
StarcoderdataPython
3249892
<gh_stars>0 # -*- coding: UTF-8 -*- #!/usr/bin/python3 from pymycobot.mycobot import MyCobot from pymycobot.genre import Angle # Variables needed to initialize MyCobot Pi from pymycobot import PI_PORT, PI_BAUD import time # Initialize MyCobot object mc = MyCobot(PI_PORT, PI_BAUD) # Get the coordinates of...
StarcoderdataPython
1711940
<filename>src/exports/urls.py<gh_stars>1-10 # -*- coding: utf-8 -*- from django.conf.urls import url from exports.views import ExportCreate, ExportList, DownloadView urlpatterns = [ url(r'^$', ExportList.as_view(), name="export_list"), url(r'^(?P<organisation>[\w-]+)/(?P<category>[\w-]+)/$...
StarcoderdataPython
3298208
# This code is part of Qiskit. # # (C) Copyright IBM 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
StarcoderdataPython
3355235
import sys import urllib import django PY3 = sys.version_info[0] == 3 if PY3: from urllib import parse as urlparse def to_string(s): if isinstance(s, str): return s return str(s, 'latin1') def to_wsgi_safe_string(s): return urlparse.quote(to_string(s)) def from_...
StarcoderdataPython
1759270
<reponame>meteostat/meteor<gh_stars>0 """ ZAMG hourly synop import routine Get hourly synop data for selected weather stations in Austria. The code is licensed under the MIT license. """ from datetime import datetime import pandas as pd from jasper import Jasper from jasper.actions import persist from jasper.schema ...
StarcoderdataPython
4842798
from ctypes import * import numpy_allocator std = CDLL(None) std.free.argtypes = [c_void_p] std.free.restype = None std.memalign.argtypes = [c_size_t, c_size_t] std.memalign.restype = c_void_p std.memcpy.argtypes = [c_void_p, c_void_p, c_size_t] std.memcpy.restype = c_void_p std.memset.argtypes = [c_void_p, c_int,...
StarcoderdataPython
3334813
#!/usr/bin/env python from proof.analysis import Analysis, never_cache
StarcoderdataPython
1644227
import numpy as np from collections import defaultdict real ="""p=<2366,784,-597>, v=<-12,-41,50>, a=<-5,1,-2> p=<-2926,-3402,-2809>, v=<-55,65,-16>, a=<11,4,8> p=<2290,257,-3040>, v=<41,119,57>, a=<-10,-10,5> p=<3090,-493,-1340>, v=<-134,19,-37>, a=<1,0,7> p=<-1338,2295,4101>, v=<-158,34,-48>, a=<19,-12,-12> p=<-114...
StarcoderdataPython
3292797
<filename>build_pipeline/pipelines/evaluate.py """Evaluation script for measuring mean squared error.""" import json import logging import pathlib import pickle import tarfile import numpy as np import pandas as pd import xgboost from math import sqrt from sklearn.metrics import mean_absolute_error, mean_squared_erro...
StarcoderdataPython
3342181
<filename>pattern/23.py k=0 c=65 for i in range(5): k=c for j in range(i): print(chr(k),end='') k+=1 print()
StarcoderdataPython
3319454
#!/usr/bin/env python 2.7 # -*- coding: utf-8 -*- """ 对正则表达式函数的封装 Authors: Gary(<EMAIL>) Date: 2015/07/07 17:23:06 """ import re def reg_keyword(data): """ 从表字段里面提取出关键词,格式为: ***[:###]*** 提取出### :param data: :return: """ patt = re.compile(r".*\[:(.+)\].*") ret = patt.findall(da...
StarcoderdataPython
142725
import utils import pickle as pkl import constants infile = 'data/agr_50_mostcommon_10K.tsv' worddict = {} worddict[constants.pad] = constants.pad_idx worddict[constants.unk] = constants.unk_idx # probably we won't need this worddict[constants.bos] = constants.bos_idx worddict[constants.eos] = constants.eos_idx for d...
StarcoderdataPython
1614115
# @component { # "kind" : "modelsource", # "language" : "py", # "description" : "The application supplies the model to the production pipeline's prediction algorithm using the prediction API", # "properties": [ # { "name": "Trained" , "field": "trained", "kind": "boolean", "required": false, "default": true, "d...
StarcoderdataPython
4821275
from layers import * import tensorflow as tf from tensorflow.contrib.distributions import RelaxedBernoulli import numpy as np digamma = tf.digamma from digamma import digamma_approx as digamma_approx lgamma = tf.lgamma Euler = 0.577215664901532 def bbdropout(x, training, alpha=1e-4, thres=1e-2, a_init=-1., ta...
StarcoderdataPython
1631057
import os from setuptools import setup import ConfigParser def load_metadata(ini_file): config = ConfigParser.ConfigParser() read_files = config.read(ini_file) if len(read_files) == 0: raise Exception("Failed to read %s" % ini_file) meta = {} for item in config.options("meta"): met...
StarcoderdataPython
3363104
<filename>m_scraper/rq/tumblrer.py<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2018 <NAME> <<EMAIL>> # Licensed under the MIT License - https://opensource.org/licenses/MIT import json import time import os from .downloader import Downloader from .utils.helpers import requests_get ...
StarcoderdataPython
3224615
<filename>model/models.py<gh_stars>0 import tensorflow as tf import tensorflow.keras as tfk from tensorflow.keras.layers import Dense import math from metrics import * def gauss_pdf(x, name=None): return (1/tf.sqrt(2*math.pi))*tf.math.exp((-tf.pow(x, 2))/2) def build_model(in_shape, out_shape, manifold_mixup=Fa...
StarcoderdataPython
1703597
<gh_stars>0 # -*- coding: utf-8 -*- import sys import argparse import json def get_argument_parser(): parser = argparse.ArgumentParser( description='Command line tools to use simpleflow') parser.add_argument( '--local', action='store_true', default=False, help='Run th...
StarcoderdataPython
14116
import unittest from datetime import date from irLib.marketConvention.dayCount import ACT_ACT from irLib.marketConvention.compounding import annually_k_Spot from irLib.helpers.yieldCurve import yieldCurve, discountCurve, forwardCurve import numpy as np alias_disC = 'disC' alias_forC = 'forC' referenceDate = date(2020...
StarcoderdataPython
1781630
import abc import json import os import six import yaml from halo import halo from gradient import api_sdk from gradient.cli_constants import CLI_PS_CLIENT_NAME from gradient.exceptions import ApplicationError from gradient.commands.common import BaseCommand, ListCommandMixin, DetailsCommandMixin, LogsCommandMixin ...
StarcoderdataPython
1604652
<filename>sample_infrastructure/broker_exec_2.py """ Broker 2 Execution API """ from yauber_executor.asyncapp import AsyncApp import asyncio from yauber_executor.logs import log import uuid class Broker2Execution(AsyncApp): async def rpc_execute(self, *, account, ticker, price, qty): print(f'executing: A...
StarcoderdataPython
4805464
# convert the omimGene2 sql table format to bigBed format with a mouse over string import sys, os def inhModeToCode(inhModes): inhCodes = [] inhModes = inhModes.split(", ") for inhMode in inhModes: inhMode = inhMode.strip("?") if inhMode == "": inhCode = "" elif inhMode ...
StarcoderdataPython
101523
<reponame>JamesHutchison/brython from browser import html, document, window import javascript #memorize/cache? def _get_value(other): if isinstance(other, LongInt): return other.value return other class BigInt: def __init__(self): pass def __abs__(self): return LongInt(self.value.abs...
StarcoderdataPython
1671756
from subprocess import Popen import sys import zipfile import os import shutil def get(filename = "libcocos2djs.so"): with open(filename, "rb") as f: content = f.read() start = content.find(b"Cocos Game") + 10 # 直接从Game后面开始查 if start < 0 or start > len(content): return "" f...
StarcoderdataPython
3242140
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import division from __future__ import absolute_import import os import datetime import argparse import numpy as np import h5py import cv2 import turret import turret.caffe import turret.layers as L MAX_BATCH_SIZE = 128 WORKSPACE_SIZE = ...
StarcoderdataPython
1631830
""" This file is part of Team Brocket Robotics, licensed under the MIT License. A copy of the MIT License can be found in LICENSE.txt """ import sys import logging import os import time from subprocess import Popen from sr.robot import Robot from IOInterface import IOInterface RUN_TESTS = False COMP_MODE = ...
StarcoderdataPython
1738356
def binary_search_iterative(array, item): # PSEUDO: # [5,6,7,10,12] target 6 # find the middle position/item # check if middle item is the target, if so return # else compare the target to the item at the middle # if target is less than item at the middle we ignore the right half # if th...
StarcoderdataPython
1660025
<filename>version1.py import numpy as np import cv2 from keras.models import * from keras.layers import * def keras_predict(model,image): processed= process_image(image) steering_angle= float(model.predict(processed,batch_size=1)) steering_angle= steering_angle*200 return steering_angle def...
StarcoderdataPython
127573
<reponame>Cursorr/DiscordBotTemplate from setuptools import setup setup( name='DiscordBotTemplate', author='Cursorr', version='1.0', description='Bot template creator for discord.py', url='https://www.github.com/Cursorr/DiscordBotTemplate', packages=['dbt', 'dbttemplates'] )
StarcoderdataPython
3311645
<reponame>oudream/boost_1_42_0<gh_stars>1-10 # Status: mostly ported. # TODO: carry over tests. # Base revision: 56043 # # Copyright 2001, 2002, 2003 <NAME> # Copyright 2002, 2006 <NAME> # Copyright 2002, 2003, 2004, 2005, 2006 <NAME> # Distributed under the Boost Software License, Version 1.0. # (See accompanying ...
StarcoderdataPython
1723792
<gh_stars>1-10 from PyQt5.QtWidgets import QMainWindow, QApplication, QTextEdit, QStyleFactory, QHBoxLayout, QDockWidget, QWidget, \ QListWidget, QVBoxLayout, QAction from PyQt5.QtGui import QPalette, QColor from PyQt5.QtCore import Qt import sys from tab_widget import TabWidget from toolbox import ToolBox from st...
StarcoderdataPython
20636
# -*- coding: utf-8 -*- from remi.gui import * from remi import start, App import cv2 import numpy import chdkptp import time import threading import rawpy class OpenCVVideoWidget(Image): def __init__(self, **kwargs): super(OpenCVVideoWidget, self).__init__("/%s/get_image_data" % id(self), **kwargs) ...
StarcoderdataPython
41223
<reponame>aashiqmuhamed/transformer-gan # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licens...
StarcoderdataPython
268
import contextlib import ctypes import json import os import shutil import struct import subprocess import sys import tempfile from datetime import datetime, timedelta, timezone from enum import Enum, auto from hashlib import pbkdf2_hmac from .aes import ( aes_cbc_decrypt_bytes, aes_gcm_decrypt_and_verify_byte...
StarcoderdataPython
1609730
"""Python version compatibility support for minidom.""" # This module should only be imported using "import *". # # The following names are defined: # # NodeList -- lightest possible NodeList implementation # # EmptyNodeList -- lightest possible NodeList that is guarateed to # remain empty ...
StarcoderdataPython
179709
<gh_stars>0 ''' (c) 2011 <NAME>, MPI for Developmental Biology License: BSD-2-Clause ''' import os.path from pymol import cmd, CmdException mysql_kwargs = { 'host': 'abt1-th.eb.local', 'user': 'bioguest', 'passwd': '', 'db': 'biomol', } def _assert_package_import(): if not __name__.endswith('.im...
StarcoderdataPython
3237893
#!/usr/bin/python # Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notic...
StarcoderdataPython
3376584
<reponame>bilgetutak/pyroms<gh_stars>10-100 #!/usr/bin/env python from pyroms_toolbox import ocean_in def main(): # fname = raw_input("Name of ocean.in file:") ocean_1 = ocean_in("ocean_foo.in") # jname = raw_input("Name of json file:") ocean_1.write_json_dict("foo.json") ocean_1.write_json_dict("fo...
StarcoderdataPython
197696
<filename>tests/test_exception_handling.py # # Copyright 2013 Quantopian, 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 re...
StarcoderdataPython
3319886
<reponame>jhamrak/instrument-recognition-lab import numpy as np import librosa as lb import os DATA_DIR = "openmic-2018/" DATA_FILE = "openmic-2018.npz" OPENMIC = np.load(os.path.join(DATA_DIR, DATA_FILE), allow_pickle=True) Y_true, Y_mask, sample_key = OPENMIC['Y_true'], OPENMIC['Y_mask'], OPENMIC['sample_key'] MFCC ...
StarcoderdataPython
3371535
<reponame>leanderthiele/Quijote-simulations # This script generates 3D coarse density fields from the simulation snapshots from mpi4py import MPI import numpy as np import sys,os import readgadget import MAS_library as MASL ###### MPI DEFINITIONS ###### comm = MPI.COMM_WORLD npro...
StarcoderdataPython
1739303
<filename>v1.0.0.test/toontown/coghq/DistributedBattleFactoryAI.py<gh_stars>1-10 from toontown.coghq import DistributedLevelBattleAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import State from direct.fsm import ClassicFSM, State from toontown.battle.BattleBase import * import CogDisguiseGlobals...
StarcoderdataPython
3208801
<reponame>stephend017/Discord-RitoMan """ Global store for the db session to use """ import os from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, Session from discord_ritoman.utils import dynamic_import_class, get_db_uri config_name = os.getenv("APP_CONFIG", "TestingConfig") config = dynam...
StarcoderdataPython
3315836
""" index ~~~~~ A program to build browser home pages from link collections. :copyright: (c) 2016 by <NAME> :license: BSD (see LICENSE for details) """
StarcoderdataPython
192946
import sys sys.path.append('d:\\work\\jturtle') from jturtle import * init() for _ in range(4): forward(40) right(90) done(True) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.done(True)
StarcoderdataPython
1683326
from helper.exception import NotPartOfFeatureError, DisabledBy from helper.tests.ssh_authorized import SshAuthorized import pytest def test_ssh_authorized(client, features, testconfig): """The test function executed by pytest""" try: SshAuthorized(client, features, testconfig) except (NotPartOfFeat...
StarcoderdataPython
3324936
<reponame>CoderDojoDC/python #!/usr/bin/env python3 import random, os, time guess = "" score = 0 def set_up_screen(): os.system('clear') border = '*' * 42 filler = " " * 40 print('\n' + border) print("*" + filler + "*") print('* State Capitals Quiz! *') print("*" + fille...
StarcoderdataPython
124056
lista_cadastro = [] def placa_v(): if len(lista_cadastro) > 0: print('tem placa ') else: print('não tem placa')
StarcoderdataPython
1669352
<gh_stars>0 import sys filename = sys.argv[1] view_count = 0 with open(filename, "r") as fin: for line in fin: # print line view = int(line.split()[1]) if (view > 2500 and view < 3000): view_count = view_count + 1 print view_count
StarcoderdataPython
1654245
""" Copyright 2014 Rackspace 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, software dist...
StarcoderdataPython
187889
<filename>rowboat/sql.py<gh_stars>0 import psycogreen.gevent; psycogreen.gevent.patch_psycopg() import yaml from peewee import Proxy, OP, Model, Expression from playhouse.postgres_ext import PostgresqlExtDatabase REGISTERED_MODELS = [] OP['IREGEXP'] = 'iregexp' # Create a database proxy we can setup post-init databa...
StarcoderdataPython
168014
<filename>operators/app.py import numpy as np a = 10 b = 3 c = 10 # Addition print(a + b) # 13 # Subtraction print(a - b) # 7 # Multiplication print(a * b) # 30 # Division print(a / b) # 3.3333333333333335 # Modulo print(a % b) # 1 # Exponentiation print(a ** b) # 1000 # Floor Division print(a // b) # 3 # Bit...
StarcoderdataPython
1751204
__author__ = '<NAME>, <EMAIL>' from scipy import zeros, array, ndarray from pybrain3.rl.environments import Environment from pybrain3.structure.parametercontainer import ParameterContainer from pybrain3.rl.environments.fitnessevaluator import FitnessEvaluator class FunctionEnvironment(Environment, FitnessEvaluator)...
StarcoderdataPython
3356474
"""Contains a downloader for ILIAS.""" import datetime import logging import math import os from pathlib import Path, PurePath from typing import Callable, List, Optional, Union import bs4 import requests from ..logging import PrettyLogger from ..organizer import Organizer from ..tmp_dir import TmpDir from ..transfo...
StarcoderdataPython
112497
from django.db import models # Create your models here. class Customer(models.Model): name = models.CharField(max_length=200, null=True) phone = models.CharField(max_length=200, null=True) email = models.CharField(max_length=200, null=True) date_created = models.DateTimeField(auto_now_add=True, null=True) def ...
StarcoderdataPython
3328449
<reponame>SergeBakharev/content<gh_stars>1-10 import demistomock as demisto from CommonServerPython import * def main(): params = demisto.params() # when auto_detect is not selected if params.get('auto_detect_type') is False and not params.get('indicator_type'): return_error('Indicator Type cannot...
StarcoderdataPython
1774520
#!/usr/bin/env python ########################################################################## # # Copyright (c) 2018, Image Engine Design Inc. All rights reserved. # Modified by <NAME> for pipe-bootstrap building. # # Redistribution and use in source and binary forms, with or without # modification, are permitte...
StarcoderdataPython
3271717
import pytest from conans.test.utils.mocks import MockSettings, ConanFileMock from conan.tools.build import can_run class ConfigMock: def __init__(self, run=None): self.can_run = run def get(self, conf_name, default=None, check_type=None): return self.can_run @pytest.mark.parametrize("expe...
StarcoderdataPython
1694889
from hesburgh import scriptutil text = "" for bg in scriptutil.BG_COLORS: text += scriptutil.format("bg", bg) print text text = "" for fg in scriptutil.FG_COLORS: text += scriptutil.format("fg", fg) print text text = "" for extra in scriptutil.EXTRA_FORMATS: text += scriptutil.format("extra", extra) print t...
StarcoderdataPython
67177
from ...abstract_method_exception import AbstractMethodException DEFAULT_RETURN_OBJECT_NAME = "default" class AbstractTaskFuture: def get_output(self, name: str = DEFAULT_RETURN_OBJECT_NAME): raise AbstractMethodException() def list_outputs(self): raise AbstractMethodException()
StarcoderdataPython
1695002
''' class Pycharm: def execute(self): print("compile") print("run") class MyIDE: def execute(self): print("spell check") print("compile") print("run") class Laptop: def code(self,ide): ide.execute() py=Pycharm() My=MyIDE() L1=Laptop() L1.code(My) L1.code(py) p...
StarcoderdataPython
3326524
""" This file handles Reservation related HTTP request. """ from flask import request from flask_restplus import Resource from flask_jwt_extended import jwt_required from flask_jwt_extended.exceptions import NoAuthorizationError,InvalidHeaderError,RevokedTokenError from jwt import ExpiredSignatureError, InvalidTokenErr...
StarcoderdataPython
3287964
def test_browse_root(library): results = library.browse('radionet:root') assert 8 == len(results) def test_browse_localstations(library): results = library.browse('radionet:localstations') assert len(results) > 0 page_uri = results[0].uri if results is not None else None assert page_uri is ...
StarcoderdataPython
101621
import requests import json import random from api_key import access_token from keyboards import default_keyboard access = access_token id = 176863166 v = '8.92' admins = [132513584] def get_longpoll(): params={ 'group_id': id, 'v': v, 'access_token': access } ...
StarcoderdataPython
12235
<reponame>Kaju-Bubanja/PoseCNN<filename>generate_dataset/visualize_mask.py<gh_stars>10-100 import cv2 import rosbag import rospy from cv_bridge import CvBridge def main(): # bag = rosbag.Bag("/home/satco/PycharmProjects/PoseCNN/bag/dataset_one_box.bag") bag = rosbag.Bag("/home/satco/PycharmProjects/PoseCNN/ba...
StarcoderdataPython
142785
import torch.nn as nn class BatchBottle(nn.Module): ''' Perform the reshape routine before and after an operation ''' def forward(self, input): if len(input.size()) <= 2: return super(BatchBottle, self).forward(input) size = input.size()[1:] out = super(BatchBottle, self)....
StarcoderdataPython
3271409
"""Spacetime Canvas Module""" import logging import copy from fibertree import Tensor from fibertree import Fiber from fibertree import Payload from fibertree import TensorImage # # Set up logging # module_logger = logging.getLogger('fibertree.graphics.spacetime_canvas') class SpacetimeCanvas(): """SpaceTime...
StarcoderdataPython
3389703
from rest_framework import serializers from v1.accounts.serializers.user import UserSerializer from v1.music.models.album import Album from v1.music.models.song import Song from v1.music.serializers.song import SongSerializer from v1.replies.models.album_reply import AlbumReply from v1.replies.serializers.album_reply i...
StarcoderdataPython
3315369
import rest_framework_filters as filters from talentmap_api.organization.models import Obc from talentmap_api.common.filters import multi_field_filter, negate_boolean_filter, full_text_search, NumberInFilter from talentmap_api.common.filters import ALL_TEXT_LOOKUPS, INTEGER_LOOKUPS, FOREIGN_KEY_LOOKUPS # TODO (if nee...
StarcoderdataPython
3209362
from csv import reader from os import walk import pygame def import_csv_layout(path): terrain_map = [] with open(path) as level_map: layout = reader(level_map, delimiter=',') for row in layout: terrain_map.append(list(row)) return terrain_map # print(import_csv_layout('map/map...
StarcoderdataPython
3263307
from pagedb import PageDB import ipaddress from bs4 import BeautifulSoup import re def addSuffix(line, dict): #not empty or comment line or consist of invalid charachters if((line != '') and (line[:2] != '//') and (line.find('?') == -1)): domains = line.split('.') TLD = domains[-1] if(TLD not in dict): dict...
StarcoderdataPython