id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
171300
def test_test_suite(): assert True
StarcoderdataPython
3280818
<gh_stars>0 from io import StringIO import pytest from doit.exceptions import InvalidCommand from doit.task import Task from doit.tools import result_dep from doit.cmd_list import List from tests.conftest import tasks_sample, tasks_bad_sample, CmdFactory class TestCmdList(object): def testQuiet(self): ...
StarcoderdataPython
100180
def interest(n, principle_amount): def years(x): return principle_amount + (n * principle_amount * x) / 100 return years principle = 100000 home_loan = interest(7, principle) # percentage of 7 personal_loan = interest(11, principle) # percentage of 11 print(home_loan(20)) # for 20 years print(per...
StarcoderdataPython
3335766
<reponame>ricardoGrando/hydrone_deep_rl_icra<filename>hydrone_aerial_underwater_deep_rl/scripts/velocity.py<gh_stars>1-10 #! /usr/bin/env python import time import rospy from std_msgs.msg import * from geometry_msgs.msg import * from mavros_msgs.msg import * from mavros_msgs.srv import * from geographic_msgs.msg import...
StarcoderdataPython
3328961
#!/usr/bin/env python # Copyright (c) 2014, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. from stix.core import STIXPackage from stix.indicator import Indicator from cybox.objects.uri_object import URI def main(): pkg = STIXPackage() indicator = Indicator() indicator.i...
StarcoderdataPython
122614
import numpy as np from itertools import compress from autodp.rl_core.env.sim_env import SimEnv class BatchSimEnv(object): """This class is a wrapper to create and control a list of environments for batch processing.""" def __init__(self, image_batch=[], label_batch=[]): self._envs = [SimEnv(i, l) fo...
StarcoderdataPython
71867
<reponame>deliugard/bit import requests import json import logging from decimal import Decimal, getcontext from bit.constants import BTC from bit.network import currency_to_satoshi from bit.network.meta import Unspent from bit.exceptions import BitcoinNodeException DEFAULT_TIMEOUT = 10 def set_service_timeout(secon...
StarcoderdataPython
3296081
# coding=utf-8 import datetime import time from _thread import start_new_thread from ..db import db class DailyActiveNodes(object): def __init__(self, hour=0, minute=0): self.hour = hour self.minute = minute self.stop_thread = False self.t = None def thread(self): wh...
StarcoderdataPython
3217283
def probability_uniform(low_range, high_range, minimum, maximum): probability = (high_range - low_range) / (maximum - minimum) return probability # Test Your Results assert "{0:.2f}".format(probability_uniform(15, 305, 0, 360)) == '0.81' assert "{0:.2f}".format(probability_uniform(1, 5, 0, 10)) == '0.40...
StarcoderdataPython
3216922
<reponame>sswapnil2/transform # Copyright 2017 Google Inc. 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 r...
StarcoderdataPython
1711327
<filename>broqer/op/concat.py """ Concat enables concating operators """ from broqer.operator import OperatorFactory, Publisher class Concat(OperatorFactory): # pylint: disable=too-few-public-methods """ This class is generator a new operator by concatenation of other operators. :param operators: the op...
StarcoderdataPython
1671472
<reponame>strakam/PyEasyGraphics<filename>examples/processing/quadratic.py from easygraphics.processing import * from easygraphics import * def setup(): set_size(400, 300) set_fill_color("red") t = 0 def draw(): global t clear() t += 1 t = t % 90 rotate(t) set_fill_style(FillStyle....
StarcoderdataPython
3218958
# Copyright 2022 The TensorFlow 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 applica...
StarcoderdataPython
1796877
<filename>insight/ticker.py from db import ticker from .status import * import pandas as pd import copy import numpy as np def get_ticker_data(): """ Get a list of all tickers' data :return: List of tickers along with price data list """ raw_data = list(ticker.get_all_tickers()) # convert pri...
StarcoderdataPython
3312292
from django.db import models from django.conf import settings from django.utils.timezone import now # Create your models here. class Abonent(models.Model): name = models.CharField(max_length=50) birthday = models.DateField(null=True, blank=True) address = models.CharField(max_length=200, blank=True) ...
StarcoderdataPython
4668
<filename>app/dialog/avatar_picture_dialog.py<gh_stars>1-10 import asyncio from contextlib import AsyncExitStack from aiogram.dispatcher.filters.state import StatesGroup, State from aiogram.dispatcher.storage import FSMContextProxy from aiogram.types import Message, PhotoSize, ReplyKeyboardRemove, ContentTypes from ai...
StarcoderdataPython
191819
<filename>services/registry/get_service.py from Acquire.Registry import Registry def run(args): """Call this function to return information about a trusted service""" try: service_uid = args["service_uid"] except: service_uid = None try: service_url = args["service_url"] ...
StarcoderdataPython
187425
<filename>build/PureCloudPlatformClientV2/models/coaching_notification.py<gh_stars>1-10 # coding: utf-8 """ Copyright 2016 SmartBear Software 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 Licens...
StarcoderdataPython
3291738
<reponame>QuenLo/leecode class Solution: def numIslands(self, grid: List[List[str]]) -> int: total = 0 y_length = len(grid) if not y_length: return 0 x_length = len(grid[0]) for y in range(y_length): for x in range(x_length): if grid[y][...
StarcoderdataPython
1684111
<gh_stars>1-10 IMP_VERSION = "0.1.awesome"
StarcoderdataPython
3341471
<gh_stars>1-10 from pathlib import Path import pyexcel_export if __name__ == '__main__': data = pyexcel_export.get_data('PathoDict.yaml')[0] pyexcel_export.save_data('PathoDict.xlsx', data)
StarcoderdataPython
3302780
<reponame>aimakerspace/goldenretriever config_dict={ "beta_1": 0.9, "beta_2": 0.999, "epsilon": 1e-07, "learning_rate": 5e-05, "early_stopping_steps": 5, "margin": 0.3, "loss_type": "triplet", # "cosine" "num_epochs": 1, "task_type": "train_eval", "train_batch_size": 1, ...
StarcoderdataPython
102964
<filename>src/aloam_pose.py<gh_stars>0 #!/usr/bin/env python import geometry_msgs.msg import math import nav_msgs import numpy as np import rospy import tf2_ros if __name__ == '__main__': rospy.init_node('aloam_pose') tfBuffer = tf2_ros.Buffer() listener = tf2_ros.TransformListener(tfBuffer) publ...
StarcoderdataPython
4807909
<filename>python/fire_rs/planning/demo_storyboard.py<gh_stars>10-100 # Copyright (c) 2018, CNRS-LAAS # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must reta...
StarcoderdataPython
1785341
""" SleekXMPP: The Sleek XMPP Library Copyright (C) 2012 <NAME>, <NAME> This file is part of SleekXMPP. See the file LICENSE for copying permission. """ from sleekxmpp.plugins.base import register_plugin from sleekxmpp.plugins.xep_0033 import stanza from sleekxmpp.plugins.xep_0033.stanza import Addre...
StarcoderdataPython
1746452
<reponame>learninto/sentry from __future__ import absolute_import import six from sentry.testutils import APITestCase, SnubaTestCase from django.core.urlresolvers import reverse from sentry.discover.models import DiscoverSavedQuery, DiscoverSavedQueryProject class DiscoverSavedQueryDetailTest(APITestCase, SnubaTest...
StarcoderdataPython
1715655
# !/usr/bin/env python # coding:utf8 import importlib import sys importlib.reload(sys) import time import json import pprint data = {} fr = open('../csv/films1.csv', 'r', encoding='utf-8') for line in fr: tmp = json.loads(line.strip('\n')) data[tmp['title']] = tmp fr.close() fr = open('../csv/characters1.csv', 'r'...
StarcoderdataPython
3204505
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2017-2018 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Pytest configuration.""" from __future__ import absolute_import, print_function ...
StarcoderdataPython
3393207
################################# Import Libraries ################################ import os.path import sys import ctypes import time from timing import TimingThread import urllib2 import json dllsPath = os.path.dirname(os.path.realpath(__file__))+'\dlls' os.environ['PATH'] = dllsPath + ';' + os.environ['PATH'] cla...
StarcoderdataPython
1670130
#------------------------------------------------------------------------------ # Copyright (c) 2015, 2016, The University of Manchester, UK. # # BSD licenced. See LICENCE for details. # # Authors: <NAME>, <NAME> #------------------------------------------------------------------------------ import pandas as pd import...
StarcoderdataPython
36743
<reponame>Kyeongan/crowdsource-platform from rest_framework import permissions from csp import settings from rest_framework.exceptions import PermissionDenied class IsWorker(permissions.BasePermission): def has_permission(self, request, view): return request.user.profile.is_worker class IsRequester(perm...
StarcoderdataPython
3346241
<filename>git_subprocess/files.py import os import subprocess class File(object): def __init__(self, repo, path): self.repo = repo self.path = path self.versions = [] for sha in self._get_versions(path): self.versions.append(sha) def __getattr__(self, item): ...
StarcoderdataPython
3398223
# Copyright 2017-2019 TensorHub, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
StarcoderdataPython
1675773
<reponame>catalystneuro/shenoy-lab-to-nwb<filename>maze_task/churchlandnwbconverter.py import uuid from datetime import datetime from nwb_conversion_tools import NWBConverter from .shenoyblackrockrecordingdatainterface import ShenoyBlackRockRecordingDataInterface from .shenoymatdatainterface import ShenoyMatDataInter...
StarcoderdataPython
3271790
<reponame>gister9000/jesse # import pytest # # import jesse.services.selectors as selectors # from jesse.config import config, reset_config # from jesse.enums import exchanges # from jesse.exceptions import NegativeBalance # from jesse.store import store # # # def set_up(): # """ # # """ # reset_config() # ...
StarcoderdataPython
4837360
"""from dbnd import output, parameter from dbnd_spark import spark, spark_task from targets.target_config import FileFormat #### DOC START @spark_task(result=output.save_options(FileFormat.csv, header=True)[spark.DataFrame]) def custom_load_save_options( data=parameter.load_options(FileFormat.csv, header=False, s...
StarcoderdataPython
163078
class Solution: """ @param grid: a 2D array @return: the maximum area of an island in the given 2D array """ def maxAreaOfIsland(self, grid): # Write your code here maxArea = 0 m = len(grid) n = len(grid[0]) def dfs(r, c): if grid[r][c] == 0: ...
StarcoderdataPython
1700603
import rhinoscriptsyntax as rs from compas.datastructures import Mesh from compas.geometry import is_point_in_polygon_xy from compas.topology import delaunay_from_points from compas.topology import trimesh_remesh from compas.utilities import geometric_key from compas_rhino import get_line_coordinates ...
StarcoderdataPython
1765129
<reponame>DaniloZZZ/social_bot import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.patches import Ellipse import string def corrplot(data, pvalues, labels): """Creates a correlation plot of the passed data. The function returns the plot which can then be shown with ...
StarcoderdataPython
4841868
<reponame>RobertoRosa7/python # -*- coding: utf-8 -*- from datetime import datetime import os, sys, re import numpy as np import pandas as pd import json import csv import random sys.path.append(os.path.abspath(os.getcwd())) os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" from sklearn.preprocessing import LabelEncoder from ...
StarcoderdataPython
3368309
import itertools import random def coinChange(n, coin): total = n+5 ans = [] for i in range(total): ans.append(100000) ans[0] = 0 for i in range(total): for j in coin: if i+j < total: ans[i+j] = min(ans[i] + 1, ans[i+j]) return ans[n] def main(infile...
StarcoderdataPython
1776784
from typing import Optional from typing import Union import numpy as np from scipy.sparse.coo import coo_matrix from ._typing_utils import Float from ._typing_utils import Matrix from ._utils import coo_matrix_builder def build_frame_cost_matrix( dist_matrix: coo_matrix_builder, *, track_start_cost: Opt...
StarcoderdataPython
3255151
import os shutdown = input("Shutdown your PC ?(yes/no): ") if shutdown == 'no': exit() else: os.system("Shutdown /s /t 1")
StarcoderdataPython
3265075
#!/usr/bin/python3 # Script to build network structure for encoder, quantizer, decoder and discriminator modules of model # Code borrowed from <NAME> (https://github.com/Justin-Tan/generative-compression) and modified as required import tensorflow as tf from utils import Utils from config import input_attributes #===...
StarcoderdataPython
1744912
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset from chainercv.chainer_experimental.datasets.sliceable.sliceable_dataset \ import _is_iterable class TransformDataset(GetterDataset): """A sliceable version of :class:`chainer.datasets.TransformDataset`. Note that it requires :ob...
StarcoderdataPython
3281353
import setuptools setuptools.setup( name="nbserverproxy", version='0.8.3', url="https://github.com/jupyterhub/nbserverproxy", author="<NAME> & <NAME>", author_email="<EMAIL>", license="BSD 3-Clause", description="Jupyter server extension to proxy web services", packages=setuptools.find_...
StarcoderdataPython
1691864
"""Email utility functions""" import logging import smtplib import email from email.header import Header from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from nvp.nvp_component import NVPComponent from nvp.nvp_context import NVPContext logger = logging.getLogger(__name__) def crea...
StarcoderdataPython
9551
from .GraphQLClient import GraphQLClient from Jumpscale import j JSConfigs = j.baseclasses.object_config_collection class GraphQLFactory(JSConfigs): __jslocation__ = "j.clients.graphql" _CHILDCLASS = GraphQLClient
StarcoderdataPython
3330087
# Copyright 2019,2020,2021 Sony Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
StarcoderdataPython
153369
<reponame>slobberchops/booze<filename>src/booze/gin/chars_test.py # Copyright 2015 <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 # # Un...
StarcoderdataPython
1686539
import logging import sys import subprocess import time from core.io.config import ConfigReader from core.io.periodic_ean import PeriodicEANReader, PeriodicEANWriter from instanceModifier import InstanceModifier from helper import Helper, Parameters logger = logging.getLogger(__name__) if __name__ == '__main__':...
StarcoderdataPython
4840790
# -*- coding: utf-8 -*- """ Created on Wed Jun 8 11:03:23 2016 @author: ericgrimson """ x = int(input('Enter an integer: ')) if x % 2 == 0: print('') print('Even') else: print('') print('Odd') print('Done with conditional')
StarcoderdataPython
4811311
import tensorflow as tf from tensorflow.python.saved_model import tag_constants from tensorflow.python.saved_model.signature_def_utils_impl import predict_signature_def def resize(str_tensor): print ("resize begins") decoded_jpeg = tf.image.decode_jpeg(str_tensor, ratio=2, channels=3) print (decoded_jpeg)...
StarcoderdataPython
1740242
""" Uses the NASA EPIC API to download the latest earth image. """ import json import shutil from datetime import datetime from pathlib import Path from urllib import request def get_latest_archive_url(data: dict) -> str: """ Use the given metadata to find the archive URL of the latest image. """ meta...
StarcoderdataPython
365
<reponame>al-arz/the-tale import smart_imports smart_imports.all() class HeroDescriptionTests(utils_testcase.TestCase): def setUp(self): super().setUp() game_logic.create_test_map() account = self.accounts_factory.create_account(is_fast=True) self.storage = game_logic_storage...
StarcoderdataPython
183612
<reponame>brodyhill9/dnd-ascension-api<gh_stars>0 import mysql_connector import json def handler(event, context): q = """ select armor_id, armor_name, armor_desc, armor_type, cost, armor_class, strength, IF(ste...
StarcoderdataPython
28008
'''Tokenizer Class''' # -*- encoding: utf-8 -*- import re from .token_with_pos import TokenWithPos from .patterns import Patterns class Tokenizer(): ''' A basic Tokenizer class to tokenize strings and patterns Parameters: - regexp: regexp used to tokenize the string ''' def __init__(self,...
StarcoderdataPython
1782973
<gh_stars>0 from __future__ import division from __future__ import print_function import os import warnings os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' warnings.filterwarnings('ignore') import tensorflow as tf tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) import time import logging from utils import * fr...
StarcoderdataPython
7029
import os import torch from PIL import Image from read_csv import csv_to_label_and_bbx import numpy as np from torch.utils.data import Subset, random_split, ConcatDataset class NBIDataset(object): def __init__(self, root, transforms, nob3=False): self.root = root self.transforms = transforms ...
StarcoderdataPython
3237028
<gh_stars>10-100 #!/usr/bin/python from smbus import SMBus from time import sleep from ctypes import c_short from bmp180 import * oversampling = 3 # 0..3 bus = SMBus(1); # 0 for R-Pi Rev. 1, 1 for Rev. 2 # return two bytes from data as a signed 16-bit value def get_short(data, index): return ...
StarcoderdataPython
4841115
<reponame>aaronchantrill/import_audiolog import cgi import glob import os import re import sqlite3 import tarfile from naomi import paths from naomi import plugin class ImportAudiologPlugin(plugin.STTTrainerPlugin): def HandleCommand(self, **kwargs): command=kwargs['command'] description=kwargs['d...
StarcoderdataPython
141668
<reponame>ksshanam/sahara # Copyright (c) 2015, MapR Technologies # # 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 a...
StarcoderdataPython
159135
<reponame>ninjapapa/SMV2<gh_stars>0 # -*- coding: utf-8 -*- # # This file is 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...
StarcoderdataPython
3309804
#!/usr/bin/env python import os import sys import argparse import subprocess parser = argparse.ArgumentParser(description='pastes last column of files while keeping the all colums from the first file') parser.add_argument('-inputs', nargs='+', help='<Required> Input file list (min 2)', required=True) parser.add_argume...
StarcoderdataPython
140933
refTable = [{'desc': 'Freedom of Movement', 'templates': ['free'], 'weight': 1.0}, {'desc': 'Visa not Required', 'templates': ['yes', 'yes '], 'weight': 0.9}, {'desc': 'Visa on Arrival', 'templates': ['Optional', 'yes-no'], 'weight': 0.7}, {'desc': 'Electronic Visa', 'templates': ['yes2'], 'weight': 0.5}, {'des...
StarcoderdataPython
3339628
<filename>lambdata/class_helper_functions.py """Module of Data Science helper functions""" import pandas as pd from sklearn.utils import shuffle class DataFrameHelper: def __init__(self, name="Frank"): # Constructor, it is the initializer of the class object, it constructs # our objects; it is ty...
StarcoderdataPython
139075
<reponame>Parquery/pypackagery #!/usr/bin/env python3 """Package a subset of a monorepo and determine the dependent packages.""" import argparse import pathlib import sys from typing import List import packagery import pypackagery_meta def main() -> int: """Execute the main routine.""" # pylint: disable=too...
StarcoderdataPython
1782197
<filename>src/Transpose/kernel.py<gh_stars>0 import numpy as np import tvm from tvm import te input_tensor = tuple([64,512,7,7]) output_tensor = tuple([32,512,14,7]) A = te.placeholder(input_tensor, name='A') A_ch = te.compute(output_tensor, lambda a,b,c,d:tvm.tir.if_then_else((c%7) < 7, A[(a*2+(c//7)),b,(c%7),d], tv...
StarcoderdataPython
3215719
<gh_stars>1-10 import os from datetime import datetime def invalidate_paths(path_list): # Only run on Lambda if not "AWS_EXECUTION_ENV" in os.environ: return # We don't always have boto, because we're not always on Lambda # and it's not a dependancy of this project. Fail nicely in this case. ...
StarcoderdataPython
190016
<filename>src/vigorish/cli/menu_items/change_env_var_setting.py<gh_stars>1-10 """Menu that allows the user to view and modify environment variables.""" import subprocess from sys import exit from bullet import colors, Input from getch import pause from vigorish.cli.components import print_message, yes_no_cancel_promp...
StarcoderdataPython
3391046
from flask import url_for, request, render_template, redirect from sfa_dash.api_interface import (sites, observations, forecasts, cdf_forecast_groups, aggregates) from sfa_dash.blueprints.dash import DataDashView from sfa_dash.errors import DataRequestException class DeleteConfirm...
StarcoderdataPython
167612
### # Imports ### from discord.ext import commands, tasks import discord from asyncio import sleep ### # Cog Configuration ### pausetime = 20 ### # Cog ### class status(commands.Cog): def __init__(self, bot): self.bot = bot self.statuschanger.start() @tasks.loop(seconds=pausetime) as...
StarcoderdataPython
4824678
<filename>explore/tierGUI.py # -*- coding: utf-8 -*- import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output from textwrap import dedent external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_sty...
StarcoderdataPython
147710
<filename>corere/main/__init__.py default_app_config = "corere.main.apps.MainConfig"
StarcoderdataPython
3356995
<reponame>glauberiano/Keystroke-Dynamics-RS from abc import ABC, abstractmethod class UserModel(ABC): """ Base class for user_models classification algorithms. In case of adaptive system, features must be adapted.""" def __init__(self,name,features): self.name=name self.features=features ...
StarcoderdataPython
15817
<reponame>sinasiruosnejad/leetcode def string_to_list(string,array): x=input(string) i=1 while x[i]!=']': if x[i]!=',': j=i temp='' while x[j]!=',': if x[j]==']': break temp+=x[j] j+=1 ...
StarcoderdataPython
3227751
from apispec import APISpec from apispec.ext.marshmallow import MarshmallowPlugin from apispec_webframeworks.flask import FlaskPlugin from flask import Flask from marshmallow import Schema, fields # Create an APISpec spec = APISpec( title="Swagger Petstore", version="1.0.0", openapi_version="3.0.2", p...
StarcoderdataPython
3313744
#!/usr/bin/env python __description__ = '/o plugin for oledump.py' __author__ = '<NAME>' __version__ = '0.0.1' __date__ = '2016/04/16' """ Source code put in public domain by Didier Stevens, no Copyright https://DidierStevens.com Use at your own risk History: 2016/04/16: start Todo: """ import struct class cFO...
StarcoderdataPython
172663
import pytest from asgiref.testing import ApplicationCommunicator as HttpCommunicator from asgi_cors_middleware import CorsASGIApp from .asgi_app import app @pytest.mark.asyncio async def test_init_app(): communicator = HttpCommunicator( scope={"type": "http", "http_version": "1.0", "method": "GET", "path...
StarcoderdataPython
3337673
from __future__ import division # workaround of the bug where 'import torchvision' sets the start method to be 'fork' import torch.multiprocessing as mp if mp.get_start_method(allow_none=True) != 'spawn': mp.set_start_method('spawn') import logging from log_helper import init_log, print_speed init_log('brc') init_...
StarcoderdataPython
147800
<reponame>oscarliu666/partia-flood-warning-system from floodsystem.flood import stations_highest_rel_level from floodsystem.utils import sorted_by_key from floodsystem.stationdata import build_station_list from floodsystem.stationdata import update_water_levels from floodsystem.datafetcher import fetch_measure_levels f...
StarcoderdataPython
3303710
from django.conf.urls import url from rest_framework import routers from talentmap_api.common.urls import get_retrieve, post_create from talentmap_api.feature_flags.views import featureflags as views router = routers.SimpleRouter() urlpatterns = [ url(r'^$', views.FeatureFlagsView.as_view({**get_retrieve, 'post': ...
StarcoderdataPython
3261688
import argparse import pandas as pd from utils import load_parse_file, get_frames_by_id, write_results from ml_engine_utils import download_file_from_storage, save_in_gcs from multiprocessing import Pool from nostradamus import run_prophet from multiprocessing import Pool, cpu_count from functools import partial import...
StarcoderdataPython
1649407
# 003-Fibonacci.py # List fibonacci numbers # New concept: constant-like variables a = 0 b = 1 c = a + b UNTIL = 1000 print(0) print(1) while c < UNTIL: print(c) a = b b = c c = a + b
StarcoderdataPython
140778
<gh_stars>1-10 import pandas as pd from matplotlib import pyplot as plt import os import numpy as np from my_reegis import results, upstream_analysis # getting path to data from IFAM owncloud def load_agora_from_owncloud(path_to_data='ownCloud/FhG-owncloud-Quarree-AB3/Daten/Agora/', year=2014): # selecting sprea...
StarcoderdataPython
166660
<gh_stars>1-10 FERNET_KEY = '<KEY> SECRET_KEY = <KEY>" FERNET_TTL = 3600
StarcoderdataPython
3305166
<gh_stars>0 # Buscando os links da pagina pela tag <a> import requests from bs4 import BeautifulSoup pagina = requests.get('http://www.uninove.br') pagebs = BeautifulSoup(pagina.text, 'html.parser') # encontra todos os links uninove = pagebs.find_all('a') for i in uninove: print(i.prettify()) input('Tecle ENTER...
StarcoderdataPython
1690314
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here from itertools import accumulate def chec...
StarcoderdataPython
168345
<gh_stars>0 # -*- coding: UTF-8 -*- import os import sys import time import json import re # import MySQLdb import pymysql import smtplib import requests import redis from queue import Queue from typing import List, Dict, Tuple, Any, TypeVar from collections import namedtuple from functools import wraps from datetime i...
StarcoderdataPython
138350
<reponame>christophuv/PeakBot_Publication #!/usr/bin/env python # coding: utf-8 ## run in python >= 3.8 ## activate conda environment on jucuda ## conda activate python3.8 # Imports import os import pickle import tempfile import tqdm import numpy as np from numba import jit import numba from collections import Ordere...
StarcoderdataPython
4832981
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: # lstA = [] # lstB = [] # while headA is not None: # ...
StarcoderdataPython
1684547
##def reverse(x): ## if len(x) % 2 == 0: ## y = int(len(x)/2) ## else: ## y = int((len(x) - 1)/2) ## letters = [] ## for j in range(len(x)): ## letters.append(x[j]) ## for i in range(y): ## letters[i], letters[-1-i] = letters[-1-i], letters[i] ## return ''.join(le...
StarcoderdataPython
1786198
<reponame>en0/dnry-configuration<filename>dnry/config/delegate/__init__.py<gh_stars>0 from dnry.config.delegate.source import DelegateSource
StarcoderdataPython
1627510
<gh_stars>1-10 #!/usr/bin/env python3 # coding=utf-8 # # Copyright (c) 2021 Huawei Device Co., Ltd. # 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/licen...
StarcoderdataPython
1676613
<filename>allennlp/commands/predict.py """ The ``predict`` subcommand allows you to make bulk JSON-to-JSON predictions using a trained model and its :class:`~allennlp.service.predictors.predictor.Predictor` wrapper. .. code-block:: bash $ python -m allennlp.run predict --help usage: python -m allennlp.run [co...
StarcoderdataPython
3214764
<reponame>beschulz/ved-decoder #!/usr/bin/python # ugly path patching import sys import os sys.path.append(os.path.abspath(os.path.join(__file__, '..', 'lib'))) import base64 from proto.ved_pb2 import Ved ''' The type of link encoded in the ved message. If you find out, what other values mean, please either send m...
StarcoderdataPython
109236
<reponame>YuYang0901/LaViSE import os import sys import torch import json import numpy as np if sys.version_info[0] == 2: import cPickle as pickle else: import pickle from PIL import Image import torchvision.transforms as transforms from torch.utils.data import Dataset from torchvision.datasets import CocoDet...
StarcoderdataPython
3228286
<filename>dask/bytes/_pyarrow.py<gh_stars>0 from __future__ import absolute_import import pyarrow as pa class HDFS3Wrapper(pa.filesystem.DaskFileSystem): """Pyarrow compatibility wrapper class""" def isdir(self, path): return self.fs.isdir(path) def isfile(self, path): return self.fs.isf...
StarcoderdataPython
94937
<reponame>matthewdeanmartin/jiggle_version """ Is that a version string, a tuple or a int or float? 'Cause in the wild people use all of those. """ from jiggle_version.parse_dunder_version import find_in_line, simplify_line def test_comments(): value = 'version="7.8.6.16.dev0",#JiggleVersionWasHere' result = ...
StarcoderdataPython
3204247
import os import time from cryptojwt.jws import factory from oidcmsg.key_jar import KeyJar from oidcmsg.oidc import RegistrationRequest from fedoidcmsg.signing_service import InternalSigningService from fedoidcmsg.signing_service import WebSigningServiceClient from fedoidcmsg.signing_service import make_internal_sign...
StarcoderdataPython