id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
4841261
<gh_stars>1-10 # Copyright (c) 2020 PaddlePaddle 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 re...
StarcoderdataPython
28357
# Released under the MIT License. See LICENSE for details. # # This file was automatically generated from "rampage.ma" # pylint: disable=all points = {} # noinspection PyDictCreation boxes = {} boxes['area_of_interest_bounds'] = (0.3544110667, 5.616383286, -4.066055072) + (0.0, 0.0,...
StarcoderdataPython
3243718
""" By <NAME>, 2018 Last Modified Mar 22, 2018 Given transformed coordinates and the cube's size, this scripts tries to estimate the locations of the cubes """ import numpy as np CUBE_SIZE_SMALL = 0.037 # in meter CUBE_SIZE_LARGE = 0.086 # in meter def cube_localization(coords, cube_size=CUBE_SIZE_SMALL): """...
StarcoderdataPython
1781574
<gh_stars>0 spark = SparkSession.builder.getOrCreate() escuelasPRSchema = StructType([ StructField('region', StringType()), StructField('distrito', StringType()), StructField('ciudad', StringType()), StructField('idescuela', IntegerType()), StructField('nombreescuela', StringType()), StructField('nivel', St...
StarcoderdataPython
4811354
<filename>commonkit/math/library.py # Imports from functools import reduce import operator import statistics # Exports __all__ = ( "add", "average", "difference", "factors_of", "is_prime", "median", "percentage", "product", ) # Functions def add(values, base=None): """Add value...
StarcoderdataPython
4842475
<gh_stars>1-10 import pygame pygame.init() class Game: white = (238, 238, 210) green = (118, 150, 86) yellow = (255,170,0) selected_green = (186, 202, 43) selected_white = (246, 246, 105) high_white = (236,126,106) high_green = (212,108,81) move_white = (214,214,189) move_green = (1...
StarcoderdataPython
3388813
import cv2 from matplotlib import pyplot as plt import matplotlib.cm as cm import numpy as np import math from skimage.filters import threshold_otsu from src.traffic_lanes_pipeline.lanes import detect_traffic_lanes from src.traffic_lanes_pipeline.view_filter import limit_view def process_image(image): # NOTE: Th...
StarcoderdataPython
3280803
<filename>rucio_jupyterlab/tests/test_kernel.py # Copyright European Organization for Nuclear Research (CERN) # # 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/LI...
StarcoderdataPython
1670342
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
StarcoderdataPython
3373338
<reponame>JoshuaOndieki/joshua-ondieki-bootcamp-17 import unittest from loan_calculator import loan_calculator class Loan(unittest.TestCase): def test_month_is_not_greater_than_twelve(self): self.assertEquals(loan_calculator(100000, 11, 13), "Invalid Number of months!") def test_it_works(self): ...
StarcoderdataPython
3346236
<reponame>se2p/artifact-pynguin-ssbse2020<filename>software/pynguin/pynguin/testcase/statements/fieldstatement.py # This file is part of Pynguin. # # Pynguin is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundati...
StarcoderdataPython
4808791
#!win10_x64 python3.6 # coding: utf-8 # Date: 2019/10/27 # <EMAIL> class Results(object): """ Default results class for wrapping decoded (from JSON) solr responses. Required ``decoded`` argument must be a Solr response dictionary. Individual documents can be retrieved either through ``docs`` attribut...
StarcoderdataPython
1605983
# Generated by Django 3.1 on 2021-01-18 23:45 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ('users', '0001_initial'), ] operations = [ migrations.CreateM...
StarcoderdataPython
1667759
<gh_stars>0 from index import db class Admin(db.Model): username = db.Column(db.String(30), primary_key=True) password_hash = db.Column(db.String(100), nullable=False) def __repr__(self): return '<admin %r>' % self.username # to iterate over an admin def __iter__(self): yield 'username', self.username yie...
StarcoderdataPython
1715917
# Copyright (c) 2019 <NAME> # # 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, s...
StarcoderdataPython
1653054
#!/usr/bin/env python """Basic implementation of CHOMP trajectory optimization algorithm. Optimize over q1...qn, with q0 and qn+1 the fixed end points. """ import numpy as np import matplotlib.pyplot as plt from scipy import sparse import IPython from mm2d import models class CircleField: def __init__(self, c,...
StarcoderdataPython
48646
<reponame>HuguesGuilleus/istyPOO #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os from storage.struct import Struct as Struct from storage.db import DB as DB if not os.path.exists("data/"): os.makedirs("data/") # Classes class Guest(Struct): def __init__(self, db): super(Guest, self).__init__({ "*Nam...
StarcoderdataPython
3218353
from django import forms class ContactForm(forms.Form): name = forms.CharField( max_length=100, widget=forms.TextInput( attrs={'placeholder': "Your name", } ) ) email = forms.EmailField( widget=forms.TextInput( attrs={'placeholder': "Your e-mail", } ...
StarcoderdataPython
1611522
jjj= dict() jjj['Chuck']= 1 jjj['fred']= 42 jjj['jan']= 100 print(list(jjj)) print(jjj.keys()) print(jjj.values()) for aaa, bbb in jjj.items(): print(aaa,bbb)
StarcoderdataPython
80032
import torch import numpy as np import torch.nn as nn from mmcv.cnn import normal_init from ..registry import HEADS from ..utils import ConvModule, bias_init_with_prob from .anchor_head import AnchorHead from mmdet.core import (delta2bbox, force_fp32, multiclass_nms_with_feat) """ RetinaHead t...
StarcoderdataPython
1636404
<reponame>PrabhuLoganathan/Python-SeleniumBase<filename>seleniumbase/common/obfuscate.py """ Obfuscates a string/password into a string that can be decrypted later on. Usage: python obfuscate.py Then enter the password. The result is an encrypted password. """ from seleniumbase.common import encryption import getpass...
StarcoderdataPython
96246
<filename>scripts/resubmit_batch.py #!/usr/bin/python from subprocess import call import pickle import sys task={} i=0 kk=0 full = False taskfile = str(sys.argv[1]) batchfile = str(sys.argv[2]) #open tasklist task = pickle.load( open(taskfile, "rb" ) ) f = open(batchfile, "a" ) for t in sorted(task.keys()): my...
StarcoderdataPython
3263205
<gh_stars>0 import sys reload(sys) sys.setdefaultencoding('utf8')
StarcoderdataPython
3227674
# encoding: utf-8 from django.conf import settings from django import forms from django.db.models import Q, Count from django.views import generic from django.core.urlresolvers import reverse from django.http import Http404, HttpResponseRedirect, JsonResponse from django.contrib import messages from django.shortcuts i...
StarcoderdataPython
1768314
<gh_stars>1-10 """ Management of variables in AskAnna This is the class which act as gateway to the API of AskAnna """ import sys import click from askanna.core import client from askanna.core.dataclasses import Variable class VariableGateway: def __init__(self, *args, **kwargs): self.client = client ...
StarcoderdataPython
106557
import click from ...library.commands.publish import publish EXCEPTIONS_EXPECTED = ( NotADirectoryError, AssertionError, RuntimeError, AttributeError, FileNotFoundError, ) @click.command(name="publish") @click.option( "--access", "-a", default="public", required=False, help="The access level...
StarcoderdataPython
88410
<filename>day7/day7.py input = """ xsddbi (61) nqtowev (11) xwohr (82) flejt (36) idwpug (54) uoxzkp (51) choeijs (54) gmsjkn (65) txszqu (687) -> mvjqmad, lwqlyjq, jlgnsu zhlfdac (15) htouwcr (74) vlbsr (56) titbn (9) bvrpb (86) wuwjp (54) umnqkb (160) -> nbrvl, bcmbao, vfimqtl uwnml (29) cdvhmy (42) xghhu (306) -> mo...
StarcoderdataPython
1714589
<reponame>Data-drone/scaling_deep_learning import torch from torch import nn import torch.nn.functional as F from torchmetrics.functional import accuracy import pytorch_lightning as pl import torchvision.models as models # TODO add a pickle thing to serialise weights when we are pretraining # we do not seem to need ...
StarcoderdataPython
1746233
<filename>TradingGym/OrderFlow.py from datetime import datetime import numpy as np import pandas as pd def readTxt(path2file, verbose = True): """ Read txt with order book messages after qsh2txt.exe """ if (verbose): print('Parsing file ', path2file) ret = pd.read_csv(path2file, sep=';', hea...
StarcoderdataPython
3311894
from app import db class Area(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(25), unique=True) description = db.Column(db.Text) class SubArea(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(25), unique=True) description = d...
StarcoderdataPython
134143
<filename>test/pythonAPI/attachTxtoTangle.py<gh_stars>0 import urllib.request as urllib2 from iota import Address, TryteString, TransactionTrytes import json, sys command_ts = { "command": "getTransactionsToApprove" } stringified_ts = json.dumps(command_ts).encode("utf-8") headers = { 'content-type': 'applicat...
StarcoderdataPython
3381502
import yaml # @todo #/DEV Support loggers definition from environment variables. class Log: config: dict = {} def __init__(self, file: str, level: str, fmt: str = None): """ @file: The yaml file with logging configuration. @level: The default logging level for all loggers. @...
StarcoderdataPython
3221752
<gh_stars>1000+ #!/usr/bin/env python3 # pyre-strict from __future__ import annotations import argparse import logging import os import tempfile from enum import Enum import attr from .fanout_test_driver import ( Binaries, run_scenario_saved_state_init, run_scenario_incremental_no_old_decls, run_scen...
StarcoderdataPython
1689623
from collections import defaultdict import fcntl import io import os import re import subprocess import sys import tempfile from django.conf import settings #from celery.utils import log as logging import logging log = logging.getLogger(__name__) #log = logging.task_logger __author__ = 'pflarr' SUDO_CMDS = settin...
StarcoderdataPython
1614594
#========= import time import numpy as np import matplotlib.pyplot as plt from moviepy.editor import VideoClip from moviepy.video.io.bindings import mplfig_to_npimage fps = 2 f_dt = 1/fps fig, ax = plt.subplots( figsize=(6,6), facecolor=[1,1,1] ) x = np.arange(0, 2*np.pi, 0.01) line, = ax.plot(x, np.sin(x), lw=3...
StarcoderdataPython
1622395
<gh_stars>0 import os def strip_prefix_path(orig: str, part: str) -> str: parts = os.path.split(orig) if len(parts) > 1 and parts[0] == part: parts = parts[1:] return os.path.join(*parts) def get_real_path(target: str, strip: str) -> str: if os.path.exists(target): return target ...
StarcoderdataPython
1623190
import logging import unittest import numpy as np import pandas as pd import scipy.stats as stats from batchglm.api.models.tf1.glm_nb import Simulator import diffxpy.api as de class TestConstrained(unittest.TestCase): def test_forfatal_from_string(self): """ Test if _from_string interface is wo...
StarcoderdataPython
139454
<gh_stars>0 """ Copyright (c) 2018-2019 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or...
StarcoderdataPython
61208
<filename>src/core/controller.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- ######################################################## # ____ _ __ # # ___ __ __/ / /__ ___ ______ ______(_) /___ __ # # / _ \/ // / / (_-...
StarcoderdataPython
166723
from . import test_project_timeline
StarcoderdataPython
3216598
<filename>VidHand_Tracker.py<gh_stars>0 #references: #handpaint - https://towardsdatascience.com/tutorial-webcam-paint-opencv-dbe356ab5d6c #screenrecord - https://docs.opencv.org/master/dd/d43/tutorial_py_video_display.html #edited by Roanne, Anaheim, Matthew, and Hanna #this is a prototype which writes using a blue ob...
StarcoderdataPython
134753
# URI Online Judge 1176 N = 62 n1 = 0 n2 = 1 string = '0 1' for i in range(N-2): new = n1 + n2 string += (' ') + str(new) n1 = n2 n2 = new fib = [int(item) for item in string.split()] T = -1 while (T<0) or (T>60): T = int(input()) for t in range(T): entrada = int(input())...
StarcoderdataPython
1719534
<reponame>robcharlwood/you-judge # -*- coding: utf-8 -*- from djangae.test import TestCase from core.tests.factories import ProjectFactory class ProjectModelTestCase(TestCase): def test_unicode_method(self): project = ProjectFactory.create(name=u'象は鼻が長') self.assertEqual(project.__unicode__(), u'...
StarcoderdataPython
1751279
<reponame>CedricMidoux/atlas import logging logger = logging.getLogger(__file__) import multiprocessing import os import sys import tempfile from snakemake.io import load_configfile from snakemake.utils import update_config as snakemake_update_config from .default_values import * def make_default_config(): """g...
StarcoderdataPython
10119
#!/usr/bin/env python # # Copyright (C) 2007 British Broadcasting Corporation and Kamaelia Contributors(1) # All Rights Reserved. # # You may only modify and redistribute this under the terms of any of the # following licenses(2): Mozilla Public License, V1.1, GNU General # Public License, V2.0, GNU Lesser General ...
StarcoderdataPython
63339
import struct import dns.message import dns.reversename import IPy import netifaces from sleepproxy.manager import manage_host def handle(server, raddress, message): try: message = dns.message.from_wire(message) except: print "Error decoding DNS message" return if message.edns < ...
StarcoderdataPython
137978
<filename>embyapi/api/connect_service_api.py # coding: utf-8 """ Emby Server API Explore the Emby Server API # noqa: E501 OpenAPI spec version: 4.1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import re # noqa: F401 # python...
StarcoderdataPython
149128
<gh_stars>0 UserPreferences.view = None
StarcoderdataPython
39445
<reponame>EgorBlagov/l2address import re from abc import ABC, abstractmethod from .utils import parse_hex, per_join class Formatter(ABC): def _to_clean_str(self, value, max_value): value_str = str(hex(value))[2:] full_mac_str = '0' * (self._hex_digits_count(max_value) - ...
StarcoderdataPython
3323170
<gh_stars>1-10 vernum=(1, 11, 0, 0)
StarcoderdataPython
3224638
import os import torch import codecs import gensim import logging import numpy as np import pandas as pd from collections import Counter from gensim.models.keyedvectors import KeyedVectors from nltk.corpus import stopwords class Dictionary( object ): """ from_embedding: Initializes vocab from embedding file. ...
StarcoderdataPython
3320661
<filename>tests/test_links_extension.py # -*- coding: utf-8 -*- """ test_links_extension ---------------------------------- Tests for `docdown.links` module. """ from __future__ import absolute_import, unicode_literals, print_function import markdown import unittest import os class LinksExtensionTest(unittest.Te...
StarcoderdataPython
1750313
<gh_stars>1-10 import sqlite3 conn = sqlite3.connect('managmentSystem.sqlite3') cursor = conn.cursor() def createUniversityTable(cursor): cursor.execute("DROP TABLE IF EXISTS University") cursor.execute("CREATE TABLE University(Nombre_Univ TEXT, Comunidad TEXT, Plazas INTEGER, PRIMARY KEY(Nombre_Univ))") def cre...
StarcoderdataPython
3296725
from .mongo import * from .redis import *
StarcoderdataPython
3296361
<gh_stars>10-100 import asyncio import logging import re from common.http import request_coro from common import utils log = logging.getLogger("common.url") @utils.cache(60 * 60, params=[0]) async def canonical_url(url, depth=10): urls = [] while depth > 0: if not url.startswith("http://") and not url.startswith...
StarcoderdataPython
3282041
# search/search_node.py # # Data structure that represents a domain-independent search node # # @author: dharabor # @created: 2020-07-15 # import sys from functools import total_ordering class search_node: action_ = None state_ = None parent_ = None g_ = 0 depth_ = None instance_ = None h...
StarcoderdataPython
1795560
<reponame>alessap/apistar_alpine from app import app app.serve("127.0.0.1", 5000, debug=True)
StarcoderdataPython
3300028
#!python import hashlib x = b"1111" hash = hashlib.md5(x) print(hash.hexdigest()) hash = hashlib.sha1(b"1111") #ข้อความที่จะแฮชคือ 1111 print(hash.hexdigest()) hash = hashlib.sha224(b"1111") #ข้อความที่จะแฮชคือ 1111 print(hash.hexdigest()) hash = hashlib.sha256(b"1111") #ข้อความที่จะแฮชคือ 1111 pri...
StarcoderdataPython
124211
<gh_stars>1-10 """ Utilities for advancing bookyear """ from tantalus_db.base import db from tantalus_db.models import PosSale, Session, Transaction, Referencing, Product, PosProduct from tantalus_db.config import Setting from tantalus_db.utility import transactional from tantalus.snapshot.create import create_snapsho...
StarcoderdataPython
4800387
name = "games"
StarcoderdataPython
1682601
<filename>extract.py import argparse import os import time import h5py import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn from torch.autograd import Variable import torchvision.transforms as transforms import torchvision.datasets as datasets import vqa...
StarcoderdataPython
3368105
<gh_stars>1-10 from os import path from PIL import Image import numpy as np import matplotlib.pyplot as plt from wordcloud import WordCloud, STOPWORDS import re from sklearn.feature_extraction import stop_words import nltk import operator from wordcloud import (get_single_color_func) import matplotlib.pyplot as plt imp...
StarcoderdataPython
1735344
<gh_stars>1-10 ## add a !mute function ## add a !100 function to set volume to 100 ## !register <command> <uri> # Import some necessary libraries. import socket import subprocess import re import cPickle as pickle # Importing the list of registered commands with open('dict.pickle', 'rb') as handle: params = pick...
StarcoderdataPython
1740263
<reponame>TKlerx/COVID-19<gh_stars>0 import datetime import logging from sqlalchemy.sql import text as sa_text import sqlalchemy import urllib from sqlalchemy import create_engine import pandas as pd import requests import os import azure.functions as func from .. import shared def main(mytimer: func.TimerRequest) -...
StarcoderdataPython
62688
<filename>functional_tests/server_tools.py from fabric.api import run from fabric.context_managers import settings def _get_manage_dot_py(host): return f'~/sites/{host}/virtualenv/bin/python ~/sites/{host}/manage.py' def reset_database(host): manage_dot_py = _get_manage_dot_py(host) with settings(host_str...
StarcoderdataPython
1730267
<filename>src/MainAPP/forms.py # coding: utf-8 import datetime from bootstrap3_datetime.widgets import DateTimePicker from django import forms from django.utils.translation import ugettext_lazy as _ from django.core.exceptions import ValidationError from django.utils import timezone from django.views import generic fr...
StarcoderdataPython
3267406
<reponame>MuhammedBuyukkinaci/My-Django-Tutorials from django.shortcuts import render from django.http import HttpResponse from .models import Tutorial from .models import TutorialCategory, TutorialSeries #from django.contrib.auth.forms import UserCreationForm from .forms import NewUserForm from django.contrib.auth...
StarcoderdataPython
1605381
import re from fontTools.agl import AGL2UV import defcon from . import registry from .wrappers import * # Unicode Value uniNamePattern = re.compile( "uni" "([0-9A-Fa-f]{4})" "$" ) def testUnicodeValue(glyph): """ A Unicode value should appear only once per font. """ font = wrapFont(glyph....
StarcoderdataPython
3237649
<filename>model/layers/resized_fuse_test.py # coding=utf-8 # Copyright 2021 The Deeplab2 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/LICENS...
StarcoderdataPython
29213
# Exercícios Numpy-27 # ******************* import numpy as np Z=np.arange((10),dtype=int) print(Z**Z) print(Z) print(2<<Z>>2) print() print(Z <- Z) print() print(1j*Z) print() print(Z/1/1) print() #print(Z<Z>Z)
StarcoderdataPython
4800655
import sys import numpy as np import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(BASE_DIR, '../utils')) import bullet_client as bc from coord_helper import * from data_helper import * from collision_helper import fcl_get_dist, fcl_model_to_fcl import imageio def check_one_p...
StarcoderdataPython
1648355
#!/usr/bin/python work_dir = '' import numpy as np from scipy.io import FortranFile as ufmt if __name__ == '__main__': import matplotlib.pyplot as plt from matplotlib.colors import LogNorm # See GALAXY 14.50 Manual, Sec. 9.2, P54 header_dtype = [('n1', '<i4'), ('n2', '<i4'), ('n3', '<i4'), ('nco...
StarcoderdataPython
3237178
""" Load existing cube view from TM1 into python. Then ask TM1py to generate the MDX Query from the cube view """ import configparser from TM1py.Services import TM1Service config = configparser.ConfigParser() # storing the credentials in a file is not recommended for purposes other than testing. # it's better to set...
StarcoderdataPython
3333996
from ocs import ocsbow
StarcoderdataPython
4821079
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 """ KMyMoney Stock Server A simple http server to be a single Online Quote Source for stock market info for KMyMoney. ------------------- Run as a regular python script: $ ./server.py """ import time import sys impo...
StarcoderdataPython
73956
<reponame>IxxyXR/cardboardcam # from flask_cache import Cache from flask_caching import Cache from flask_login import LoginManager from flask_assets import Environment # from flask_wtf.csrf import CsrfProtect from flask_thumbnails import Thumbnail from cardboardcam.models import User # Setup flask cache cache = Cac...
StarcoderdataPython
161179
<filename>crosswalk_client/validators/domain/parent_domain_kwarg.py<gh_stars>1-10 from slugify import slugify from crosswalk_client.exceptions import MalformedDomain from crosswalk_client.objects.domain import DomainObject def validate_parent_domain_kwarg(function): """ Validates a domain is passed. Converts...
StarcoderdataPython
1711648
""" script to train model """ import cycle_gan import toml import os import argparse HYPERPARAMETER = os.getenv('HYPERPARAMETER', './bin/hyperparameter.toml') def get_options(parser): share_param = {'nargs': '?', 'action': 'store', 'const': None, 'choices': None, 'metavar': None} parser.add_argument('-e', '...
StarcoderdataPython
174664
import pytest from mixer.backend.django import mixer # We need to do this so that writing to the DB is possible in our tests. pytestmark = pytest.mark.django_db def test_message(): obj = mixer.blend('simple_app.Message') assert obj.pk > 0
StarcoderdataPython
1600834
import json import datetime from dateutil import parser from pyspark import SparkContext from pyspark.sql import SparkSession from pyspark.sql import functions as F from pyspark.sql import types as T try: spark except NameError: spark = SparkSession.builder.appName("proj").getOrCreate() #####################...
StarcoderdataPython
3298513
# (c) 2016 <NAME> <<EMAIL>> # # This file is part of Ansible # # Ansible 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. # # Ansible is...
StarcoderdataPython
194815
#!/usr/bin/env python3 """ This script parses the list of C++ runtime parameters and writes the necessary header files and Fortran routines to make them available in Castro's C++ routines and (optionally) the Fortran routines through meth_params_module. parameters have the format: name type default need-in-fort...
StarcoderdataPython
4802625
from django.urls import path from . import views from .feeds import AllPostsRssFeed app_name = 'blog' urlpatterns = [ path('', views.home, name='home'), path('index', views.index, name='index'), path('posts/<int:id>',views.post, name='post'), path('tags/<int:id>',views.tag, name='tag'), path('cat...
StarcoderdataPython
3273301
<filename>masq/cms/models/Game.py<gh_stars>0 from django.db import models from django.contrib import admin from django.conf import settings from rest_framework import serializers from cms.models.Base import BaseModel class Game(BaseModel): name = models.CharField(max_length=32, default='Unnamed Game') template = mo...
StarcoderdataPython
3398834
<gh_stars>1-10 #© <NAME> import csv import numpy as np import pylab import pandas as pd # Define functions def compareWeek(first, second, answer): if answer != "Weekly": if first < second: average = (second - first) if average > second / 2: answer = "Weekly" ...
StarcoderdataPython
1671865
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # # Copyright 2021 The NiPreps Developers <<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 ...
StarcoderdataPython
44078
<filename>chap12/download_xkcd.py import requests, os, bs4 import logging logging.basicConfig(format='[%(levelname)s] %(message)s', level=logging.INFO) url = 'https://xkcd.com' os.makedirs('xkcd', exist_ok=True) while True: try: limit = int(input('How many comics would you like to download? ')) ...
StarcoderdataPython
3360208
<filename>tests/cli/test_cli_supervisor.py import pathlib from configparser import ConfigParser from unittest.mock import patch from oort.cli.supervisor import ( DEFAULT_PROCESSES, get_supervisor_processes_status, reconfigure_supervisor, start_supervisor_processes, stop_supervisor_processes ) from ...
StarcoderdataPython
187684
<reponame>cauabeisola/Projetos-e-afins<gh_stars>1-10 import pyautogui from time import sleep f = open("../msc/script.txt", 'r') pyautogui.press("win") sleep(1) pyautogui.typewrite('powershell') pyautogui.press("enter") sleep(2) for word in f: pyautogui.typewrite(word) pyautogui.press("enter")
StarcoderdataPython
34160
# -*- encoding: utf-8 -*- # This is a package that contains a number of modules that are used to # test import from the source files that have different encodings. # This file (the __init__ module of the package), is encoded in utf-8 # and contains a list of strings from various unicode planes that are # encoded...
StarcoderdataPython
3302409
""" Algoritmo de fatorial implementado com recursão """ def fatorial_recursivo(numero): """ Implementação de um algoritmo de fatorial com recursão. Argumentos: numero: int. o número do qual deseja-se obter o fatorial. Retorna o resultado da operação. """ if numero == 1: retur...
StarcoderdataPython
1621120
<gh_stars>0 import os import csv from park_api import env def find_forecast(lot_id, time_from, time_to): try: csv_path = os.path.join(env.APP_ROOT, "forecast_data", lot_id + ".csv") with open(csv_path) as csvfile: data = { "version": 1.0, "data": {} ...
StarcoderdataPython
3302823
<gh_stars>100-1000 # Generated by Django 2.2.13 on 2020-06-25 11:39 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('bandwagon', '0001_initial'), ] operations = [ migrations.DeleteModel( name='FeaturedCollection', ), ]
StarcoderdataPython
1775065
<filename>code/filter_paths.py def filter_distance(total_distances, filtered_paths, available_paths, distance_thresh, min_path, min_dist): ''' Accepts a paths defaultdict(dict), the result of all_shortest_paths(G), and removes (in-place) all paths between the nodes indicated by pair whose total route di...
StarcoderdataPython
3211010
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """A wrapper around list that keep track of changes to it.""" class ChangeTrackingList(list): # pragma: no cover def __init__(self, seq=()): list.__...
StarcoderdataPython
3221185
<filename>caper/example/main.py from http.server import HTTPServer, SimpleHTTPRequestHandler print("Hello world") server_object = HTTPServer(server_address=('', 8080), RequestHandlerClass=SimpleHTTPRequestHandler) server_object.serve_forever()
StarcoderdataPython
3393177
<reponame>veerte/python_primes_package from bisect import bisect from typing import Sequence import functools as ft import itertools as it import operator import typing import math from .primeSieve import PrimeSieve from .primes_utils import prime_list, next_prime T = typing.TypeVar('T') def product(nums : Sequence...
StarcoderdataPython
1791571
<gh_stars>10-100 import tvm import json from functools import reduce from .. import _ffi_api from ..target import TENET class TenetContext(object): def __init__(self, level): self.level = level self.space_time_loops = [[[], []] for i in range(level)] # outer --> inner self.memory_scopes =...
StarcoderdataPython
1664011
<gh_stars>0 # -*- coding: utf-8 -*- # Copyright (c) 2010-2012 OpenStack, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
StarcoderdataPython
40162
<filename>_estudoPython_solid/scriptTeste-03.py numero = 42 chute = input('Digite um número: \n') converte = int(chute) if numero == converte: print('Voçê acertou!') else: print('Voçê errou!')
StarcoderdataPython