id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3296684
<reponame>Croydon/pt-recap #!/usr/bin/env python # -*- coding: utf-8 -*- from .requester import requester from .calculation import calculation from .templater import templater def main(args): """ Main entry point :param args: User arguments """ start_date = "20181101" end_date = "20181130" ...
StarcoderdataPython
3307881
<filename>bbpyp/common/service/queue_service.py from bbpyp.common.model.queue_type import QueueType class QueueService: def __init__(self, queue_factory, named_item_service, metric_service): self._queue_factory = queue_factory self._named_queue = named_item_service self._metric_service = m...
StarcoderdataPython
3200261
## Time Series Filters from __future__ import print_function import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm dta = sm.datasets.macrodata.load_pandas().data index = pd.Index(sm.tsa.datetools.dates_from_range('1959Q1', '2009Q3')) print(index) dta.index = index del dta['year'] del...
StarcoderdataPython
1794286
from django.apps import AppConfig class SetkaEditorConfig(AppConfig): name = 'setka_editor'
StarcoderdataPython
3351362
<reponame>nvloff/song_status import sys import os import json import codecs ScriptName = "Google Play Current Song" Website = "https://github.com/nvloff/song_status" Description = "Provides variables to show the currently playing song from Google Desktop Player" Creator = "<NAME><<EMAIL>>" Version = "1.0.0.0" m_Song...
StarcoderdataPython
114841
import asyncio import uvloop from rich import traceback from command import Command if __name__ == '__main__': traceback.install() uvloop.install() asyncio.run(Command.execute())
StarcoderdataPython
3388974
<gh_stars>0 from r2base.index.index import Index from r2base.mappings import BasicMapping import pytest import time WORK_DIR = "." def test_basic_crud(): mappings = {'f1': {'type': 'keyword'}, 'f2': {'type': 'integer'}, 'f3': {'type': 'float'}, 'f4': {'type': 'dat...
StarcoderdataPython
154096
# coding: utf-8 # # Broadcasting a spectrum - Two spectral Components model # In[ ]: from astropy.io import fits import numpy as np import scipy as sp from scipy.interpolate import interp1d from scipy.stats import chisquare from PyAstronomy.pyasl import dopplerShift import matplotlib.pyplot as plt get_ipython().ma...
StarcoderdataPython
179944
import unittest import hail as hl import hail.expr.aggregators as agg from subprocess import DEVNULL, call as syscall import numpy as np from struct import unpack import hail.utils as utils from hail.linalg import BlockMatrix from math import sqrt from .utils import resource, doctest_resource, startTestHailContext, st...
StarcoderdataPython
3314260
<reponame>kevinyamauchi/morphometrics import numpy as np import trimesh from morphometrics.utils.surface_utils import ( closed_surfaces_to_label_image, voxelize_closed_surface, ) def _make_cuboid_mesh(origin: np.ndarray, extents: np.ndarray) -> trimesh.Trimesh: max_point = origin + extents vertices ...
StarcoderdataPython
3205970
<gh_stars>0 #!/usr/bin/env python3 from ev3dev2.sensor import * from ev3dev.ev3 import * from time import sleep from ev3dev2.motor import OUTPUT_A,OUTPUT_B,MoveTank,SpeedPercent sensor1.mode = sensor1.MODE_COL_COLOR class Anda: def __init__(): rodas=MoveTank(OUTPUT_A,OUTPUT_B) pr...
StarcoderdataPython
1798145
from .lofo_importance import LOFOImportance from .flofo_importance import FLOFOImportance from .dataset import Dataset from .plotting import plot_importance
StarcoderdataPython
3385876
# script to transform a PSM-xml model into a graph (saved as pdf) with objects as nodes and parent-child relationships as vertices using graphviz dot. #the central function here is xmltopdf(). it takes a directory (with trailing "//" or "\") and a name (without file ending). #it opens the directory + <name>.xml model a...
StarcoderdataPython
3360265
# coding: utf-8 ##################################################################### # Fill csv file while watching the glyphs of a IconFont # autor: <NAME> # ##################################################################### import tkinter import os from fontTools.ttLib import TTFont raiz = tkinter.T...
StarcoderdataPython
1776233
<gh_stars>1-10 from functions.get_nag_vertex_type import get_nag_vertex_type from functions.get_nag_vertex_number import get_nag_vertex_number def to_tuple(a,b): return (a,b) l = ['c0', 'c1', 'i1', 'n1', 'o1', 'i2', 'n2', 'n3'] print(sorted(l, key=lambda n: (get_nag_vertex_type(n), get_nag_vertex_number(n))))
StarcoderdataPython
97987
<filename>server/testing.py<gh_stars>0 # from game import Game # from player import Player # from board import Board # id = 1 # conn_queue = [] # player = Player('127.0.0.1', 'Chirag') # conn_queue.append(player) # game = Game(id, conn_queue) # b = Board() # player.get_name() # # print(game, player) # # print(game.play...
StarcoderdataPython
147605
<reponame>crvernon/kids_math<filename>kids_math/gifs.py import pkg_resources from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" from IPython import display class PeterRabbitGif: # Source: https://tenor.com/view/smile-wink-peter-rabbit-peter-rabbit-gifs-...
StarcoderdataPython
151671
import pytest from emrichen import Template HASHES = { 'MD5': '8b1a9953c4611296a827abf8c47804d7', 'SHA1': 'f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0', 'SHA256': '185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969', } @pytest.mark.parametrize('h', sorted(HASHES.items()), ids=sorted(HASHES)) ...
StarcoderdataPython
1650577
<gh_stars>1-10 ## ## imports ## from abc import ABC, abstractmethod import time import misc ## ## code ## class X0GenericCmd(ABC): """The main Apex state object that does the magic""" def __init__(self, inComm, useLog, timeoutConfig, closeOnComplete = True): self.log = useLog self.desired =...
StarcoderdataPython
3232998
<gh_stars>0 from django.shortcuts import render from django.http import HttpResponseRedirect from .models import Obat from .forms import ObatForm from django.core import serializers from django.http.response import HttpResponse # Create your views here. def index(request): obats = Obat.objects.all() response = ...
StarcoderdataPython
1638446
path = "input.txt" file = open(path) input = [line[:-1] for line in file.readlines()] file.close() class Octopus: def __init__(self, x, y, energy): self.x = x self.y = y self.energy = energy self.neighbours = [] self.flashed = False def find_neighbours(self, octo): ...
StarcoderdataPython
1608838
from syned.util.json_tools import load_from_json_file from syned.storage_ring.electron_beam import ElectronBeam from syned.storage_ring.magnetic_structures.undulator import Undulator from syned.beamline.optical_elements.ideal_elements.screen import Screen from syned.beamline.optical_elements.ideal_elements.lens impor...
StarcoderdataPython
1676536
<filename>experimental/time_steppers.py<gh_stars>1-10 # -*- coding: utf-8 -*- # import numpy class Heun(object): ''' Heun's method for :math:`u' = F(u)`. https://en.wikipedia.org/wiki/Heun's_method ''' order = 2.0 def __init__(self, problem): self.problem = problem # alpha = ...
StarcoderdataPython
1624576
<reponame>Ornella-KK/my-gallery # Generated by Django 3.1.4 on 2020-12-21 07:20 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('gallery', '0004_auto_20201220_1115'), ] operations = [ migrations.RenameField( model_name='image', ...
StarcoderdataPython
107837
from datetime import datetime, timedelta from collections import defaultdict import os import glob import yaml from airflow import DAG from airflow.operators.data_quality_threshold_check_operator import DataQualityThresholdCheckOperator from airflow.operators.data_quality_threshold_sql_check_operator import DataQualit...
StarcoderdataPython
50603
<filename>pysweng/oop.py def dummy_function(a): return a DUMMY_GLOBAL_CONSTANT_0 = 'FOO'; DUMMY_GLOBAL_CONSTANT_1 = 'BAR';
StarcoderdataPython
1742801
<reponame>New2World/AnimEx import os import cv2 import argparse import skimage.metrics import fixer.fix_image as f_img def parse_arg(): parser = argparse.ArgumentParser() parser.add_argument('-i', dest='inp_path', required=True) parser.add_argument('-o', dest='outp_path', default=None) parser.add_arg...
StarcoderdataPython
1788340
<filename>src/pytorch_adapt/adapters/adda.py<gh_stars>1-10 import copy from ..containers import KeyEnforcer, MultipleContainers, Optimizers from ..hooks import ADDAHook from ..utils.common_functions import check_domain from .base_adapter import BaseAdapter from .utils import default_optimizer_tuple, with_opt class A...
StarcoderdataPython
1730409
from .errors import * from .layers import * from .loss import * from .models import *
StarcoderdataPython
51935
<filename>src/dl/models/decoders/residual/block.py import torch import torch.nn as nn from ...modules import ResidualConvBlockPreact, ResidualConvBlock class MultiBlockResidual(nn.ModuleDict): def __init__( self, in_channels: int, out_channels: int, same_padding: b...
StarcoderdataPython
3235217
<reponame>gleis44/stellwerk<filename>addons/hr_leave_request_aliasing/models/__init__.py # -*- coding: utf-8 -*- from . import leave_request_alias from . import res_config # from . import web_planner
StarcoderdataPython
49114
<reponame>DazEB2/SimplePyScripts #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' """ Папоротник / Fern """ # Оригинал: http://www.cyberforum.ru/pascalabc/thread994987.html # uses GraphABC,Utils; # # const # n=255; # max=10; # # var # x,y,x1,y1,cx,cy: real; # i,ix,iy: integer; # // z...
StarcoderdataPython
3328766
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest import numpy as np import networkx as nx from graphdot.graph import Graph from graphdot.graph.reorder import pbr def n_tiles(A, tile_size=8): A = A.tocoo() tiles = np.unique( np.array([A.row // tile_size, A.col // tile_size]), axis=1 ...
StarcoderdataPython
3316345
# -*- coding: utf-8 -*- # @Author: zero_kelvin # @Date: 2021-06-30 19:17:03 # @Last Modified by: zero_kelvin # @Last Modified time: 2021-06-30 19:17:49 print("Welcome to the rollercoaster!") height = int(input("What is your height in cm? ")) bill = 0 if height >= 120: print("You are tall enough to ride this rol...
StarcoderdataPython
3393298
import os # from pathlib import Path # import re import shutil import sys import simur import prepPDB #------------------------------------------------------------------------------- # #------------------------------------------------------------------------------- def about_cvdump(): print(' You need to have c...
StarcoderdataPython
4825529
from txaws.credentials import AWSCredentials from txaws.service import AWSServiceEndpoint from txaws.testing.ec2 import FakeEC2Client from txaws.testing.s3 import MemoryS3 from txaws.testing.route53 import MemoryRoute53 class FakeAWSServiceRegion: key_material = "" def __init__(self, access_key="", secret_k...
StarcoderdataPython
1627279
<reponame>Make-Munich/SaBoT # -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-01-11 13:45 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('exhibitor', '0002_exhibitor_year'), ] operations = [ ...
StarcoderdataPython
144643
from snake_utils import * from snake_agent_ai import * from snake_agent_astar import * from snake_agent_greedy import * from snake_agent_bfs import * from snake_agent_rl_qlearning import * class AgentFactory(): def __init__(self, session, agent_type : Agents): self._session = session self._agent_t...
StarcoderdataPython
1607451
<filename>azure-kusto-data/azure/kusto/data/security.py # Copyright (c) Microsoft Corporation. # Licensed under the MIT License from typing import Optional, Dict, TYPE_CHECKING from urllib.parse import urlparse from ._token_providers import ( TokenProviderBase, BasicTokenProvider, CallbackTokenProvider, ...
StarcoderdataPython
1152
<gh_stars>1-10 # Copyright 2020 Soil, Inc. from soil.openstack.base import DataBase from soil.openstack.base import SourceBase class SnapshotData(DataBase): """A class for openstack snapshot data""" def __init__(self, data): self.data = data['snapshot'] class Snapshot(SourceBase): """A cla...
StarcoderdataPython
1717304
# -*- coding: utf-8 -*- from django.contrib.gis.db.models.query import GeoQuerySet as BaseGeoQuerySet from django_orm.cache.queryset import ObjectCacheMixIn class GeoQuerySet(ObjectCacheMixIn, BaseGeoQuerySet): pass
StarcoderdataPython
1717101
<filename>useintest/tests/common.py<gh_stars>1-10 import re from useintest.common import MOUNTABLE_TEMP_DIRECTORY MOUNTABLE_TEMP_CREATION_KWARGS = {"dir": MOUNTABLE_TEMP_DIRECTORY} MAX_RUN_TIME_IN_SECONDS = 120 _EXTRACT_VERSION_PATTERN = re.compile("[0-9]+(_[0-9]+)*") def extract_version_number(string: str) -> st...
StarcoderdataPython
177752
# standard imports from landsat_metadata import landsat_metadata from dnppy import core import math import os import arcpy if arcpy.CheckExtension('Spatial')=='Available': arcpy.CheckOutExtension('Spatial') arcpy.env.overwriteOutput = True __all__=['toa_reflectance_8', # complete 'toa_re...
StarcoderdataPython
14634
<reponame>syz247179876/Flask-Sports # -*- coding: utf-8 -*- # @Time : 2020/12/1 下午11:24 # @Author : 司云中 # @File : production.py # @Software: Pycharm from configs.default import DefaultConfig class ProductionConfig(DefaultConfig): """the config of production env""" DEBUG = False TESTING = False MONGOD...
StarcoderdataPython
3255963
<gh_stars>0 import nanome import os from functools import partial dir_path = os.path.dirname(os.path.realpath(__file__)) MENU_PATH = dir_path + "/WebLoad.json" PPT_TAB_PATH = dir_path + "/PPTTab.json" IMAGE_TAB_PATH = dir_path + "/ImageTab.json" LIST_ITEM_PATH = dir_path + "/ListItem.json" UP_ICON_PATH = dir_path + "/...
StarcoderdataPython
90141
# -*- coding: utf-8 -*- import ustruct as struct class ValueType: STRING = "string" CHAR = "char" DOUBLE = "double" FLOAT = "float" INT = "int" UINT = "uint" SHORT = "short" BOOLEAN = "boolean" def fill_bytes(byte_array, start, end, value, value_type): if value_type == ValueType....
StarcoderdataPython
3377065
<reponame>KidLanz/bash_basics<filename>littleBuster.py #!/bin/bash # read the name of the user and print hello #echo "Hello! What is your name" #read name #echo "Welcome, $name" # single quotes prevent the expansion of the variable #echo 'Your name was stored in $name' # exercise: write a script that asks the user f...
StarcoderdataPython
154148
"""A utility class to summarize all results in a directory. """ __author__ = '<NAME>' from dataclasses import dataclass, field from pathlib import Path import logging import pandas as pd from zensols.util.time import time from zensols.deeplearn import DatasetSplitType from . import ( ModelResult, DatasetResult, M...
StarcoderdataPython
3212804
<reponame>ming-hai/spleeter<gh_stars>1000+ #!/usr/bin/env python # coding: utf8 """ This module provides audio data convertion functions. """ # pyright: reportMissingImports=false # pylint: disable=import-error import numpy as np import tensorflow as tf from ..utils.tensor import from_float32_to_uint8, from_uint8_to...
StarcoderdataPython
3334432
<reponame>noxowl/PDFConcierge<filename>concierge/scraper/mk.py import os import bs4.element import eyed3.id3 import requests import re import eyed3 import tempfile from bs4 import BeautifulSoup from tqdm import tqdm from urllib.parse import urlparse, parse_qs from multiprocessing import Pool from concierge.logger impo...
StarcoderdataPython
1724036
<filename>devconf/ast/config.py import ast.mixins.node class Content(ast.mixins.node.Node): def __init__(self): super().__init__() class DeviceConfiguration(ast.mixins.node.Node): def __init__(self): super().__init__() self._content = None def get_content(self) -> Content: ...
StarcoderdataPython
156846
import enum import random from typing import Dict, Iterable, List, Tuple, Optional, NamedTuple from emoji import descriptions, spec_parser from emoji.core import Emoji, Gender, Modifier from syllables import count_syllables def _load_resources() -> Tuple[Dict[Emoji, str], List[Modifier]]: """Loads emojis and des...
StarcoderdataPython
3337886
<gh_stars>0 def informar(*args): telaExibiPrecoAdicionais = args[0] telaAdicionais = args[1] cursor = args[2] QtWidgets = args[3] setar_checkBox_false = args[4] telaExibiPrecoAdicionais.show() listaAdc = [] id = 0 if (telaAdicionais.checkBox1.isChecked()): id = str(1) i...
StarcoderdataPython
1690229
<reponame>sean-hayes/zoom """ content app """ from zoom.apps import App from zoom.page import page from zoom.tools import load_content, home import traceback import logging class CustomApp(App): def __call__(self, request): logger = logging.getLogger(__name__) logger.debug('called content ap...
StarcoderdataPython
144265
<filename>stdlib/copy_qs.py import copy # "Assignment statements in Python do not copy objects" - PSF # typical interview question, assignment/copy/deepcopy d = {'a': [0, 1]} #d_copy = copy.copy(d) # shallow copy, same as: d_copy = d.copy() d_copy = copy.deepcopy(d) d_copy['a'].append(2) print(d, d_copy)
StarcoderdataPython
3292164
#!/bin/env python import os from xml.dom import minidom class Res(object): mytype = '' idtype = '' def __init__(self, resid='', prefix='', path=''): self.resid = resid self.path = path self.prefix = prefix def __str__(self): return self.prefix + self.resid class Image...
StarcoderdataPython
123311
<reponame>Cluedo-MLH-Hackathon/Cluedo-Project import os import shutil def recursive_walk(folder): for folderName, subfolders, filenames in os.walk(folder): if subfolders: for subfolder in subfolders: recursive_walk(subfolder) #print('\nFolder: ' + folderName + '\n...
StarcoderdataPython
3207588
from rest_framework import serializers from .models import * from rest_framework.validators import UniqueValidator class ResourceSerializer(serializers.ModelSerializer): cpu_percent = serializers.SerializerMethodField() ram_percent = serializers.SerializerMethodField() policy_name = serializers.Serializer...
StarcoderdataPython
3387291
<filename>python/download-forcing-inputs/src/download_forecast/__init__.py<gh_stars>0 # -*- coding: utf-8 -*- """ Functions to download forecast data from different sources """ from math import floor,ceil import numpy as np from pydap.client import open_url from datetime import datetime, timedelta, date, time import ...
StarcoderdataPython
1759194
<reponame>elielagmay/react-budgeteer<gh_stars>1-10 from django.db import models from app.utils import get_balances class Category(models.Model): ledger = models.ForeignKey( 'ledger.Ledger', on_delete=models.PROTECT, related_name='categories' ) name = models.CharField(max_length=255...
StarcoderdataPython
1718849
""" This inline script can be used to dump flows as HAR files. example cmdline invocation: mitmdump -s ./har_dump.py --set hardump=./dump.har filename endwith '.zhar' will be compressed: mitmdump -s ./har_dump.py --set hardump=./dump.zhar """ import json import base64 import typing import tempfile import re from d...
StarcoderdataPython
3318800
import os import json configJSON=open("mattermost/config/default.json").read() config = json.loads(configJSON) for envVar in os.environ: if envVar.startswith("MM_"): key = envVar[3:] jsonPath = key.split("_") lastKey = jsonPath.pop() print("Setting " + ".".join(jsonPath) + "." + lastKey) targetElement = co...
StarcoderdataPython
3301303
<filename>pyheaders/cpp/record.py<gh_stars>1-10 ''' Represents a C++ record (class, struct). ''' from collections import namedtuple from keyword import iskeyword from typing import Any, Iterable, List, Text, Tuple, Union from .scope import Scope, split, normalize from .types import remove_template class Record(Scop...
StarcoderdataPython
1635221
<filename>thonnycontrib/JuiceMind/__init__.py import logging import os import re from thonny import get_workbench, get_runner from thonny.ui_utils import scale from thonny.ui_utils import select_sequence import logging import threading import time #Don't undestand what these do DESKTOP_SESSION = os.environ.get("DE...
StarcoderdataPython
3385490
<filename>iati/tests/functional_tests.py """A module for functional tests.""" from conftest import LOCALHOST class TestHomePageExists(): """A container for tests that the home page exists.""" def setup_home_page_tests(self, browser): """Visit the home page and locate the IATI logo.""" browser...
StarcoderdataPython
25694
# Copyright (c) 2018 <NAME> # # 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 without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute,...
StarcoderdataPython
74408
def main(string: str) -> int: return string.count()
StarcoderdataPython
1633974
import requests from bs4 import BeautifulSoup from credentials import LOGIN_PASSWORD, LOGIN_USERNAME, HEADERS, SERVER_URL, VILLAGE_URL def logged_in_session(): session = requests.Session() session.headers = HEADERS html = session.get(VILLAGE_URL).text resp_parser = BeautifulSoup(html, 'html.parser')...
StarcoderdataPython
1733058
<filename>tests/test_multiply.py import optmod import unittest import numpy as np class TestMultiply(unittest.TestCase): def test_contruction(self): x = optmod.variable.VariableScalar(name='x') f = optmod.function.multiply([x, optmod.expression.make_Expression(1.)]) self.assertTrue(isinst...
StarcoderdataPython
1782608
<gh_stars>0 import win32com.client # 연결 여부 체크 objCpCybos = win32com.client.Dispatch("CpUtil.CpCybos") bConnect = objCpCybos.IsConnect if (bConnect == 0): print("PLUS가 정상적으로 연결되지 않음. ") exit() # 종목코드 리스트 구하기 objCpCodeMgr = win32com.client.Dispatch("CpUtil.CpCodeMgr") codeList = objCpCodeMgr.GetStockListByM...
StarcoderdataPython
3262685
<filename>photoplaces/photoplaces_web/photo_entry_normalization.py from models import PhotoLocationEntry, NormalizedPhotoSet, NormalizedPhotoEntry import numpy as np from math_functions.cyclical_math import * from math_functions.normalization import * from Queue import Queue from threading import Thread, Event def vis...
StarcoderdataPython
3323810
<reponame>darienmorrow/research_kit import numpy as np import WrightTools as wt def gauss(t, t0, fwhm): sigma = fwhm / (2 * np.sqrt(2 * np.log(2))) return np.exp(-((t - t0) ** 2) / (2 * sigma ** 2)) def exp(t, t1, A1, B, t0): # applies a heaviside step function zero = t0 out = np.zeros(t.size) ...
StarcoderdataPython
188416
<gh_stars>0 import asyncio import aiohttp from discord import Embed from discord.ext import commands, tasks from ..utils.config import BOT_COLOR, API_KEY, getsetTime, getUser DEBUG_MODE = False class Modio(commands.Cog): # guild: int = 422847864172183562 # UAMT server # channel: int = 518607442901204992 ...
StarcoderdataPython
3259913
<gh_stars>1-10 from sys import argv as CLIARGS from os import system as run_in_shell, walk from os.path import join rootDir = CLIARGS[1] outDir = CLIARGS[2] filePairs = ( (join(root, file), join(outDir, file)) for root, folders, files in walk(rootDir) for file in files ) count = 0 cmd = 'f...
StarcoderdataPython
170916
#!/usr/bin/env python3 # pylint: disable=C0111 import os from pyndl import count TEST_ROOT = os.path.dirname(__file__) EVENT_RESOURCE_FILE = os.path.join(TEST_ROOT, "resources/event_file_trigrams_to_word.tab.gz") CORPUS_RESOURCE_FILE = os.path.join(TEST_ROOT, "resources/corpus.txt") def test_cues_outcomes(): ...
StarcoderdataPython
3302622
#!/usr/bin/env python # encoding: utf-8 row_data = [ { 'images': [ 'goods/images/1_P_1449024889889.jpg', 'goods/images/1_P_1449024889264.jpg', 'goods/images/1_P_1449024889726.jpg', 'goods/images/1_P_1449024889018.jpg', 'goods/images/1_P_1449024889...
StarcoderdataPython
110333
<reponame>rkingsbury/mdgo # coding: utf-8 # Copyright (c) <NAME>. # Distributed under the terms of the MIT License. """ This module implements a core class PackmolWrapper for packing molecules into a single box. You need the Packmol package to run the code, see http://m3g.iqm.unicamp.br/packmol or http://leandro.iqm....
StarcoderdataPython
159152
import logging import json import re import urllib.parse from urllib.request import urlopen FORMAT = '[%(levelname)s] (%(threadName)-9s) %(message)s' logging.basicConfig(format=FORMAT) # Decoders for API Output - TODO: Proper error handling def _decode_json(s): try: if s == '': logging.info('...
StarcoderdataPython
70280
<reponame>Leonardo-YXH/DevilYuan import ssl import random import requests from requests.adapters import HTTPAdapter from requests.packages.urllib3.poolmanager import PoolManager from .DyTrader import * class Ssl3HttpAdapter(HTTPAdapter): def init_poolmanager(self, connections, maxsize, block=False): self...
StarcoderdataPython
78481
<filename>deepgenmodels/autoregressive/nade_test.py #!/usr/bin/env python3 # External dependencies. import torch import torch.optim as optim from mpl_toolkits import mplot3d import matplotlib.pyplot as plt # Internal dependencies. from nade import NADE # Sample classification with artificial 3D data. if __name__ == ...
StarcoderdataPython
1691897
## Code for calling the owner of this PiPatrol. This part integrates with an IFTTT Maker Event applet. import webbrowser, sys, os # define trigger URL url = <INSERT_URL_GIVEN_BY_IFTTT_HERE> # path to the web browser chrome_path = '/usr/lib/chromium-browser/chromium-browser' # command to open URL in browser webb...
StarcoderdataPython
1791829
<gh_stars>0 import pandas as pd def get_base_df(): tuples = [ ('cobra', 'mark i'), ('cobra', 'mark ii'), ('sidewinder', 'mark i'), ('sidewinder', 'mark ii'), ('viper', 'mark ii'), ('viper', 'mark iii') ] index = pd.MultiIndex.from_tuples(tuples) values = [[12, 2], [0, 4], [10, ...
StarcoderdataPython
1782179
#!/usr/bin/python2 ''' This is the assembler I wrote for the bored assembly ''' import sys import struct if len(sys.argv) < 3: print "usage {0} inFile.bd out [-v]".format(sys.argv[0]) exit(-1) csm_file = open(sys.argv[1]) code_file = open(sys.argv[2], "wb") def pack(a): return struct.pack("I", a) def ...
StarcoderdataPython
65920
from utils._context.library_version import LibraryVersion, Version from utils import context context.execute_warmups = lambda *args, **kwargs: None def test_version_comparizon(): v = Version("1.0", "some_component") assert v == "1.0" assert v != "1.1" assert v <= "1.1" assert v <= "1.0" as...
StarcoderdataPython
190767
<gh_stars>1-10 class APP: APPLICATION = "denon-commander" AUTHOR = "<NAME>" VERSION = "V1.0" class CONNECTION: # I recommend to set static IP address on device IP = "192.168.1.150" class DEFAULT: # Default volume from -80 to 18 VOLUME = "-40" # Default input INPUT = "G...
StarcoderdataPython
3357475
<reponame>CPT-Jack-A-Castle/metalk8s """Expose a really crude mock of K8s API for use in rendering tests.""" import collections import re from typing import Any, Dict, Iterator, List, Optional import pytest APIVersion = str Kind = str ItemList = List[Any] K8sData = Dict[APIVersion, Dict[Kind, ItemList]] # pylint:...
StarcoderdataPython
3270545
import os, glob, cv2 import torch import random import linecache import numpy as np from torch.utils.data import Dataset from PIL import Image class MAKEUP(Dataset): def __init__(self, image_path, transform, mode, transform_mask, cls_list): self.image_path = image_path self.transform = transform ...
StarcoderdataPython
1770307
class Restaurant: """餐馆""" def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe_restaurant(self): print('餐馆名称:' + self.restaurant_name) print('餐品名称:' + self.cuisine_type) def open_restau...
StarcoderdataPython
3332668
# -*- coding: utf-8 -*- import sys import random import time from PIL import Image import argparse import os.path import pickle import subprocess from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from ppadb.client import...
StarcoderdataPython
4839075
<reponame>TestQA14/PythonIntroduction<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- loop = 1 choice = 0 def menu(): print "We have several operations : " print "Option 1 - plus" print "Option 2 - minus" print "Option 3 - multiply" print "Option 4 - divide" print "Option 5 - exit"...
StarcoderdataPython
166607
class Solution(object): def alertNames(self, keyName, keyTime): """ :type keyName: List[str] :type keyTime: List[str] :rtype: List[str] """ mapp = {} for i in range(len(keyName)): name = keyName[i] if(name not in mapp): ...
StarcoderdataPython
1622854
import time import matplotlib as mpl import matplotlib.pyplot as plt import pytest from pytest import approx from rpi.stepper import Stepper plt.style.use('dark_background') class PiMock: """Fake pigpio.pi""" def gpio_trigger(self, user_gpio, pulse_len=10, level=1): pass def set_mode(self, gpi...
StarcoderdataPython
4837487
<reponame>auderson/numba import weakref from numba.core import types class DataModelManager(object): """Manages mapping of FE types to their corresponding data model """ def __init__(self): # { numba type class -> model factory } self._handlers = {} # { numba type instance -> mod...
StarcoderdataPython
3326070
import os import csv # Create a path for budget_data file csv_path = os.path.join('Resources', 'budget_data.csv') # create a list to store number of rows number_rows = [] change_list = [] temp_list = [] # For increments Net_ProfitLoss = 0 Change = 0.0 index_min = 0 index_max = 0 min_date = "" max_date = "" count = ...
StarcoderdataPython
3206419
<filename>libs/json/createDocsForParemeters.py<gh_stars>0 #!/usr/bin/python import jinja2 import json def getJsonFromFile(filename): data = None foundError = False f = None try: # Opening JSON file f = open(filename) # returns JSON object as a dictionary data = json.lo...
StarcoderdataPython
1741169
<gh_stars>0 """Contains Saga class""" import asyncio import itertools import logging from typing import Any, Callable, List, Optional from uuid import uuid4 logger = logging.getLogger("sagah") class SagaFailed(Exception): """Raised when a saga fails""" def __init__(self, transaction: "SagaTransaction") -> ...
StarcoderdataPython
3347774
from highcliff.actions.actions import AIaction class MonitorAirflow(AIaction): def __init__(self, ai): super().__init__(ai) self.effects = {"is_airflow_adjustment_needed": True} self.preconditions = {} def behavior(self): # decide if adjustment is needed and update the world a...
StarcoderdataPython
3326520
from django.contrib.auth.forms import UserCreationForm from UsersApp.models import Account from ArticlesApp.models import Author from django import forms from django.db import transaction # noinspection PySuperArguments class AuthorSignUpForm(UserCreationForm, forms.Form): """Form for fill sign up. """ class...
StarcoderdataPython
3312082
from base import Constant from errors import Request from models import Mark as _Mark_, Type from .mixins import Identify class Mark(Identify): CONNECTION_LIMIT = Constant.RIGID_CONNECTION_LIMIT def _validate(self, request): super()._validate(request) self.__type = self._get(request, 'type',...
StarcoderdataPython
3216729
import numpy as np import scipy.linalg as spla from scipy.spatial.distance import cdist def chol2inv(chol): return spla.cho_solve((chol, False), np.eye(chol.shape[ 0 ])) def matrixInverse(M): return chol2inv(spla.cholesky(M, lower=False)) def compute_kernel(lls, lsf, x, z): ls = np.exp(lls) sf = n...
StarcoderdataPython