id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
4894444
<reponame>uw-advanced-robotics/aruw-vision-platform-2019 #!/usr/bin/env python import rospy import common_utils from common_utils import watch_for_robot_id, RobotType, register_robot_type_changed_handler from four_wheel_mecanum_drive import SoldierDrive, HeroDrive, EngineerDrive from sentinel_drive import SentinelDrive...
StarcoderdataPython
1629965
import itertools import json import random from abc import ABC from pathlib import Path import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset as TorchDataset from typing import Callable, List, Iterable, Tuple from deepproblog.dataset import Dataset from deepproblog.query i...
StarcoderdataPython
3233573
<reponame>yash0307jain/competitive-programming import time from pprint import pprint def ratMaze(arr, row, col, ans): if (row == len(arr) - 1) and (col == len(arr) - 1): ans[row][col] = 1 return True # bottom if row + 1 < len(arr): if (arr[row + 1][col] == 1): ans[row][col] = 1 arr[row...
StarcoderdataPython
3237087
<gh_stars>1-10 from utils.world_utils import ( SECTOR_BYTES, SECTOR_INTS, CHUNK_HEADER_SIZE, VERSION_GZIP, VERSION_DEFLATE, block_coords_to_chunk_coords, chunk_coords_to_region_coords, region_coords_to_chunk_coords, blocks_slice_to_chunk_slice, gunzip, from_nibble_array, ) f...
StarcoderdataPython
5193213
import os import requests api_token = os.getenv('THEMOVIEDB_API_KEY') def get_json(path, **params): url = f'https://api.themoviedb.org/3/{path}' all_params = {'api_key': api_token} | params try: r = requests.get(url, params=all_params) except requests.exceptions.RequestException: ...
StarcoderdataPython
11267751
from src.Devices.Sensors.BME280 import BME280 from src.Devices.Sensors.BME680 import BME680 from src.Devices.Sensors.CCS811 import CCS811 from src.Devices.Sensors.DS18B20 import DS18B20 from src.Devices.Sensors.LTR559 import LTR559 from src.Devices.Sensors.PMS5003 import PMS5003 class Factory: @staticmethod ...
StarcoderdataPython
9734784
<gh_stars>0 # 01 - Dada a lista l = [5, 7, 2, 9, 4, 1, 3], escreva um programa # que imprima as seguintes informações: # # a) tamanho da lista. # b) maior valor da lista. # c) menor valor da lista. # d) soma de todos os elementos da lista. # e) lista em ordem crescente. # f) lista em ordem decrescente. l = [5, 7, 2,...
StarcoderdataPython
3516867
<filename>deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/EXT/paletted_texture.py '''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GL import _types as _cs # End users want this... from OpenGL.raw.GL._types import * from Open...
StarcoderdataPython
12849935
#!/usr/bin/env python3 """script for testing connection to database""" import pyodbc import sys import os from models.user import User import models driver = os.environ.get('CONTACT_SQL_DRIVER') server = os.environ.get('CONTACT_SQL_SERVER') database = os.environ.get('CONTACT_SQL_DB') username = os.environ.get('CONTACT...
StarcoderdataPython
8032023
# Copyright (c) The University of Edinburgh 2014-2015 # # 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
3492777
<gh_stars>0 # !/usr/bin/env python3 # Author: C.K # Email: <EMAIL> # DateTime:2021-09-11 10:13:05 # Description: class Solution: def isIsomorphic(self, s: str, t: str) -> bool: d1, d2 = {}, {} for i, val in enumerate(s): d1[val] = d1.get(val, []) + [i] for i, val in enumerate(t):...
StarcoderdataPython
349469
<reponame>realandrewyang/let-me-in<gh_stars>0 import pandas as pd import numpy as np # States of a course NOT_FOUND = -1 OPEN = 0 FILLED = 1 OVERFILLED = 2 # Checks a course capacity given a course id # and returns the state and the number of free spots # Parameters: # course - pandas dataframe row # course_id - str ...
StarcoderdataPython
6537235
<filename>tests/test_te_python.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `te_python` module.""" import pytest import requests from te_python import te_python def test_te_python_initialization(): response = te_python.email_get_details('a53b7747d6bd3f59076d63469d92924e00f407ff472e5a53993645318...
StarcoderdataPython
6585074
<filename>examples/benchmark.py<gh_stars>0 # coding:utf-8 import glob import os import shutil import timeit from statistics import mean from lxml.html import fromstring from selectolax.parser import HTMLParser pages = glob.glob('examples/pages/*.html') html_pages = [open(x, encoding='utf-8', errors='ignore').read() f...
StarcoderdataPython
6495449
"""Create done and validated columns Revision ID: 1a29f9f5c21c Revises: None Create Date: 2014-04-18 17:30:32.450777 """ # revision identifiers, used by Alembic. revision = '1a29f9f5c21c' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): op.add_column('project', sa.Column('don...
StarcoderdataPython
1885862
<gh_stars>0 from __future__ import annotations from typing import Any, Dict, Optional, Protocol __all__ = ("Snowflake", "Object", "to_snowflake") class Snowflake(Protocol): """ A class that represents a Snowflake. Attributes: id (int): The Snowflake ID. """ id: int class Object(Snowf...
StarcoderdataPython
6467611
<reponame>unicef/rapidpro-webhooks<filename>rapidpro_webhooks/apps/eum/supply_shipments.py import datetime import json import random from flask import abort, Blueprint, g, request import couchdbkit from rapidpro_webhooks.apps.core.decorators import limit from rapidpro_webhooks.apps.core.helpers import create_respons...
StarcoderdataPython
3596504
# Copyright (c) 2020 <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
11390245
#!/usr/bin/env python3 # # __init__.py """ Extensions to :mod:`sphinx.ext.autodoc`. .. versionadded:: 0.6.0 """ # # Copyright © 2020-2021 <NAME> <<EMAIL>> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal...
StarcoderdataPython
1718947
<reponame>bohblue2/lobpy """ Copyright (c) 2018, University of Oxford, Rama Cont and ETH Zurich, <NAME> calibration.py Contains objects and functions for calibration of the LOB models. To calibrate dynamics to a given time series of data on bid and ask side, data_bid and data_ask, with time stamps time_stamps which ...
StarcoderdataPython
1798371
#!/usr/bin/env python ############################################################################# ## # This file is part of Taurus ## # http://taurus-scada.org ## # Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain ## # Taurus is free software: you can redistribute it and/or modify # it under the terms of t...
StarcoderdataPython
9649264
<reponame>protonyx/labtronyx """ Getting Started --------------- The typical use case for Labtronyx is as a library that can be imported and used to introduce automation capability with external instruments. There are many cases, however, where automation with external instruments is the primary goal of a Python scrip...
StarcoderdataPython
3488258
<filename>.sagemathcloud/sage_parsing.py<gh_stars>0 """ sage_parser.py Code for parsing Sage code blocks sensibly. """ ######################################################################################### # Copyright (C) 2013 <NAME> <<EMAIL>> # # ...
StarcoderdataPython
5005939
<reponame>andrzejmalota/StockPricePrediction from src.utils.io import load, save import pandas as pd def save_targets(): data = load('../../data/raw/stock_data.pickle') save(pd.DataFrame(data['amazon'][['Date', 'Close']], columns=['Date', 'Close']), '../../data/processed/targets_amazon.pickle') if __name__ ...
StarcoderdataPython
1809705
import json import pandas as pd db_df = pd.read_csv("database.csv") db_df.to_csv("database_without_header.csv", header=False, index=False) db_1_df = db_df.sample(frac=0.5) db_2_df = db_df.drop(db_1_df.index) db_1_df.to_csv("database1.csv") db_2_df.to_csv("database2.csv") db_json = db_df.to_json(orient="records")...
StarcoderdataPython
1886205
import gym from pgdrive import PGDriveEnv def _a(env, action): assert env.action_space.contains(action) obs, reward, done, info = env.step(action) assert env.observation_space.contains(obs) assert isinstance(info, dict) def _step(env): try: obs = env.reset() assert env.observati...
StarcoderdataPython
4935174
<gh_stars>1-10 from project import ( calculator ) def main(): return calculator.add(3, 5) if __name__ == "__main__": main()
StarcoderdataPython
6584335
<gh_stars>1-10 # coding=utf-8 """ This module contains config objects needed by paypal.interface.PayPalInterface. Most of this is transparent to the end developer, as the PayPalConfig object is instantiated by the PayPalInterface object. """ import logging import os from pprint import pformat from paypal.compat import...
StarcoderdataPython
8192531
# This file is a part of the HiRISE DTM Importer for Blender # # Copyright (C) 2017 Arizona Board of Regents on behalf of the Planetary Image # Research Laboratory, Lunar and Planetary Laboratory at the University of # Arizona. # # This program is free software: you can redistribute it and/or modify it # under the term...
StarcoderdataPython
3326221
<reponame>vedant-jad99/GeeksForGeeks-DSA-Workshop-Complete-Codes<gh_stars>1-10 """ Link to the question - https://leetcode.com/explore/featured/card/july-leetcoding-challenge-2021/610/week-3-july-15th-july-21st/3817/ """ class Solution: def threeEqualParts(self, arr: List[int]) -> List[int]: """ --...
StarcoderdataPython
6615991
"""The rmvtransport component."""
StarcoderdataPython
4904895
import asyncio from typing import Type, Union, Callable, Optional from ..handler import await_exec_target from ..utils import search_event from ..entities.event import TemplateEvent, ParamRet from ..entities.auxiliary import BaseAuxiliary class StepOut(BaseAuxiliary): event_type: Type[TemplateEvent] handler: ...
StarcoderdataPython
1745148
<filename>engine/world/world_2d.py from engine.collision import CollisionCache, PositionalCollisionCache from engine.collision import resolve_physical_collision from engine.event_dispatcher import EventDispatcher from engine.geometry import detect_overlap_2d from .world_object import WorldObject, COLLIDER, TRIGGER cl...
StarcoderdataPython
3227406
# Copyright (c) The Diem Core Contributors # SPDX-License-Identifier: Apache-2.0 """This module defines action enum for flagging what should be follow up action of a `PaymentCommand` See `diem.offchain.payment_command.PaymentCommand.follow_up_action` for more details. """ from enum import Enum class Action(Enum): ...
StarcoderdataPython
1673371
<filename>moog_demos/gif_writer.py """Gif writer to record a video while playing the demo. Note: If the enter key prints `^M` instead of entering the input, run the following command: $ stty sane """ import imageio import logging import numpy as np import os import sys class GifWriter(object): """GifWriter clas...
StarcoderdataPython
6584122
<filename>python/leet_code/largest_continous_subarray.py ''' Given an array of integers nums and an integer limit, return the size of the longest continuous subarray such that the absolute difference between any two elements is less than or equal to limit. In case there is no subarray satisfying the given condition r...
StarcoderdataPython
375302
<reponame>TomWerner/AlumniMentoring<gh_stars>1-10 # -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-10-16 23:18 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mentoring', '0002_auto_20161016_1817'), ]...
StarcoderdataPython
5068903
from mstr.requests import AuthenticatedMSTRRESTSession from mstr.requests import MSTRRESTSession from mstr.requests.rest import exceptions import pytest @pytest.fixture(scope="function") def session(): return MSTRRESTSession( base_url="https://demo.microstrategy.com/MicroStrategyLibrary/api/" ) @py...
StarcoderdataPython
3584794
#!/usr/bin/env python3 # The MIT License # Copyright (c) 2016 Estonian Information System Authority (RIA), Population Register Centre (VRK) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software ...
StarcoderdataPython
3485379
<reponame>adamjakab/BeetsPluginGoingRunning # Copyright: Copyright (c) 2020., <NAME> # Author: <NAME> <adam at jakab dot pro> # License: See LICENSE.txt import os from beets import mediafile from beets.dbcore import types from beets.plugins import BeetsPlugin from beets.util.confit import ConfigSource, load_yaml f...
StarcoderdataPython
1655173
<filename>PythonExtensions/Setup/Classifiers.py class Development_Status(object): Planning = "Development Status :: 1 - Planning" PreAlpha = "Development Status :: 2 - Pre-Alpha" Alpha = "Development Status :: 3 - Alpha" Beta = "Development Status :: 4 - Beta" Production_Stable = "Development St...
StarcoderdataPython
337076
__________________________________________________________________________________________________ sample 44 ms submission class Solution: def checkStraightLine(self, coordinates: List[List[int]]) -> bool: n=len(coordinates) if n<=2: return True x0, y0 = coordinates[0] x1...
StarcoderdataPython
1700032
<filename>pymatflow/qe/post/scripts/post-qe-scf.py #!/usr/bin/env python # _*_ coding: utf-8 _*_ import os import sys import datetime import argparse import matplotlib.pyplot as plt from pymatflow.qe.post.scf import ScfOut if __name__ == "__main__": parser = argparse.ArgumentParser() parser.ad...
StarcoderdataPython
11224091
<reponame>opengauss-mirror/openGauss-OM<filename>script/local/KerberosUtility.py #!/usr/bin/env python3 #-*- coding:utf-8 -*- # Copyright (c) 2020 Huawei Technologies Co.,Ltd. # # openGauss is licensed under Mulan PSL v2. # You can use this software according to the terms # and conditions of the Mulan PSL v2. # You may...
StarcoderdataPython
1821471
<reponame>wahyutirta/CNN-numpy from lenet5 import * import numpy as np import matplotlib.pyplot as plt def plotimage(imgs): # create figure fig = plt.figure(figsize=(4, 7)) rows = 3 columns = 2 counter = 1 for img in imgs: fig.add_subplot(rows, columns, counter) ...
StarcoderdataPython
4934920
# Model Imports from project.reports.models import Report from project.users.models import User from project.posts.models import Post, Comment # Library Imports from django.contrib.contenttypes.models import ContentType # Util Imports from project.users.utils import UserUtil from project.posts.utils import ...
StarcoderdataPython
8048169
<gh_stars>0 # pylint:disable=unused-variable # pylint:disable=unused-argument # pylint:disable=redefined-outer-name import pytest from aiohttp import web from pytest_simcore.helpers.utils_assert import assert_error, assert_status from pytest_simcore.helpers.utils_login import NewInvitation, NewUser, parse_link from se...
StarcoderdataPython
62906
import random class Node: def __init__(self, k): self.key = k self.parent = None self.left = None self.right = None def insert(root, n): # n is new node # return root y = None x = root while x is not None: y = x if n.key < x.key: x...
StarcoderdataPython
6544440
from room import Room from item import Item from character import Character , Enemy , Friend from rpginfo import RPGinfo # no underscore = public # self.my_attribute = None # single underscore = protected # self._my_attribute = None # double underscore = private # self.__my_attribute = None #Static ...
StarcoderdataPython
8104907
def make_sandwich(*args): print("These ingredients are in your sandwich:") for arg in args: print(f"- {arg}") sandwich = ['lettuce', 'tomatoe', 'rocks'] make_sandwich('lettuce', 'tomatoe', 'potatoe', 'spinach') make_sandwich('olives', 'ham') make_sandwich(*sandwich)
StarcoderdataPython
125454
<filename>Cyborg Currency.py amount = int(input('''Copyright © 2021 <NAME> CURRENCY CONVERTER.lk --------------------- Please enter amount(LKR): ''')) con_currency = input("Please enter convert currency: ") if con_currency.upper() == "USD": converted = amount * 200 print(f"🛑🛑🛑 {amount} LKR is {convert...
StarcoderdataPython
8108365
<gh_stars>10-100 import json import requests import datetime class ultraChatBot(): def __init__(self, json): self.json = json self.dict_messages = json['data'] self.ultraAPIUrl = 'https://api.ultramsg.com/{{instance_id}}/' self.token = '{{token}}' def send_requests(self...
StarcoderdataPython
239918
from setuptools import setup setup( name='removestyles', version='0.0.1', py_modules=['removestyles'], install_requires=['ass>=0.5.1'], entry_points={ "console_scripts": ["removestyles=removestyles:main"] } )
StarcoderdataPython
12856837
from slackclient import SlackClient import requests import os from Config import slack_env_var_token, slack_username """ These functions take care of sending slack messages and emails """ def slack_chat_messenger(message): # NEVER LEAVE THE TOKEN IN YOUR CODE ON GITHUB, EVERYBODY WOULD HAVE ACCESS TO THE CHANN...
StarcoderdataPython
11363176
<reponame>bikramtuladhar/covid-19-procurement-explorer-admin # Generated by Django 3.1.2 on 2020-12-10 08:49 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ("country", "0006_tender_no_of_bidders"), ] operations =...
StarcoderdataPython
3453547
<filename>scripts/mnist.py #!/usr/bin/env python # # Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ # Written by <NAME> <<EMAIL>> # """Implement attention sampling for classifying MNIST digits.""" import argparse import json from os import path from keras import backend as K from keras.callbacks i...
StarcoderdataPython
3375781
<filename>Exercicios/Extras/U.py for linha in range(0, 7): for coluna in range(0, 7): if (((coluna == 1 or coluna == 5) and linha != 6) or (linha == 6 and coluna > 1 and coluna < 5)): print('*', end='') else: print(' ', end='') print()
StarcoderdataPython
314356
<reponame>vincentzlt/textprep<gh_stars>10-100 #!/usr/bin/env python # coding: utf-8 import argparse as ap import collections as cl import re import itertools as it import json import os import sys import fileinput as fi def _str2bool(v): if v.lower() in ('yes', 'true', 't', 'y', '1'): return True eli...
StarcoderdataPython
6495856
"""CSC110 Fall 2021 Prep 9: Programming Exercises Instructions (READ THIS FIRST!) =============================== This Python module contains several function headers and descriptions. We have marked each place you need to fill in with the word "TODO". As you complete your work in this file, delete each TODO comment....
StarcoderdataPython
3434851
class Solution: def search(self, nums: List[int], target: int) -> int: b,e = 0,len(nums)-1 while b<=e: m = b+((e-b)//2) if nums[m]==target: return m elif nums[m]>target: e=m-1...
StarcoderdataPython
3568064
<reponame>iguinn/pygama import numpy as np from numba import guvectorize from pygama.dsp.errors import DSPFatal @guvectorize(["void(float32[:], float32, float32[:], float32[:])", "void(float64[:], float64, float64[:], float64[:])"], "(n),()->(),()", nopython=True, cache=True) def saturation(...
StarcoderdataPython
4838879
# Generated by Django 4.0 on 2022-02-05 13:08 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('catalog', '0002_bookinstance_borrower_alter_author_date_of_birth_and_more'), ] operations = [ migrations.AlterModelOptions( name='bookinst...
StarcoderdataPython
3367937
<gh_stars>0 """ This creates Figure 4. Gene expression R2X with flattened matrix dimension reconstruction. """ import seaborn as sns from .figureCommon import subplotLabel, getSetup from tensorpack import perform_CMTF from ..dataHelpers import form_tensor, proteinNames def makeFigure(): """ Get a list of the axi...
StarcoderdataPython
1778166
<gh_stars>0 from typing import List class Solution: # [1, 2, 3, 4] -> [1, l1, l1*l2, l1*l2*l3] -> [l2*l3*l4, (l1*l2)*l3, ...] def productExceptSelf(self, nums: List[int]) -> List[int]: res = [] base_num = 1 for num in nums: res.append(base_num) base_num = base_nu...
StarcoderdataPython
6596076
<gh_stars>10-100 #!/usr/bin/env python __author__ = "<NAME>" import re import logging import os import shutil from genomic_tools_lib import Logging, Utilities def run(args): if not args.reentrant: if os.path.exists(args.output_folder): logging.info("Output path exists. Nope.") ret...
StarcoderdataPython
5000959
<reponame>UChicagoSUPERgroup/analytic-password-cracking """ This file contains classes used across different modules """ from enum import Enum import os from pyparsing import srange class RunningStyle(Enum): """ An enum that denotes the run time style. Either JtR or Hashcat """ JTR = 0 HC = 1 class Fat...
StarcoderdataPython
69473
<reponame>aleksandromelo/Exercicios cont = ('zero', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez') n = int(input('Digite um número entre 0 e 10: ')) print(f'Você digitou o número {cont[n]}.')
StarcoderdataPython
3263443
import pandas as pd import seaborn as sns import matplotlib as plt df = pd.read_csv(r'C:\Users\<NAME>\evolucaoadmit.csv') print('=================IMPRIMINDO GRAFICO==============', '\n',df) estado = df.loc[0] print(estado) media = int(estado.iloc[3:11].mean()) mediana= int(estado.iloc[3:11].median()) print(media) prin...
StarcoderdataPython
148669
<gh_stars>0 from typing import List class Node: def __init__(self, val, children): self.val = val self.children = children class Solution: """ 给定一个 N 叉树,返回其节点值的后序遍历。 例如,给定一个 3叉树 : 返回其后序遍历: [5,6,3,2,4,1]. 说明: 递归法很简单,你可以使用迭代法完成此题吗? 来源:力扣(LeetCode) 链接:https://leetcod...
StarcoderdataPython
5168729
import socket, sys, argparse, subprocess, time, random from multiprocessing.pool import ThreadPool import torch def get_open_port(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('', 0)) port = s.getsockname()[1] s.close() return port def create_server(args, gpu_idx): '''start...
StarcoderdataPython
140222
from flask import Flask,render_template, request, redirect, url_for, abort, flash, session import sqlalchemy from werkzeug.security import generate_password_hash from flask_login import login_manager, login_user, login_required,logout_user,current_user,LoginManager from flask_user import roles_required from datetime im...
StarcoderdataPython
12827276
<reponame>whamcloud/iml-agent from mock import patch import unittest from chroma_agent.plugin_manager import DevicePluginManager, ActionPluginManager from chroma_agent.lib.agent_teardown_functions import agent_daemon_teardown_functions from chroma_agent.lib.agent_startup_functions import agent_daemon_startup_functions...
StarcoderdataPython
8070366
<reponame>GetPastTheMonkey/advent-of-code<filename>aoc2018/day10/day10_part2.py<gh_stars>1-10 print("This is actually really simple:") print("\t- Run part 1 of this day") print("\t- Check the images folder") print("\t- Look for the image where you can read the string") print("\t- Check the number in the filename, this ...
StarcoderdataPython
9760806
from collections import defaultdict from itertools import repeat from typing import TypeVar, Iterable from zpy.classes.bases.tree import Forest, Tree from zpy.classes.collections.array import Array from zpy.classes.logical.maybe import Maybe, Nothing, Just T = TypeVar("T") class UnionFind(Forest[T]): class _Uni...
StarcoderdataPython
1758885
#!/usr/bin/python # # This tools exploits the data of csv files produced by script collect-ce-job-status.py, to # compute the running ratio R/(R+W) as a function of time # # Results are stored in file running_ratio.csv. import os import csv import globvars # ---------------------------------------------------------...
StarcoderdataPython
9718355
<reponame>surroundaustralia/Prez from typing import Dict, Optional, Union from fastapi.responses import Response, JSONResponse, PlainTextResponse from connegp import RDF_MEDIATYPES, MEDIATYPE_NAMES from renderers import ListRenderer from config import * from profiles.vocprez_profiles import dcat, dd from models.vocpr...
StarcoderdataPython
5036139
''' Copyright 2017 <NAME> Changes authored by <NAME>: Copyright 2018 The Johns Hopkins University Applied Physics Laboratory LLC. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must reta...
StarcoderdataPython
18062
<gh_stars>1-10 from django.conf.urls import patterns, url from main import views urlpatterns = patterns('', url(r'^$', views.inicio, name='inicio'), url(r'^acerca/', views.acerca, name='acerca'), url(r'^contacto/', views.contacto, name='contacto'),...
StarcoderdataPython
4984485
<gh_stars>10-100 import itertools from string import Template import numpy as np from PuzzleLib.Cuda.Utils import roundUpDiv upsampleNearestTmpl = Template(""" extern "C" __global__ void upsample2dNearest(float *outdata, const float *indata, int inh, int inw, int outh, int outw, int hscale, int wscale) { ...
StarcoderdataPython
5035338
<reponame>Staberinde/data-hub-api # Generated by Django 3.2.6 on 2021-08-16 16:01 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('omis_quote', '0008_update_permissions_django_21'), ] operations = [ migrations.AlterModelTable( name='...
StarcoderdataPython
1683577
<filename>blog/admin.py from django.contrib import admin from blog.models import Category, Post, Comment @admin.register(Category) class CategoryAdmin(admin.ModelAdmin): list_display = ['id', 'name', 'created_at', 'updated_at', 'is_published'] list_display_links = ['id', 'name', ] @admin.register(Post) cla...
StarcoderdataPython
3448529
""" Preprocess small barriers into data needed by API and tippecanoe for creating vector tiles. This is run AFTER `preprocess_road_crossings.py`. Inputs: * Small barriers inventory from SARP, including all network metrics and summary unit IDs (HUC12, ECO3, ECO4, State, County, etc). * `road_crossings.csv` created us...
StarcoderdataPython
1822033
'''ResNet1d in PyTorch. For Pre-activation ResNet, see 'preact_resnet.py'. Reference: [1] <NAME>, <NAME>, <NAME>, <NAME> Deep Residual Learning for Image Recognition. arXiv:1512.03385 This is a copy-paste from: https://github.com/kuangliu/pytorch-cifar/blob/master/models/resnet.py I just changed 2d conv and batch...
StarcoderdataPython
3551476
from typing import Callable, Dict, List, Optional import pytest from web3 import Web3 from web3.contract import Contract from raiden_contracts.constants import ( CONTRACT_MONITORING_SERVICE, CONTRACT_ONE_TO_N, CONTRACT_SECRET_REGISTRY, CONTRACT_SERVICE_REGISTRY, CONTRACT_TOKEN_NETWORK, CONTRAC...
StarcoderdataPython
89887
<gh_stars>0 import logging import logging.handlers from katana.shared_utils.kafkaUtils import kafkaUtils from katana.utils.sliceUtils import sliceUtils # Logging Parameters logger = logging.getLogger(__name__) file_handler = logging.handlers.RotatingFileHandler("katana.log", maxBytes=10000, backupCount=5) stream_han...
StarcoderdataPython
276368
import numbers import factorial import fibonacci import infodb import tennis import tree import facclass import factorsimp import factorsclass import palindrome border = "=" * 25 banner = f"\n{border}\nPlease Select An Option\n{border}" patterns_menu = [ ["Tree", tree.pattern], ["Tennis Animation", tennis.te...
StarcoderdataPython
22782
<gh_stars>10-100 #!/usr/bin/env python # Copyright 2017 The Kubernetes 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 ...
StarcoderdataPython
5138198
<reponame>shizhediao/SEDST3 def clean_replace(s, r, t, forward=True, backward=False): def clean_replace_single(s, r, t, forward, backward, sidx=0): idx = s[sidx:].find(r) if idx == -1: return s, -1 #idx += sidx idx_r = idx + len(r) if backward: while ...
StarcoderdataPython
6454102
# -*- coding: utf-8 -*- # This file is part of the Rocket Web Server # Copyright (c) 2012 <NAME> # Import System Modules import re import sys import socket import logging import traceback from wsgiref.headers import Headers from threading import Thread from datetime import datetime try: from urllib import unquot...
StarcoderdataPython
4992960
<filename>corditea/__init__.py from .crop_array import CropArray from .gamma_augment import GammaAugment from .impulse_noise_augment import ImpulseNoiseAugment from .intensity_crop import IntensityCrop from .lambda_filter import LambdaFilter from .lambda_source import LambdaSource from .multiply import Multiply from .r...
StarcoderdataPython
176484
<gh_stars>1-10 import pickle def pickle_dump(file_path, file): with open(file_path, 'wb') as f: pickle.dump(file, f) # print(f'Logging Info - Saved: {file_path}') def pickle_load(file_path): try: with open(file_path, 'rb') as f: obj = pickle.load(f) # print(f'Logging ...
StarcoderdataPython
5049076
<gh_stars>1-10 from bs4 import BeautifulSoup as bs import datetime def extract(filename): with open(filename) as file: soup = bs(file, features="html.parser") classes_html = soup.find_all("textarea", {"class": "campo"}) time_html = soup.find_all("td", {"class": "horario"}) infos = soup.find_...
StarcoderdataPython
3331402
<reponame>g-jami/COMPAS-II-FS2021<gh_stars>10-100 import math from compas.datastructures import Mesh from compas.geometry import Point, Vector, Frame, Circle, Plane, Line from compas.geometry import Cylinder, Box from compas.geometry import Transformation, Translation from compas.utilities import pairwise from comp...
StarcoderdataPython
1874824
<filename>rundeck-libext/cache/py-winrm-plugin-2.0.13/winrm-filecopier.py try: import os; os.environ['PATH'] except: import os os.environ.setdefault('PATH', '') import winrm import argparse import sys import base64 import time import common import logging import ntpath import xml.etree.ElementTree as ET import color...
StarcoderdataPython
6450894
# Question 8 num1 = float(input("Enter 1st number: ")) num2 = float(input("Enter 2nd number: ")) num3 = float(input("Enter 3rd number: ")) sums = num1 + num2 + num3 if num1 == num2 == num3: print(sums * 3)
StarcoderdataPython
1628101
<filename>heroku3/core.py # -*- coding: utf-8 -*- """ heroku3.core ~~~~~~~~~~~ This module provides the base entrypoint for heroku3.py. """ from .api import Heroku import requests def from_key(api_key, session=None, **kwargs): """Returns an authenticated Heroku instance, via API Key.""" if not session: ...
StarcoderdataPython
3566227
<reponame>PeloriTech/Osiris import requests from osiris_server.settings import TENSORFLOW_SERVE_URL class TensorflowServeGateway: url_predict= '/v1/models/{}:predict' @staticmethod def predict(jpeg_bytes, model) -> int: server_url = TENSORFLOW_SERVE_URL server_url += TensorflowServeGate...
StarcoderdataPython
1919182
<gh_stars>10-100 import numpy as np from pathlib import Path import matplotlib.pyplot as plt from ..station import StationDb def set_background(stations="black"): """Display the map background (earth and stations) Args: stations (str): If non empty, provides the matplotlib color to be us...
StarcoderdataPython
8018222
<filename>pywikibot/family.py # -*- coding: utf-8 -*- # # (C) Pywikipedia bot team, 2004-2013 # # Distributed under the terms of the MIT license. # __version__ = '$Id: 68f136e606fe94a1cbfa585bdd9cfdfb5b51f1b2 $' import logging import re import urllib import config2 as config import pywikibot logger = logging.getLo...
StarcoderdataPython
1700942
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2012 <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 re...
StarcoderdataPython