id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6578100
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-10-23 19:40 from __future__ import unicode_literals from django.db import migrations def copy_repo(apps, schema_editor): Plan = apps.get_model('plan', 'Plan') PlanRepository = apps.get_model('plan', 'PlanRepository') for plan in Plan.objects.al...
StarcoderdataPython
1749895
<filename>rassh/datatypes/response_with_code.py class ResponseWithCode(object): """A response to an HTTP request, with an HTTP response code.""" def __init__(self, response: object, code: int): try: int_code = int(code) except TypeError: raise ValueError("Code must be an ...
StarcoderdataPython
5005022
<reponame>praisetompane/3_programming def timeConversion(s): hour_difference = 12 time = s.split(':') hour = time[0] minutes = time[1] seconds = time[2][:2] time_of_day = time[2][2:] if time_of_day == 'AM' and hour == '12': return f'00:{minutes}:{seconds}' elif time_of_day == '...
StarcoderdataPython
9759852
<reponame>canadiyaman/thetask from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import get_user_model User = get_user_model() class CustomUserCreationForm(UserCreationForm): class Meta: model = User fields = ['username'] def __init__(self, *args, **kwargs): ...
StarcoderdataPython
4828321
<reponame>odoku/Hyena # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function from datetime import date, datetime from dateutil.tz import tzoffset import pytest from scrapbook import Content, Element from scrapbook.filters import ( Bool, CleanText, Contains, DateTime, Equal...
StarcoderdataPython
4913205
import re from marshmallow import pre_load from ma import ma from models.user import UserModel class NonASCIIError(Exception): def __init__(self, message): super().__init__(message) class LengthTooShortError(Exception): def __init__(self, message): super().__init__(message) class LengthT...
StarcoderdataPython
11243298
import json from pbx_gs_python_utils.utils.Lambdas_Helpers import slack_message from pbx_gs_python_utils.utils.Misc import Misc def run(event, context): team_id = 'T7F3AUXGV' channel = 'DDKUZTK6X' text = "in API Gateway test..." attachments = [ {'text': "{0}".format(Misc.json_format(event)) , 'color'...
StarcoderdataPython
206013
import clr clr.AddReference('C:\\Program Files\\Siemens\\Automation\\Portal V15_1\PublicAPI\\V15.1\\Siemens.Engineering.dll') from System.IO import DirectoryInfo import Siemens.Engineering as tia project_path = DirectoryInfo ('C:\\Jonas\\TIA') project_name = 'PythonTest' #Starting TIA print ('Starting TIA with UI')...
StarcoderdataPython
1906704
<gh_stars>0 """ DBA 1337_TECH, AUSTIN TEXAS © MAY 2021 Proof of Concept code, No liabilities or warranties expressed or implied. """ from django.conf import settings from django.contrib.auth import get_user from django.shortcuts import redirect def custom_login_required(view): # view argument must be a function ...
StarcoderdataPython
1864925
# import time # import pdb # import threading # import logging # from multiprocessing import Pool, Process # import pytest # from utils.utils import * # from common.constants import * # COMPACT_TIMEOUT = 180 # field_name = default_float_vec_field_name # binary_field_name = default_binary_vec_field_name # default_singl...
StarcoderdataPython
6572745
from collections import deque class Node: def __init__(self,val): self.data = val self.left = None self.right = None class Solution: def merge(self, result, array, reverse=False): if reverse == False: while len(array): node = array.po...
StarcoderdataPython
8019584
<gh_stars>1-10 # Generated by Django 3.0.4 on 2020-03-19 13:30 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('business', '0014_auto_20200317_1403'), ] operations = [ migrations.AddField( model_name='category', n...
StarcoderdataPython
6656069
<gh_stars>0 import connect from getpass import getpass import mysql.connector def test_transfer(): print('Enter information about the database with the Titles table, that you would like to check: ') host = input("Host: ") user = input("User: ") password = getpass() database = input("Database: ") ...
StarcoderdataPython
12845152
# coding=utf-8 from .misc import AbstractAttribTracer from .transformer import AbstractDataTransformer from .translator import AbstractTranslator from .translator_hub import AbstractTranslatorsHub
StarcoderdataPython
1806253
import click from sceptre.context import SceptreContext from sceptre.cli.helpers import catch_exceptions from sceptre.plan.plan import SceptrePlan from sceptre.cli.helpers import stack_status_exit_code @click.command( name="diff", short_help="Creates a diff between local and CloudFormation templates.") @click.ar...
StarcoderdataPython
9759711
<reponame>katarinabrdnik/analiza-podatkov import requests import os.path import re import orodja STEVILO_STRANI = 125 STEVILO_ALBUMOV_NA_STRAN = 40 vzorec_bloka = re.compile( r'<div id="pos\d\d?\d?\d?"' r'.*?' r'class="linkfire_container lazyload">', flags=re.DOTALL ) vzorec_albuma = re.compile( ...
StarcoderdataPython
6470951
import random from flask import Flask, request from datetime import datetime from pymessenger import Bot from NLP import wit_response from tabulate import tabulate import pandas app = Flask("Schedule Bot") ACCESS_TOKEN = "" bot = Bot(ACCESS_TOKEN) VERIFY_TOKEN = "" days = ['Monday', 'Tuesday', 'Wednesday', 'Thursda...
StarcoderdataPython
1854850
#!/usr/bin/env python3 """ This document is created by magic at 2018/8/17 """ def binary_search(values, target): """ :param values: :param target: :return: """ left, right = 0, len(values) - 1 while left <= right: mid = int((left + right) / 2) if target < values[mid]: ...
StarcoderdataPython
3581001
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import jsonfield.fields from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('django_emarsys', ...
StarcoderdataPython
1703874
<gh_stars>0 # Copyright (c) 2019 <NAME> # https://github.com/grzracz # Files available under MIT license import sys # (sys.argv) import socket # (socket.gethostbyname()) import subprocess # for using ipconfig (subnet mask) and ping # tries to find ip from domain def viable_ip(domain_name): viable = Fa...
StarcoderdataPython
1635789
""" Core implementation of :mod:`facet.simulation.partition` """ import logging import math import operator as op from abc import ABCMeta, abstractmethod from typing import Any, Generic, Iterable, Optional, Sequence, Tuple, TypeVar import numpy as np import pandas as pd from pytools.api import AllTracker, inheritdoc...
StarcoderdataPython
1888192
from configya import YAMLConfig from cosmogrb.utils.package_utils import get_path_of_user_dir structure = {} structure["logging"] = dict(level="INFO") structure["multiprocess"] = dict(n_grb_workers=6, n_universe_workers=6) structure["gbm"] = {} structure["gbm"]["orbit"] = dict(default_time=0, use_random_time=True) ...
StarcoderdataPython
3467757
""" Helper to get nameservers information and resolving domains. """ import dns import dns.message import dns.rdataclass import dns.rdatatype import dns.query import dns.resolver class DNSClient: def __init__(self, nameservers=None, port=53): self.nameservers = nameservers or ["8.8.8.8", "8.8.4.4"] ...
StarcoderdataPython
4876251
<filename>matdolbook/board/models.py from django.db import models from matdolbook.users import models as user_models class TimeStampModel(models.Model): created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now = True) class Meta: abstract = True class Content...
StarcoderdataPython
1837004
<reponame>velikaBeba/khinsider-downloader #!/bin/python3 from bs4 import BeautifulSoup import concurrent.futures import requests import argparse import os import shutil # parse arguments parser = argparse.ArgumentParser() parser.add_argument('link', help='link to the album on khinsider') parser.add_argument('-d', '--...
StarcoderdataPython
1761009
<reponame>brunocorbetta/exerciciocursoemvideo from random import randint from time import sleep def sorteia(list): print('Sorteando 5 valores da lista ', end='') for c in range(0, 5): n = randint(0, 100) list.append(n) sleep(0.5) print(f'{n}', end=' ') print('Pronto') def ...
StarcoderdataPython
4886268
<filename>save_sim/save_df_old.py<gh_stars>0 #!/bin/sh /cvmfs/icecube.opensciencegrid.org/py2-v1/icetray-start #METAPROJECT /data/user/jbourbeau/metaprojects/icerec/V05-00-00/build from __future__ import division import numpy as np import pandas as pd import time import glob import argparse import os from collections ...
StarcoderdataPython
12827955
from unittest import mock from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.tracking import MlflowClient from mlflow.tracking.default_experiment.databricks_notebook_experiment_provider import ( DatabricksNotebookExperimentProvider, Databr...
StarcoderdataPython
1859448
from bidding.models import Bid class BiddingInteractions: def __init__(self, **repositories): self._database_repository = repositories["database_repository"] self._pubsub_repository = repositories["pubsub_repository"] def create_bid(self, data): bid = Bid( item_id=data["it...
StarcoderdataPython
1853184
<filename>c3lingo/admin.py from django.contrib import admin from .models import Language, Conference, Room, Talk, Translation, Translator, TranslatorSpeaks, Booth, Shift, ShiftAssignment admin.site.register(Language) admin.site.register(Conference) admin.site.register(Room) admin.site.register(Talk) admin.site.registe...
StarcoderdataPython
6534708
<reponame>nodeus/radioboss-telegram-bot #!/usr/bin/env python # -*- coding: utf-8 -*- # Телеграм бот для связи c RadioBoss # работает на hyperadio.retroscene.org -> @hyperadio_bot from __future__ import print_function, unicode_literals import logging import os import sys import requests import xmltodict ...
StarcoderdataPython
9632544
from datetime import timedelta import t try: from cStringIO import StringIO except ImportError: from io import StringIO import logging from gunicorn.config import Config from gunicorn.instrument.statsd import Statsd class TestException(Exception): pass class MockSocket(object): "Pretend to be a UDP s...
StarcoderdataPython
1684977
"""Challenge is to create a basic calculator that will add any two numbers together incl decimals""" num1 = input("Enter your first number: ") num2 = input("Enter your second number: ") result = float(num1) + float(num2) print(result)
StarcoderdataPython
6604639
<reponame>SkanderGar/QuantMacro import numpy as np from scipy.stats import norm from numpy import vectorize @vectorize def U1(C, C_): if C <= 0: U = -np.inf else: U = -(1/2)*(C-C_)**2 return U @vectorize def U2(C, S): if C <= 0: U = -np.inf else: U ...
StarcoderdataPython
9792708
import torch from torch_sparse import SparseTensor from torch_geometric.nn import FiLMConv def test_film_conv(): x1 = torch.randn(4, 4) x2 = torch.randn(2, 16) edge_index = torch.tensor([[0, 1, 1, 2, 2, 3], [0, 0, 1, 0, 1, 1]]) edge_type = torch.tensor([0, 1, 1, 0, 0, 1]) row, col = edge_index ...
StarcoderdataPython
283416
<filename>src/gamma_5_gev_normal/job.py #!/usr/bin/env python import sys, string, os, re ; # This script depends on Gleam package # It must be run whenever the generation # process or the digis format change. # The result is used by CalRecon/src/test/validate.py. #================================================= # g...
StarcoderdataPython
1872839
<gh_stars>0 """A collection of utility methods used by CCBB at UCSD This project aggregates a collection of python-language utility methods developed to support the work of the Center for Computational Biology and Bioinformatics at the University of California at San Diego. """ # Much of the content of this file is c...
StarcoderdataPython
9712867
"""This module contains classes that convert restrictions to manageable objects.""" import yaml from odfuzz.exceptions import RestrictionsError from odfuzz.constants import EXCLUDE, INCLUDE, DRAFT_OBJECTS, QUERY_OPTIONS, FORBID_OPTION, VALUE class RestrictionsGroup: """A wrapper that holds a reference for all t...
StarcoderdataPython
113689
<filename>reveries/common/maya_shader_export/ramp.py<gh_stars>1-10 BASIS_MAPPING = { 1: 'linear' } class RampSampler(object): def __init__(self, node_name): import maya.cmds as cmds import maya.api.OpenMaya as om self.key_number = None self.keys_list = [] self.color_li...
StarcoderdataPython
6655363
#!/usr/bin/python3 import Circle import configparser import math import random import sys # does a test circle intersect with a list of circles, with a given 'cushion' def intersect(test, circles, cushion): for circle in circles: if test.intersect(circle, cushion): return True return Fals...
StarcoderdataPython
255002
#!/usr/bin/env python3 import sys def ints(itr): return [int(i) for i in itr] with open(sys.argv[1], "r") as f: lines = [l for l in f.read().split("\n") if l] ilist = [] imap = {} total = 0 result = 0 other = 0 while True: x = 0 y = 0 rot = 90 for l in lines: a = l[0] v =...
StarcoderdataPython
5063464
from .interfaces.icustompropertymanager import ICustomPropertyManager from .enums.enum_types import CustomInfoType from .enums.enum_options import CustomPropertyAddOption from .enums.enum_results import ( CustomInfoAddResult, CustomInfoDeleteResult, CustomInfoGetResult, ) class CustomPropertyManager(ICust...
StarcoderdataPython
3264472
#-*- coding:utf-8 -*- class DAG: def __init__(self, sentence, Trie): # self.dag = {Nd1:[nextNd1, nextNd2, ...], ...} self.dag = {} self.dict = Trie self.build(sentence) def build(self, sentence: str): """build DAG with given sentence Args: ...
StarcoderdataPython
9727227
# -*- coding: utf-8 -*- # Copyright (c) 2018 OpenStack Foundation # # 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 app...
StarcoderdataPython
35933
############################################################################## # # Copyright (c) 2009 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
StarcoderdataPython
264684
<filename>eclipse-mosquitto/test/broker/02-subpub-qos2-bad-puback-1.py<gh_stars>1-10 #!/usr/bin/env python3 # Test what the broker does if receiving a PUBACK in response to a QoS 2 PUBLISH. from mosq_test_helper import * def helper(port, proto_ver): connect_packet = mosq_test.gen_connect("helper", keepalive=60, ...
StarcoderdataPython
6578674
""" Script to calculate Freight Reliability Metric per ODOT Guidance. By <NAME>, Metro, <EMAIL> NOTE: SCRIPT RELIES ON PANDAS v.0.23.0 OR GREATER! Usage: >>>python lottr_truck.py """ import os import pandas as pd import numpy as np import datetime as dt def calc_freight_reliability(df_rel): """ Calculates ...
StarcoderdataPython
6631091
import cv2 import random # from threading import Timer class Splatter: def __init__(self, topleft, bottomright, color=None): imgnum = str(random.randint(1,8)) self.outline = cv2.imread(str('splatter-'+imgnum+'.png'), -1) self.outline = cv2.resize(self.outline, (bottomright[0]-topleft[0], b...
StarcoderdataPython
1723209
<filename>output/models/ms_data/regex/re_s15_xsd/__init__.py<gh_stars>1-10 from output.models.ms_data.regex.re_s15_xsd.re_s15 import ( Regex, Doc, ) __all__ = [ "Regex", "Doc", ]
StarcoderdataPython
6674048
import numpy as np from finitewave.core.fibrosis import FibrosisPattern class ScarRect2DPattern(FibrosisPattern): def __init__(self, x1, x2, y1, y2): self.x1 = x1 self.x2 = x2 self.y1 = y1 self.y2 = y2 def generate(self, size, mesh=None): if mesh is None: ...
StarcoderdataPython
6404932
<gh_stars>10-100 '''Contains DSrule classes for DateSense package.''' from .DStoken import DStoken # Rules are where the real fun happens with date format detection. Please # feel free to implement your own! The only strictly necessary component # of a DSrule class is that it has an apply(self, options) method # ...
StarcoderdataPython
8076475
<reponame>hahnah/uncrowded-cafe-backend import os import requests import flask def place_details(request): """Responds to any HTTP request. Args: request (flask.Request): HTTP request object. Returns: The response text or any set of values that can be turned into a Response object ...
StarcoderdataPython
8058313
import _sk_fail; _sk_fail._("sre_constants")
StarcoderdataPython
3362188
<gh_stars>1-10 from jedi._compatibility import unicode from jedi.inference.compiled.value import CompiledObject, CompiledName, \ CompiledObjectFilter, CompiledValueName, create_from_access_path from jedi.inference.base_value import ValueWrapper, LazyValueWrapper def builtin_from_name(inference_state, string): ...
StarcoderdataPython
3341623
from django.apps import AppConfig class CsoneConfig(AppConfig): name = 'csone'
StarcoderdataPython
1709155
<gh_stars>0 FIRST_PHOTO_URL = "https://mars.nasa.gov/msl-raw-images/proj/msl/redops/ods/surface/sol/03418/opgs/edr/ncam/NLB_700915024EDR_F0933240CCAM03417M_.JPG" TEST_RESP = {"photos": [ { "id": 948763, "sol": 3418, "camera": { "id": 26, "...
StarcoderdataPython
6659314
<filename>src/models/example/model_example.py # coding: utf-8 from pydantic import BaseModel, validator from typing import List, Optional from .args import ExampleArgs from .. import validators from ..model_type_enum import ModelTypeEnum from ...lib.enums import AppTypeEnum class ModelExample(BaseModel): id: str ...
StarcoderdataPython
1678379
import os import time from contextlib import contextmanager from django_webtest import WebTest from evap.evaluation.tests.tools import WebTestWith200Check from evap.staff.tools import ImportType, generate_import_filename def helper_enter_staff_mode(webtest): # This is a bit complicated in WebTest # See htt...
StarcoderdataPython
242635
<filename>src/txt2xls/function/builtin/unite_function.py # coding=utf-8 """ """ __author__ = 'Alisue <<EMAIL>>' import os def default_unite_function(data): """ A default unite_function which recieve `data` and return filename without middle extensions >>> # [<filename>] is mimicking `data` >>> def...
StarcoderdataPython
5011685
from . import Model from api.validator import UserValidator users = [] class UserModel(Model): def __init__(self, user=None, is_admin=0): super(UserModel, self).__init__(item=user, list_of_items=users) # Remains 0 for default user self.isAdmin = is_admin def user_is_admin(self): ...
StarcoderdataPython
11365674
<gh_stars>1-10 ######################################### # Custom Large Font for HD44780 Displays ######################################### class HD44780_Large_Font: def __init__(self, lcd): self.lcd = lcd self.lt = 255 ast_lt_template = ( 0b00000, 0b00000...
StarcoderdataPython
4878688
<reponame>aliced187/alice-and-charlie from floodsystem.stationdata import build_station_list, update_water_levels from floodsystem.datafetcher import fetch_measure_levels from floodsystem.stationdata import build_station_list from floodsystem.flood import stations_level_over_threshold def run(): stations = build_s...
StarcoderdataPython
4928323
<reponame>fengli12321/FLMusicServer<gh_stars>1-10 # Generated by Django 2.1.5 on 2019-01-24 16:18 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('musics', '0002_music_lyric'), ] operations = [ migrations.AlterField( model_na...
StarcoderdataPython
212365
<filename>src/pycode.py import sys import time import threading from threading import Thread def add(a,b): try: print(str(int(a)+int(b))) except ValueError: print(str(float(a)+float(b))) sys.stdout.flush() def sub(a,b): try: print(str(int(a)-int(b))) except ValueError: print(str(float(a)-float(b))) sys...
StarcoderdataPython
6660164
#!/usr/bin/python3 class Statistic: def __init__(self): self.min = None self.max = None self.sum = 0 self.cnt = 0 def clear(self): self.min = None self.max = None self.sum = 0 self.cnt = 0 def sample(self, value): self.min = min(sel...
StarcoderdataPython
42803
<gh_stars>1-10 import bitstring # Bech32 spits out array of 5-bit values. Shim here. def u5_to_bitarray(arr): ret = bitstring.BitArray() for a in arr: ret += bitstring.pack("uint:5", a) return ret # Map of classical and witness address prefixes base58_prefix_map = { 'bc' : (0, 5), 'tb' ...
StarcoderdataPython
199949
<filename>stubs.min/Autodesk/Revit/DB/__init___parts/ViewDisplaySketchyLines.py class ViewDisplaySketchyLines(object,IDisposable): """ Represents the settings for sketchy lines. """ def Dispose(self): """ Dispose(self: ViewDisplaySketchyLines) """ pass def ReleaseUnmanagedResources(self,*args): """ Relea...
StarcoderdataPython
1865129
<filename>lettersmith/path.py from urllib.parse import urlparse, urljoin from pathlib import Path, PurePath from os import sep, listdir, path, walk import re _STRANGE_CHARS = "[](){}<>:^&%$#@!'\"|*~`," STRANGE_CHAR_PATTERN = "[{}]".format(re.escape(_STRANGE_CHARS)) def space_to_dash(text): """Replace spaces wit...
StarcoderdataPython
6407160
<gh_stars>1-10 #! /usr/bin/env python3 from pathlib import Path from typing import List import ros_metrics_reporter.coverage.run_lcov as run_lcov class CoverageAll: def __init__( self, output_dir: Path, base_dir: Path, lcovrc: Path, exclude: List[str] ): self.__output_lcov_dir = output_dir /...
StarcoderdataPython
143942
<reponame>mm40/pudb import collections import pytest # noqa: F401 from pudb.py3compat import builtins from pudb.settings import load_breakpoints, save_breakpoints def test_load_breakpoints(mocker): fake_data = ["b /home/user/test.py:41"], ["b /home/user/test.py:50"] mock_open = mocker.mock_open() mock_...
StarcoderdataPython
5050894
import scrapy from scrapy.utils.project import get_project_settings from acaSpider.items import AcaspiderItem import logging import re import datetime from acaSpider.proxyDownloader import getProxy class ACMSpider(scrapy.Spider): name = "ACM_Spider" allowed_domains = ["dl.acm.org"] start_urls = get_projec...
StarcoderdataPython
6429388
<filename>projecteuler/6.py #project euler problem 6 #author : itsjaysuthar def sq(n): return n * n sum1 = 0 sum2 = 0 for i in range(1, 101): sum2 = sum2 + sq(i) for i in range(1, 101): sum1 = sum1 + i print(sq(sum1) - sum2)
StarcoderdataPython
6613772
import os from flask import redirect from get_ip import get_ip from scan import load_services, check_local_services, check_network_machines from dbmodel import Users, Properties, Services, app, db from components.base.content_endpoints import debug, root, logout, login, scan_network, get_machines_service from compon...
StarcoderdataPython
3456946
<reponame>idrisr/chessocrnb from setuptools import setup, find_packages setup( name='chessocr', version='0.0.1', description='chess board finder', author='idrisr', author_email='<EMAIL>', keywords=['chess', 'ocr'], # entry_points={'console_scripts': ['kaggle = kaggle.cli:main']}, insta...
StarcoderdataPython
9776753
<reponame>Kartones/PythonAssorted from doublex import * from expects import * from doublex_expects import * from player import * # for constants only from character import * with description("Player"): with before.each: with Stub() as self.position: self.position.current_position().returns(0...
StarcoderdataPython
3280190
<reponame>mathieurodic/hamsterdb # # Copyright (C) 2005-2015 <NAME> (<EMAIL>). # # 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
11251756
<filename>translate.py<gh_stars>0 #!/usr/bin/env python3 try: import argparse import sys import pandas as pd except ImportError as e: sys.exit("Error: " + str(e) + "\nPlease install this module and retry.\n") '''Basic setup stuff Take 2 arguments: infile : Input CSV file to be parsed ...
StarcoderdataPython
231460
<reponame>skepickle/roll20-discord-bot #import time #import shutil #import re import os import sys import getopt import discord from discord.ext import commands import asyncio import roll20bridge #import roll20sheet import json if __name__ != "__main__": print("ERROR: bot.py must be executed as the top-level cod...
StarcoderdataPython
8142554
""" Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
StarcoderdataPython
6622513
from geopy.geocoders import Nominatim geolocator = Nominatim(user_agent="wazeyes") endereco=input("Digite um endereco com número e cidade. ") resultado = str(geolocator.geocode(endereco)).split(",") if resultado[0]!='None': print("Endereço completo.: ", resultado) print("Bairro............: ", resultado[1]) ...
StarcoderdataPython
11259146
<gh_stars>1-10 import numpy as np import pymysql as pms class oraDataFrame(object): def __init__(self): self.db = self.connectSQL() self.cursor = self.db.cursor() def connectSQL(self): db = pms.Connect("localhost", "root", "Zhang715", "BCW") return db def createPriorityTa...
StarcoderdataPython
1826329
from mycloud.drive.drive_client import DriveClient, NO_ENTRY, ROOT_ENTRY, EntryStats, EntryType from mycloud.drive.exceptions import DriveNotFoundException, DriveFailedToDeleteException from mycloud.drive.fs_drive_client import FsDriveClient from mycloud.drive.common import ls_files_recursively
StarcoderdataPython
9693120
<reponame>bmmalone/as-auto-sklearn<gh_stars>1-10 #! /usr/bin/env python3 import argparse import itertools import os import pandas as pd import misc.automl_utils as automl_utils import misc.parallel as parallel import as_asl.as_asl_command_line_utils as clu import as_asl.as_asl_filenames as filenames import as_asl.a...
StarcoderdataPython
4898690
import numpy as np import smdebug import torch import torch.nn as nn import torchvision from smdebug import modes from torchvision import models # list of ordered tensor names activation_outputs = [ #'relu_ReLU_output_0', "layer1.0.relu_0_output_0", "layer1.1.relu_0_output_0", "layer2.0.relu_0_output_0...
StarcoderdataPython
6445146
""" Tests for query_schedule module. """ from os import sys, path import unittest import pytz import datetime import logging import random from api_etl.settings import __BASE_DIR__ from api_etl.extract_schedule import build_stop_times_ext_df from api_etl.query_schedule import trip_scheduled_departure_time logger = l...
StarcoderdataPython
6562663
<filename>frontends/pytorch/python/torch_mlir/torchscript/e2e_test/configs/native_torch.py<gh_stars>0 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception import copy from...
StarcoderdataPython
42109
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Unit test for status""" import sys import unittest from os.path import dirname, realpath from pm.status import Y, Conserved, PM, NA class RoutineTest(unittest.TestCase): """Routine test.""" def test_pm_status_gt_order(self): """Status should have a r...
StarcoderdataPython
1652184
from src.log import set_logging from src import buienradar import logging from datetime import datetime from src import export def run(): actuals, forecast = buienradar.get_data() export.export_datasets(actuals, forecast) if __name__ == "__main__": set_logging() logging.info(f"started script at {da...
StarcoderdataPython
1679352
<reponame>wangdehuaj/jyrm<gh_stars>1-10 #!/usr/bin/env python # -*- coding: us-ascii -*- import wx import string from options import AdvancedOptions from message import Message try: from opentumblr.tumblr import Api except ImportError: from tumblr import Api class Link(wx.Panel): def __init__(self, pare...
StarcoderdataPython
8066099
<gh_stars>1-10 import setuptools with open('README.md', 'r') as fh: long_description = fh.read() setuptools.setup( name='python-digitalocean-ssh', version='0.0.8', author='<NAME>', author_email='<EMAIL>', description='Combine DO droplets with your ssh configuration', long_description=long_...
StarcoderdataPython
11328513
<filename>pystacia/api/func.py # coding: utf-8 # pystacia/api/func.py # Copyright (C) 2011-2012 by <NAME> # This module is part of Pystacia and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php from threading import Lock from six import b as bytes_, text_type from pystacia.uti...
StarcoderdataPython
6562854
from . import Project from .nodejs import NodejsProject from ..util import needs_update from ..tmux import Tmux class LaravelProject(Project): description = 'Laravel' def __init__(self, cwd): super().__init__(cwd) if self.exists('package.json'): self.npm = NodejsProject(cwd) ...
StarcoderdataPython
209852
<filename>pushservice/src/Services/SMTP.py from __future__ import print_function from __future__ import absolute_import ####################################################################### # # Push Service for Enigma-2 # Coded by betonme (c) 2012 <<EMAIL>ank(at)gmail.com> # Support: http://www.i-have-a-drea...
StarcoderdataPython
3291838
<reponame>OpenSCAP/oval-graph import json import subprocess import time from ..test_tools import TestTools from .command_constants import ARF_TO_JSON, COMMAND_START, TEST_ARF_XML_PATH def run_commad_and_save_output_to_file(parameters): path = str(TestTools.get_random_path_in_tmp()) + '.json' with open(path, ...
StarcoderdataPython
6494198
<reponame>Argmaster/pygerber # -*- coding: utf-8 -*- from __future__ import annotations from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from pygerber.drawing_state import DrawingState from pygerber.constants import Unit from pygerber.tokens import token as tkn from .validator import Validator INCH_TO_M...
StarcoderdataPython
4950129
<reponame>jaredleekatzman/sagemaker-python-sdk # Copyright 2017-2018 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. A copy of # the License is located at # # http://aws.am...
StarcoderdataPython
311028
<filename>suburbs.py import json import requests def getSuburbs(): settings = json.load(open("settings.json")) url = "https://v0.postcodeapi.com.au/suburbs?name="+settings["suburb"]+"&postcode="+settings["postcode"]+"&state="+settings["state"] payload={} headers = { 'Accept': 'application/j...
StarcoderdataPython
3425194
<reponame>ViaTechSystems/encrypted-model-fields from __future__ import unicode_literals from django.test import TestCase from django.core.exceptions import ImproperlyConfigured import cryptography.fernet from . import fields class TestSettings(TestCase): def setUp(self): self.key1 = cryptography.fernet...
StarcoderdataPython
6649648
<reponame>mgrover1/intake-esm-datastore import os import click import numpy as np import requests from core import Builder, extract_attr_with_regex, get_asset_list, reverse_filename_format def cmip6_parser(filepath): """ Extract attributes of a file using information from CMI6 DRS. References CMIP6 ...
StarcoderdataPython
4858273
import unittest import numpy as np import torch from Utility.Torch import Glimpses class testView(unittest.TestCase): def testBasic(self): """ Tests whether view works """ test_tensor = torch.randn([20, 30, 10]) Glimpses.reshape(test_tensor, 10, [5, 2]) Glimpses.reshape(test_tenso...
StarcoderdataPython