id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
108099
import json import logging from datetime import datetime, timedelta import pymongo from ecn import StationKind, PPTIK_GRAVITY, StationState class StationaryV1Handler: logger = logging.getLogger(__name__) SAMPLE_RATE = 40 def __init__(self, db: pymongo.database.Database): self.db: pymongo.databa...
StarcoderdataPython
1640217
<reponame>raghuraju/tango-with-django-110 """ Django settings for tango_with_django project. Generated by 'django-admin startproject' using Django 1.10.1. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.dj...
StarcoderdataPython
3391184
import colored import functools blue = functools.partial(colored.stylize, styles=colored.fore.BLUE) green = functools.partial(colored.stylize, styles=colored.fore.GREEN) red = functools.partial(colored.stylize, styles=colored.fore.RED) print(blue("This is blue")) print(green("This is green")) print(red("This is red...
StarcoderdataPython
3261235
<filename>chess_1.py ''' 8 ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜ 7 ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟ 6 5 4 3 2 ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙ 1 ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖ a b c d e f g h ''' board = [ '♜', '♞', '♝', '♛', '♚', '♝', '♞', '♜', '♟', '♟', '♟', '♟', '♟', '♟', '♟', '♟', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '...
StarcoderdataPython
66198
<reponame>lunaisnotaboy/oasisclosed from lxml import html # Todo: move all requests to using requests instead of urllib3 import urllib.request, urllib.error import requests from lxml import etree from random import choice import json import time import os.path from PIL import Image, ExifTags, ImageFile from datetime im...
StarcoderdataPython
3312246
<reponame>swasthikshetty10/EPAX-AI from django.urls import path from . import views urlpatterns = [ path('', views.home, name='home'), path('response/<str:content>', views.response, name='response'), path('userdata/', views.userdata, name='userdata'), path('sendnotes/<str:title>/<str:notes>/', ...
StarcoderdataPython
3302820
<gh_stars>0 # -*- coding: utf-8 -*- """ Bencode encoding code by <NAME>, slightly simplified by uriel, additionally modified by <NAME> """ from itertools import chain def bencode(x): r = [] if isinstance(x, (int, bool)): r.extend(('i', str(x), 'e')) elif isinstance(x, str): r.extend((str(...
StarcoderdataPython
1719041
import sys sys.path.insert(0, '/Users/swehr/devel/libPyshell/src/') from shell import * import json import pathlib import snoozeDb import time import timeSuggest import inputDateTime thisDir = pathlib.Path(__file__).parent.absolute() scriptPath = os.path.join(thisDir, 'mail.js') def abort(msg): sys.stderr.write...
StarcoderdataPython
1735027
#{{{ Marathon from default import * #}}} Marathon def test(): set_java_recorded_version("1.8.0_271") if window('My Java Http Server-[Stopped]'): select('Server listening on port', '8082') click('...') if window('Select root directory'): select('JFileChooser_0', '#C/jruby-p...
StarcoderdataPython
30196
<reponame>Snufkin0866/btc_bot_framework import json from urllib.parse import urlencode import requests from bs4 import BeautifulSoup from .api import BitflyerApi class BitflyerApiWithWebOrder(BitflyerApi): def __init__(self, ccxt, login_id, password, account_id, device_id=None, device_token=Non...
StarcoderdataPython
3389203
from pathlib import Path from scipy.interpolate import interp1d import numpy as np from msdsl.rf import s4p_to_step THIS_DIR = Path(__file__).resolve().parent TOP_DIR = THIS_DIR.parent.parent COMPARISON_FILE = 'peters_01_0605_B1_thru.s4p' COMPARISON_TOVER = 0.1e-12 COMPARISON_TDUR = 10e-9 COMPARISON_XDATA = [ ...
StarcoderdataPython
95313
<reponame>jenuk/imagenet_metaclasses import os # change path to imagenet folder here # expect structure like: # ILSVRC/ # ├─ ILSVRC2012_train/ # │ ├─ data/ # │ │ ├─ n02643566/ # │ │ │ ├─ n02643566_ID.JPEG # │ │ │ ├─ ... .JPEG # │ │ ├─ n.../ # │ ├─ other_folder/ # │ ├─ other_files # ├─ ILSVRC2012...
StarcoderdataPython
1791595
# I. С<NAME> # ID успешной посылки 65303331 import math def is_power_of_four(number: int) -> bool: log = math.log(number, 4) if int(log * 100) % 100 == 0: return 'True' else: return 'False' print(is_power_of_four(int(input())))
StarcoderdataPython
68996
<gh_stars>1-10 import math with open("error_collection") as f: data = eval(f.read()) def find_erdst(x1, y1, x2, y2): return math.sqrt( (x1-x2)**2 + (y1 - y2) ** 2) error_distance = 0 for i in data: error_distance += find_erdst(*i) print float(error_distance) / len(data)
StarcoderdataPython
3328259
<reponame>tomjshine/pynet #!/usr/share/env python from ciscoconfparse import CiscoConfParse conf = CiscoConfParse("cisco_ipsec.txt") crypto = conf.find_objects(r"crypto map CRYPTO") #print crypto print "\nCRYPTO MAPS:" for c in crypto: print "!\n" + c.text for chil in c.children: print chil.text ...
StarcoderdataPython
3286604
<gh_stars>0 # coding=utf-8 import heapq from collections import deque from itertools import izip import random class LifoList(deque): '''List that pops from the end.''' def sorted(self): return list(self)[::-1] class FifoList(deque): '''List that pops from the beginning.''' def pop(self): ...
StarcoderdataPython
3215990
# -*- coding: utf-8 -*- from __future__ import division, unicode_literals import os from . import updateBackRefs from . import updateCrossRefs from . import updateBiblio from . import updateCanIUse from . import updateLinkDefaults from . import updateTestSuites from . import updateLanguages from . import updateWpt fr...
StarcoderdataPython
1628190
<filename>camera_images_cleaning/plot_cleaned_images.py import photon_stream as ps from fact.plotting import camera, mark_pixel import numpy as np from fact.instrument.camera import get_neighbor_matrix, get_border_pixel_mask import matplotlib.pyplot as plt from matplotlib.patches import Ellipse from matplotlib.backends...
StarcoderdataPython
1682030
<reponame>raphaelavalos/ray import pytest import time import yaml import tempfile import shutil import unittest import ray from ray.tests.test_autoscaler import SMALL_CLUSTER, MockProvider, \ MockProcessRunner from ray.autoscaler.autoscaler import StandardAutoscaler from ray.autoscaler.load_metrics import LoadMetr...
StarcoderdataPython
3252894
<gh_stars>1000+ #!/usr/bin/python # Author : n0fate # E-Mail <EMAIL>, <EMAIL> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at # your option) any later ...
StarcoderdataPython
97226
# -*- coding: utf-8 -*- """ Created on Mon Apr 23 12:31:50 2018 @author: <NAME> """ from QChemTool import Structure from QChemTool.Development.polarizablesytem_periodic import PolarizableSystem from QChemTool import energy_units from QChemTool.QuantumChem.Fluorographene.fluorographene import orientFG import ...
StarcoderdataPython
137341
<gh_stars>0 import pygsl import pygsl._numobj as numx import pygsl.rng import pygsl.multifit def calculate(x, y, sigma): n = len(x) X = numx.ones((n,3),)*1. X[:,0] = 1.0 X[:,1] = x X[:,2] = x ** 2 w = 1.0 / sigma ** 2 work = pygsl.multifit.linear_workspace(n,3) c, cov, chisq = pygsl.mul...
StarcoderdataPython
3203338
<filename>_netcat.py """ """ import socket import sys import getopt import threading import subprocess import getpass from textwrap import dedent from typing import Tuple, Union, List class Helpers: """Static functions, to use as helpers""" @staticmethod def send_data(to_socket: socket....
StarcoderdataPython
1729827
<reponame>nishp77/thenewboston-node import logging from dataclasses import dataclass, field from datetime import datetime from typing import Any, Optional, Type, TypeVar from thenewboston_node.business_logic.models import AccountState from thenewboston_node.business_logic.models.base import BaseDataclass from thenewbo...
StarcoderdataPython
1699763
from .fixtures import * from tenable.errors import * @pytest.fixture def targetgroup(request, api): group = api.target_groups.create(str(uuid.uuid4()), ['192.168.0.1']) def teardown(): try: api.target_groups.delete(group['id']) except NotFoundError: pass request.addf...
StarcoderdataPython
1694621
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ##...
StarcoderdataPython
4821514
import math a1 = float(input('Digite o Ângulo: ')) s = math.sin(math.radians(a1)) c = math.cos(math.radians(a1)) t = math.tan(math.radians(a1)) print('\n O seno é {:.2f} \n O cosseno é {:.2f} \n A tangente é `{:.2f}'.format(s,c,t))
StarcoderdataPython
3382563
#!/usr/bin/env python3.7 import uuid from ton import generate_addr import sys print(generate_addr(str(uuid.uuid4().hex), sys.argv[1]))
StarcoderdataPython
3203688
#!/usr/bin/python3 import pytest @pytest.fixture(scope="function", autouse=True) def isolate(fn_isolation): # perform a chain rewind after completing each test, to ensure proper isolation # https://eth-brownie.readthedocs.io/en/v1.10.3/tests-pytest-intro.html#isolation-fixtures pass @pytest.fixture(sco...
StarcoderdataPython
3262028
<reponame>nl2go/hetzner-invoice search_duplicate = ( "SELECT * FROM invoices WHERE type = %s AND description = %s AND id " "= %s AND invoice_nr = %s " ) update_record = ( "UPDATE invoices SET start_date = %s, end_date = %s, quantity = %s, price= %s, last_updated " "= %s WHERE type = %s AND description =...
StarcoderdataPython
1630771
<filename>src/bin/shipyard_airflow/tests/unit/plugins/test_get_k8s_logs.py<gh_stars>10-100 # Copyright 2018 AT&T Intellectual Property. All other 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 co...
StarcoderdataPython
1754610
import fileinput CRABS = [int(x) for x in fileinput.input()[0].split(',')] part_1 = part_2 = 10000000000000 for pos in range(max(CRABS) + 1): part_1_fuel = 0 part_2_fuel = 0 for c in CRABS: part_1_fuel += abs(pos - c) delta = abs(pos - c) part_2_fuel += ((delta + 1) * delta) //...
StarcoderdataPython
4824057
<gh_stars>0 import numpy as np import pandas as pd import tensorflow as tf import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers.core import Dense, Activation from keras.layers.recurrent import LSTM from keras.layers import Dropout df = pd.read_csv('data/elec_load.csv', error_bad_lines...
StarcoderdataPython
60915
def minesweeper(matrix): row = len(matrix) col = len(matrix[0]) def neighbouring_squares(i, j): return sum( matrix[x][y] for x in range(i - 1, i + 2) if 0 <= x < row for y in range(j - 1, j + 2) if 0 <= y < col if i != x or j !...
StarcoderdataPython
3311541
# -*- coding: utf-8 -*- """ # Idle/Jupyter Startup File Defines functions for use in `IDLE`, but so far they seem to work in `python3`, `iPython`, `IDLE`, and `jupyter`. They WON'T work in Python 2! Hopefully this won't cause problems when PYTHONSTARTUP is set to this file's path, but it may very well...
StarcoderdataPython
1656973
sounds = ["super", "cali", "fragil", "istic", "expi", "ali", "docious"] result = '' for fragment in sounds: result += fragment result = result.upper() print(result)
StarcoderdataPython
1714965
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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...
StarcoderdataPython
155230
<filename>example/migrations/0004_imagen.py<gh_stars>0 # Generated by Django 2.2.1 on 2019-10-21 03:24 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('example', '0003_example2'), ] operations = [ migrations....
StarcoderdataPython
3277955
<reponame>JoaoPauloPereirax/Python-Study ''' Escreva um programa que leia um número inteiro qualquer e peça para o usuário escolher qual será a base de conversão: 1. para binário 2. para octal 3. para hexadecimal ===Etapas=== 1. Pedir para digitar um número e guardar o valor em uma variável. 2. Pedir para ...
StarcoderdataPython
3358920
from asyncio import CancelledError from typing import Any, Coroutine, Union class BaseHooks: """ Interface for implementation of hooks. """ def on_apply_for(self, coro: Coroutine[Any, Any, Any], ident: str) -> None: """ Calls when ``async_reduce`` apply to coroutine. """ ...
StarcoderdataPython
3223691
<filename>caiyun/caiyun.py # -*- coding: utf-8 -*- import base64 import json import os import re from urllib import parse import requests from requests import utils import rsa class CaiYunCheckIn: def __init__(self, check_item): self.check_item = check_item self.public_key = """-----<KEY>""" ...
StarcoderdataPython
36937
<filename>ferris/controllers/oauth.py from __future__ import absolute_import from google.appengine.ext import ndb from ferris.core.controller import Controller, route, route_with from oauth2client.client import OAuth2WebServerFlow from ferris.core.oauth2.user_credentials import UserCredentials as OAuth2UserCredentials ...
StarcoderdataPython
1758974
from setuptools import setup, find_packages with open("README.md", "r") as fh: long_desc = fh.read() setup( name='sshepherd', version="0.2", packages=["sshepherd"], package_dir={'': "src"}, scripts=['scripts/sshepherd'], author="George", author_email="<EMAIL>", description="SSHephe...
StarcoderdataPython
3304766
import numpy as np import time from greensconvolution.greensconvolution_fast import greensconvolution_integrate from greensconvolution.greensconvolution_fast import greensconvolution_greensfcn_curved from greensconvolution.greensconvolution_calc import read_greensconvolution gc_kernel="opencl_interpolator" # greensco...
StarcoderdataPython
142453
""" Multi-device matrix multiplication using parla with cupy as the kernel engine. """ import sys import time import numpy as np import cupy as cp from parla import Parla, get_all_devices from parla.array import copy, clone_here from parla.cpu import cpu from parla.cuda import gpu from parla.function_decorators impo...
StarcoderdataPython
3260835
<reponame>gschivley/pg_misc<filename>create_clusters/least_cost_path.py from typing import List, Union import numpy as np import rasterio import rasterio.features from affine import Affine from shapely.geometry import shape, box from skimage.graph import MCP_Geometric from skimage.graph import _mcp import geopandas as ...
StarcoderdataPython
3398393
import torch.nn as nn from typing import Sequence, MutableSequence from __types import Module, Loader, CustomLayerTypes, CustomLayerSuperclasses, Tensor, ModuleType, Shape, Any from model.execution import Trainer from model.execution import dry_run # assumes that any nested submodules have already had their shape i...
StarcoderdataPython
3294287
<filename>tests/Exscript/protocols/OsGuesserTest.py<gh_stars>0 import sys import unittest import re import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..')) from Exscript.protocols.osguesser import OsGuesser from Exscript.protocols import drivers class OsGuesserTest(unittest.TestCase):...
StarcoderdataPython
3376464
<gh_stars>1-10 #!/usr/bin/env python3 import argparse import os from yaml import safe_load, dump def setupArgs(): parser = argparse.ArgumentParser(description='Fix permalinks to be hierarchical in directory') parser.add_argument('directory', type=str, help='Directory to recursively fix...
StarcoderdataPython
169471
#%% import os import pandas as pd import numpy as np import copy from tqdm import tqdm from plot import plot from utils.evaluator import evaluate, set_thresholds from utils.evaluator_seg import compute_anomaly_scores, compute_metrics # Univariate from utils.data_loader import load_kpi, load_IoT_fridge # Multivariate ...
StarcoderdataPython
3281687
from dataclasses import dataclass from bindings.gmd.ellipsoid_property_type import EllipsoidPropertyType __NAMESPACE__ = "http://www.opengis.net/gml" @dataclass class UsesEllipsoid(EllipsoidPropertyType): class Meta: name = "usesEllipsoid" namespace = "http://www.opengis.net/gml"
StarcoderdataPython
1770250
<reponame>vivian-dai/Competitive-Programming-Code<gh_stars>0 with open("Advent of Code/2021/Day 1/input.txt") as inp: content = list(map(int, inp.read().splitlines())) out = 0 for i in range(1, len(content)): if content[i] > content[i - 1]: out += 1 print(out)
StarcoderdataPython
1633079
from .alerts import Alerts class ToolsNotifications: def __init__(self, logger, ifttt_alerts): self._logger = logger self._ifttt_alerts = ifttt_alerts self._alerts = Alerts(self._logger) self._printer_was_printing_above_tool0_low = False # Variable used for tool0 cooling alerts self._printer_alerted_reac...
StarcoderdataPython
78899
from flask import current_app as app from flask_migrate import Migrate, migrate, upgrade, stamp, current from alembic.migration import MigrationContext from sqlalchemy import create_engine from sqlalchemy.engine.url import make_url from sqlalchemy_utils import ( database_exists as database_exists_util, create_d...
StarcoderdataPython
79886
from django.shortcuts import render, redirect from django.contrib.messages.views import SuccessMessageMixin from django.contrib.auth.views import LoginView, LogoutView from user.forms import UserRegisterForm from django.views.generic import CreateView class UserRegisterView(SuccessMessageMixin, CreateView): tem...
StarcoderdataPython
1606704
<filename>django_handy/objs.py<gh_stars>1-10 from operator import attrgetter from typing import Hashable, Iterable, List, Sized class classproperty: def __init__(self, method=None): self.fget = method def __get__(self, instance, cls=None): return self.fget(cls) def is_empty(val): """ ...
StarcoderdataPython
1707831
import torch from .Flatten import Flatten class CNNAutoencoder(torch.nn.Module): def __init__(self,input_size,hidden_size,conv_kernel,pool_kernel ,padding, stride=1,dilation=1, dropout=0.0,input_noise=0.0): super(CNNAutoencoder, self).__init__() self.num_layers=len(hidden_size) ...
StarcoderdataPython
3270672
#!/usr/bin/python2.7 """ Copyright (C) 2014 Reinventing Geospatial, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This ...
StarcoderdataPython
152091
def bestSum(t, arr, memo=None): """ m: target sum, t n: len(arr) time = O(n^m*m) space = O(m*m) [in each stack frame, I am storing an array, which in worst case would be m] // Memoized complexity time = O(n*m*m) space = O(m*m) """ if memo is None: memo = {} if t in memo: return memo[t] if t == 0: r...
StarcoderdataPython
4824612
# Copyright(C) 1999-2020 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provide...
StarcoderdataPython
1723309
<reponame>smak0v/planeks_news from django.contrib.auth.decorators import login_required from django.urls import path from .views import PostsListView, PostCreateView, PostDetailView, PostEditView urlpatterns = [ path('', PostsListView.as_view(), name='main'), path('create/', login_required(PostCreateView.as_v...
StarcoderdataPython
3319779
<gh_stars>0 # -*- coding: utf-8 -*- from enum import Enum from fastapi import APIRouter from fastapi import Path from fastapi import Query from starlette import status from starlette.requests import Request from starlette.responses import RedirectResponse from starlette.responses import Response router = APIRouter() ...
StarcoderdataPython
1773976
<gh_stars>10-100 # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function ''' .. _module_mc_inssserv: mc_inssserv / inssserv functions ================================== ''' # Import python libs import logging import mc_states.api __name ...
StarcoderdataPython
1687674
import winsound import cv2 import numpy as np learning_parameter = 0.005 def main(): cam = cv2.VideoCapture(0) sub_mog2 = cv2.createBackgroundSubtractorMOG2() while True: ret_val, img = cam.read() img = cv2.flip(img, 1) cv2.imshow('my webcam', img) img_gray = cv2.cvtColo...
StarcoderdataPython
1743602
<filename>PlotlyandPython/Lessons/(01) Intro to Python/Notebooks/Python Scripts/(04) Variable Types - Strings (2).py # coding: utf-8 # # Variable Types - Strings (2) # # In the last class we learnt how to create strings, how to convert between string, integers and floats using the <code>str()</code>, <code>int()</c...
StarcoderdataPython
3262038
<filename>app copy.py import os import glob import shutil # from creator import create from flask import Flask, send_from_directory, flash, request, redirect, url_for, render_template from werkzeug.utils import secure_filename from parser import parse_arguments from functions.transformer import get_transforms from fun...
StarcoderdataPython
73243
<gh_stars>100-1000 #!/usr/bin/env python from __future__ import print_function from fileinput import input from sgp4.vallado_cpp import Satrec def main(): lines = iter(input()) for line in lines: name = line line1 = next(lines) line2 = next(lines) sat = Satrec.twoline2rv(line1...
StarcoderdataPython
4813551
from django.core.validators import ValidationError from django.test import TestCase from ..validators import ExactLengthsValidator class ExactLengthsValidatorTestCase(TestCase): def test_validator_message(self): """ Validator returns corrrect error message. """ validator = ExactLe...
StarcoderdataPython
1626216
# Generated by Django 3.2.7 on 2022-03-23 14:59 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('gui', '0024_autofees'), ] operations = [ migrations.DeleteModel( name='Resolutions', ), migrations.DeleteModel( ...
StarcoderdataPython
53327
import pyjion import timeit from statistics import fmean def test_floats(n=10000): for y in range(n): x = 0.1 z = y * y + x - y x *= z def test_ints(n=10000): for y in range(n): x = 2 z = y * y + x - y x *= z if __name__ == "__main__": tests = (test_floa...
StarcoderdataPython
1757118
## https://leetcode.com/problems/battleships-in-a-board/ ## goal is to count the number of battleships in a board, ## under the condition that no battleships will ever touch. ## that means that any touching x's belong to the same ## battleship. my solution is to iterate over the board, ## so O(N). If i find a pa...
StarcoderdataPython
145387
from django.apps import AppConfig class AuthManagerConfig(AppConfig): name = 'auth_manager' verbose_name = 'auth manager' def ready(self): from . import signals
StarcoderdataPython
4810091
<reponame>lbolanos/aws-sfn-builder #!/usr/bin/env python # -*- coding: utf-8 -*- import codecs import os from setuptools import find_packages, setup def read(fname): file_path = os.path.join(os.path.dirname(__file__), fname) return codecs.open(file_path, encoding="utf-8").read() setup( name="aws-sfn-b...
StarcoderdataPython
3357610
class TeamReport(): def __init__(self, team_id): self.team_id = team_id self.release = "" self.issues = []
StarcoderdataPython
186375
import sys x = 0 y = 0 with open(sys.argv[1]) as f: instruct = f.read().strip().split(",") for c in instruct: if c == 'n': y += 2 elif c == 's': y -= 2 elif c == 'ne': x += 1 y += 1 elif c == 'nw': x -= 1 y ...
StarcoderdataPython
39464
#!/usr/bin/env python # SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 import os import shutil import sys import unittest from subprocess import STDOUT, run from test_utils import compare_folders, fill_sector, generate_local_folder_structure, generate_test_...
StarcoderdataPython
1713193
{ 'name': "ProPortal", 'summary': """ Portal Upgrade Module that adds Advanced Features""", 'description': """ Module that allows expands Customer Portal """, 'author': "<NAME>", # Categories can be used to filter modules in modules listing # Check https://github.com/odoo...
StarcoderdataPython
1683481
""" Shamefully copied from https://www.reddit.com/r/adventofcode/comments/7lte5z/2017_day_24_solutions/droyesm/ """ from collections import defaultdict def gen_bridges(library, bridge=None): l, s, components, a = bridge or (0, 0, set(), 0) for b in library[a]: next = (a, b) if a <= b else (b, a) ...
StarcoderdataPython
1640018
from setuptools import setup setup(name='requires_simple_extra', version='0.1', py_modules=['requires_simple_extra'], extras_require={ 'extra': ['simple==1.0'] } )
StarcoderdataPython
142419
try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='monotonic_cffi', version='0.1', license='Apache', author='<NAME>', author_email='<EMAIL>', url='https://github.com/rkyoto/monotonic_cffi', classifiers=( 'Development Status ...
StarcoderdataPython
1657513
<reponame>speedypotato/chuni-lite<filename>chunair/kicad-footprint-generator-master/KicadModTree/nodes/specialized/PolygoneLine.py<gh_stars>1-10 # KicadModTree is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published by # the Free Software Foundation, e...
StarcoderdataPython
1724555
<reponame>sunyunxian/test_lib """ 切片 """ info = "纽约 美国" CITY = slice(0, 2) print(CITY) print(dir(CITY)) print(info[CITY]) s = [1, 2, 3, 4, 5] s[0:1] = [10, 10] print(s)
StarcoderdataPython
85086
import pytest @pytest.fixture def checkup_html() -> str: return { "html": """<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Test Page Title</title> </head> <body> <a href="https://google.com/">Root domain link</a> <a href="https://google.com/1.html">Normal link 1</a> <a hr...
StarcoderdataPython
151272
<reponame>Jacqueline121/YOLOv2-pytorch from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import argparse import torch from torch.utils.data import DataLoader from dataset.factory import get_imdb from dataset.roidb import RoiDataset, detection_collate...
StarcoderdataPython
3212419
import sqlalchemy.exc import sqlalchemy.event from sqlalchemy.orm.query import Query from sqlalchemy.orm.session import Session from sqlalchemy.orm import ( joinedload ) from .db import Database from .schema import SchemaBase class DatabaseApi: def __init__(self, database: Database): self._database...
StarcoderdataPython
87200
<gh_stars>10-100 # Generated by Django 2.2.7 on 2019-11-22 21:27 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('reputat...
StarcoderdataPython
3302204
<filename>jovian-inputdata/download_raw_data.py<gh_stars>1-10 import sys import os import subprocess import datetime import yaml import json from pymongo import MongoClient FIRST_PATTERN = 'ftp.sra.ebi.ac.uk/vol1/' SECOND_PATTERN = 'ftp.dcc-private.ebi.ac.uk/vol1/' def main(): """ Main function that will pa...
StarcoderdataPython
5432
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # <NAME> # California Institute of Technology # (C) 2006-2010 All Rights Reserved # # {LicenseText} # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
StarcoderdataPython
20131
<gh_stars>1-10 """Word and pron extraction for (Mandarin) Chinese.""" import itertools import typing import requests from wikipron.extract.default import yield_pron, IPA_XPATH_SELECTOR if typing.TYPE_CHECKING: from wikipron.config import Config from wikipron.typing import Iterator, Word, Pron, WordPronPair...
StarcoderdataPython
124640
<reponame>DallogFheir/aoc-2020 # PART 1 def game_of_cups(starting_sequence,num_of_moves,min_cup=None,max_cup=None): # create a "linked list" dict cups = { starting_sequence[i] : starting_sequence[i+1] for i in range(len(starting_sequence)-1) } cups[starting_sequence[-1]] = starting_seque...
StarcoderdataPython
1763069
from flask import Flask, abort, jsonify, request, render_template from sklearn.externals import joblib import numpy as np import json # load pickle below lr = joblib.load('kiva_predictor.pkl') app = Flask(__name__) @app.route("/") def home(): return render_template("index.html") """ Index(['language_english', '...
StarcoderdataPython
3294815
<reponame>strange/django-country-utils from django.db import models from country_utils.fields import CountryField class Profile(models.Model): country1 = CountryField(blank=True) country2 = CountryField(blank=False, default='SE') country3 = CountryField(blank=False)
StarcoderdataPython
3396797
<reponame>AlecAivazis/python<gh_stars>1-10 # external imports import aiohttp_jinja2 # local imports from nautilus.network.http import RequestHandler class GraphiQLRequestHandler(RequestHandler): @aiohttp_jinja2.template('graphiql.html') async def get(self): # write the template to the client ...
StarcoderdataPython
3269998
<reponame>highfestiva/life from trabant import * #bus with wheels bus = create_box(side=(6,1.5,2)) rear_left = create_sphere(pos=(-3,+1,-1), radius=0.25) rear_right = create_sphere(pos=(-3,-1,-1), radius=0.25) front_left = create_sphere(pos=(+3,-1,-1), radius=0.25) front_right = create_sphere(pos=(+3,+1,-1), radi...
StarcoderdataPython
1673313
import requests import json import os from itertools import count blocklist = [ '0x06012c8cf97bead5deae237070f9587f8e7a266d' # cryptokitties ] def valid_hash(hash): if hash in blocklist: return False return hash.startswith('0x') and len(hash) == 42 def list_nifty_gateway(update=True, verbose=...
StarcoderdataPython
1798364
#!/usr/bin/python # -*- coding: utf-8 -*- # We need this for gui controls import gui3d import humanmodifier print 'Face imported' class GroupBoxRadioButton(gui3d.RadioButton): def __init__(self, group, label, groupBox, selected=False): gui3d.RadioButton.__init__(self, group, label, selected, s...
StarcoderdataPython
3236724
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('disclaimrwebadmin', '0007_auto_20141124_1229'), ] operations = [ migrations.AlterModelOptions( na...
StarcoderdataPython
3269992
# coding=UTF-8 from flask import url_for def test_index(client): res = client.get(url_for('index')) assert res.status_code == 200 assert b'Hello, World!' in res.data #def test_push_hook(client): # res = client.post('/postreceive', '{"foo":"bar"}') # assert res.status_code == 400
StarcoderdataPython
136303
<gh_stars>0 #!/usr/bin/env python # stdlib imports import os.path from datetime import datetime import re import logging # third party imports import numpy as np from scipy import constants import pandas as pd import pkg_resources # local from gmprocess.core.stationstream import StationStream from gmprocess.core.sta...
StarcoderdataPython
9796
import numpy as np import torch import torch.nn as nn from mmcv.runner import obj_from_dict from mmcv.utils.config import Config from mmedit.models import build_model from mmedit.models.losses import L1Loss from mmedit.models.registry import COMPONENTS @COMPONENTS.register_module() class BP(nn.Module): """A simp...
StarcoderdataPython