uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6d66e46275b3da8ca9a82264 | train | class | class FindFluxMonitorsNode(BaseFindFluxNode):
name = "Find Flux Monitors"
use_browser = Bool(False)
def run(self, state):
if not self.irradiation or not self.level:
self.configure()
if not self.irradiation or not self.level:
state.veto = self
else:
... | class FindFluxMonitorsNode(BaseFindFluxNode):
| name = "Find Flux Monitors"
use_browser = Bool(False)
def run(self, state):
if not self.irradiation or not self.level:
self.configure()
if not self.irradiation or not self.level:
state.veto = self
else:
dvc = self.dvc
args = dvc.get_... | fluxes,
)
for ip in ips
if ip.identifier
]
state.monitor_positions = monitor_positions
state.irradiation = self.irradiation
state.level = self.level
def traits_view(self):
... | 165 | 165 | 552 | 11 | 153 | ASUPychron/pychron | pychron/pipeline/nodes/find.py | Python | FindFluxMonitorsNode | FindFluxMonitorsNode | 332 | 414 | 332 | 332 | 3a733488a7785533fe1036ddcd53f0ae890369e5 | bigcode/the-stack | train |
5ff78216a33868e850d9da06 | train | class | class FindNode(DVCNode):
pass
| class FindNode(DVCNode):
| pass
| ,
NULL_STR,
REFERENCE_ANALYSIS_TYPES,
BLANKS,
)
def compress_groups(ans):
if ans:
for i, (gid, analyses) in enumerate(groupby_group_id(ans)):
for ai in analyses:
ai.group_id = i
class FindNode(DVCNode):
| 64 | 64 | 10 | 7 | 56 | ASUPychron/pychron | pychron/pipeline/nodes/find.py | Python | FindNode | FindNode | 44 | 45 | 44 | 44 | 8896ac4c2111d28886e19a6d320015de6cdda3de | bigcode/the-stack | train |
08ea773ac92f511f0f7d637d | train | class | class FindReferencesNode(FindNode):
user_choice = False
threshold = Float
load_name = Str
display_loads = Property(depends_on="limit_to_analysis_loads")
loads = List
analysis_loads = List
limit_to_analysis_loads = Bool(True)
threshold_enabled = Property
analysis_types = List
... | class FindReferencesNode(FindNode):
| user_choice = False
threshold = Float
load_name = Str
display_loads = Property(depends_on="limit_to_analysis_loads")
loads = List
analysis_loads = List
limit_to_analysis_loads = Bool(True)
threshold_enabled = Property
analysis_types = List
available_analysis_types = List
... | .irradiation = self.irradiation
state.level = self.level
def _load_hook(self, nodedict):
self.level = nodedict.get("level", "")
if self.level and self.level not in self.levels:
self.dirty = True
def _to_template(self, d):
super(FindFluxMonitorsNode, self)._to_te... | 256 | 256 | 1,639 | 8 | 247 | ASUPychron/pychron | pychron/pipeline/nodes/find.py | Python | FindReferencesNode | FindReferencesNode | 417 | 664 | 417 | 417 | 9dec7438a53afa01451c7605b39ca70c8ebabe14 | bigcode/the-stack | train |
d1b8f22bea068ff9b1b59d65 | train | class | class BaseFindFluxNode(FindNode):
irradiation = Str
irradiations = Property
samples = Property(depends_on="irradiation, level")
levels = Property(depends_on="irradiation, dirty")
level = Str
monitor_sample_name = Str(DEFAULT_MONITOR_NAME)
dirty = Event
exclude = "%_MST"
def load(sel... | class BaseFindFluxNode(FindNode):
| irradiation = Str
irradiations = Property
samples = Property(depends_on="irradiation, level")
levels = Property(depends_on="irradiation, dirty")
level = Str
monitor_sample_name = Str(DEFAULT_MONITOR_NAME)
dirty = Event
exclude = "%_MST"
def load(self, nodedict):
self.irradia... | .pychron_constants import (
DEFAULT_MONITOR_NAME,
NULL_STR,
REFERENCE_ANALYSIS_TYPES,
BLANKS,
)
def compress_groups(ans):
if ans:
for i, (gid, analyses) in enumerate(groupby_group_id(ans)):
for ai in analyses:
ai.group_id = i
class FindNode(DVCNode):
pass
... | 197 | 197 | 658 | 9 | 187 | ASUPychron/pychron | pychron/pipeline/nodes/find.py | Python | BaseFindFluxNode | BaseFindFluxNode | 65 | 150 | 65 | 65 | edda7e95198bb99df6b2de2955300e1214743aec | bigcode/the-stack | train |
4e5c94a5d80cd00189a463c1 | train | class | class FindFluxMonitorMeansNode(BaseFindFluxNode):
name = "Find Flux Monitor Means"
exclude = None
include_all_positions = Bool
def _load_hook(self, nodedict):
self.irradiation = nodedict.get("irradiation", "")
self.level = nodedict.get("level", "")
if self.level and self.level n... | class FindFluxMonitorMeansNode(BaseFindFluxNode):
| name = "Find Flux Monitor Means"
exclude = None
include_all_positions = Bool
def _load_hook(self, nodedict):
self.irradiation = nodedict.get("irradiation", "")
self.level = nodedict.get("level", "")
if self.level and self.level not in self.levels:
self.dirty = True
... | ", cols=6),
),
enabled_when="irradiation",
label="Levels",
),
Item("monitor_sample_name"),
Item("use_saved_means"),
width=300,
height=300,
title="Select Irradiation and Level",
resizable=T... | 170 | 170 | 569 | 11 | 159 | ASUPychron/pychron | pychron/pipeline/nodes/find.py | Python | FindFluxMonitorMeansNode | FindFluxMonitorMeansNode | 240 | 329 | 240 | 240 | 3f72dc8d3c733cd0eee3c74fdc1e5c1c1cfb4b6c | bigcode/the-stack | train |
6a6298be264a411ae64d8546 | train | class | class FindRepositoryAnalysesNode(FindNode):
repositories = List
def run(self, state):
dvc = self.dvc
rs = []
for ri in self.repositories:
ans = dvc.get_repoository_analyses(ri)
rs.extend(ans)
unks, refs = partition(rs, predicate=lambda x: x.analysis_type... | class FindRepositoryAnalysesNode(FindNode):
| repositories = List
def run(self, state):
dvc = self.dvc
rs = []
for ri in self.repositories:
ans = dvc.get_repoository_analyses(ri)
rs.extend(ans)
unks, refs = partition(rs, predicate=lambda x: x.analysis_type == "unknown")
state.unknowns = unks... | BLANKS,
)
def compress_groups(ans):
if ans:
for i, (gid, analyses) in enumerate(groupby_group_id(ans)):
for ai in analyses:
ai.group_id = i
class FindNode(DVCNode):
pass
class FindRepositoryAnalysesNode(FindNode):
| 64 | 64 | 111 | 10 | 53 | ASUPychron/pychron | pychron/pipeline/nodes/find.py | Python | FindRepositoryAnalysesNode | FindRepositoryAnalysesNode | 48 | 62 | 48 | 48 | fe20df0b1795ee861fad80eab4462e5a562c2fb1 | bigcode/the-stack | train |
69979e5815a7c414367fc4e7 | train | class | class FindVerticalFluxNode(FindIrradiationNode):
name = "Find Vertical Flux"
exclude = None
use_saved_means = Bool(False)
def _configure_hook(self):
if not self.irradiation:
self.irradiation = self.irradiations[0]
def traits_view(self):
v = self._view_factory(
... | class FindVerticalFluxNode(FindIrradiationNode):
| name = "Find Vertical Flux"
exclude = None
use_saved_means = Bool(False)
def _configure_hook(self):
if not self.irradiation:
self.irradiation = self.irradiations[0]
def traits_view(self):
v = self._view_factory(
Item("irradiation", editor=EnumEditor(name="ir... | style="custom",
editor=CheckListEditor(name="levels", cols=6),
),
enabled_when="irradiation",
label="Levels",
),
width=300,
height=300,
title="Select Irradiation and Level",
... | 80 | 80 | 269 | 13 | 66 | ASUPychron/pychron | pychron/pipeline/nodes/find.py | Python | FindVerticalFluxNode | FindVerticalFluxNode | 196 | 233 | 196 | 196 | ce944e5b4a059105919a333efb2e05778e164aaa | bigcode/the-stack | train |
54c8ee20fd5ae5ba27e0d1e3 | train | class | class TransferFluxMonitorMeansNode(FindIrradiationNode):
name = "Transfer Flux Monitor Means"
| class TransferFluxMonitorMeansNode(FindIrradiationNode):
| name = "Transfer Flux Monitor Means"
| monitors = self.dvc.find_flux_monitors(
self.irradiation, state.levels, self.monitor_sample_name
)
state.unknowns = monitors
state.use_saved_means = self.use_saved_means
class TransferFluxMonitorMeansNode(FindIrradiationNode):
| 64 | 64 | 23 | 14 | 49 | ASUPychron/pychron | pychron/pipeline/nodes/find.py | Python | TransferFluxMonitorMeansNode | TransferFluxMonitorMeansNode | 236 | 237 | 236 | 236 | b5a383517361f6a2c73e107734661a7c79aea720 | bigcode/the-stack | train |
fd01e3dbd64eb5c1468d2d6c | train | class | class PoolEscrow(Base):
address = fields.String()
asset = fields.String()
amount = fields.Integer()
| class PoolEscrow(Base):
| address = fields.String()
asset = fields.String()
amount = fields.Integer()
| .DateTime()
active_cu = fields.Float()
active_su = fields.Float()
empty_at = fields.Integer() # can't be set to date because of max int64 value
customer_tid = fields.Integer()
active_workload_ids = fields.List(fields.Integer())
class PoolEscrow(Base):
| 64 | 64 | 24 | 6 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | PoolEscrow | PoolEscrow | 659 | 662 | 659 | 659 | 7a1d85a65b84ef37356fb2632732509688d04280 | bigcode/the-stack | train |
1e421e6c86cac866907b5c44 | train | class | class NodeIface(Base):
name = fields.String(default="")
addrs = fields.List(fields.IPRange())
gateway = fields.List(fields.IPRange())
| class NodeIface(Base):
| name = fields.String(default="")
addrs = fields.List(fields.IPRange())
gateway = fields.List(fields.IPRange())
| = fields.Object(Location)
public_key_hex = fields.String(default="")
workloads = fields.Object(WorkloadsAmount)
managed_domains = fields.List(fields.String())
tcp_router_port = fields.Integer()
dns_nameserver = fields.List(fields.String())
free_to_use = fields.Boolean()
class NodeIface(Base):
| 64 | 64 | 31 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | NodeIface | NodeIface | 97 | 100 | 97 | 97 | 5e5be709f9c567cdd85cac132335e17dd90225a2 | bigcode/the-stack | train |
130f23d8835f2f9128e8ddf6 | train | class | class Pool(Base):
pool_id = fields.Integer()
cus = fields.Float()
sus = fields.Float()
ipv4us = fields.Float()
node_ids = fields.List(fields.String())
last_updated = fields.DateTime()
active_cu = fields.Float()
active_su = fields.Float()
empty_at = fields.Integer() # can't be set to... | class Pool(Base):
| pool_id = fields.Integer()
cus = fields.Float()
sus = fields.Float()
ipv4us = fields.Float()
node_ids = fields.List(fields.String())
last_updated = fields.DateTime()
active_cu = fields.Float()
active_su = fields.Float()
empty_at = fields.Integer() # can't be set to date because of m... | 4us = fields.Integer()
node_ids = fields.List(fields.String())
currencies = fields.List(fields.String())
class PoolCreate(Base):
json = fields.String()
data_reservation = fields.Object(PoolCreateData)
customer_tid = fields.Integer()
customer_signature = fields.String()
class Pool(Base):
| 64 | 64 | 103 | 4 | 60 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Pool | Pool | 645 | 656 | 645 | 645 | 2c6eb85ec1f1c024086ee2709722f72dd49c7868 | bigcode/the-stack | train |
be542fded739206e6abecc23 | train | class | class Farm(Base):
id = fields.Integer()
threebot_id = fields.Integer()
iyo_organization = fields.String(default="")
name = fields.String(default="")
wallet_addresses = fields.List(fields.Object(WalletAddress))
location = fields.Object(Location)
email = fields.Email()
resource_prices = fi... | class Farm(Base):
| id = fields.Integer()
threebot_id = fields.Integer()
iyo_organization = fields.String(default="")
name = fields.String(default="")
wallet_addresses = fields.List(fields.Object(WalletAddress))
location = fields.Object(Location)
email = fields.Email()
resource_prices = fields.List(fields.O... | fields.Float()
def __str__(self):
return ",".join([x for x in [self.continent, self.country, self.city] if x])
class FarmerIP(Base):
address = fields.IPRange()
gateway = fields.IPAddress()
reservation_id = fields.Integer()
class Farm(Base):
| 64 | 64 | 121 | 4 | 60 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Farm | Farm | 52 | 65 | 52 | 52 | d09a0cd25a7cc2a7f521085966ac9bc4f1dad13d | bigcode/the-stack | train |
048f29f9abc0b1d8b3a395c1 | train | class | class PaymentDetail(Base):
reservation_id = fields.Integer()
escrow_information = fields.Object(EscrowDetail)
| class PaymentDetail(Base):
| reservation_id = fields.Integer()
escrow_information = fields.Object(EscrowDetail)
| # to_delete = fields.Boolean()
class EscrowDetail(Base):
farmer_id = fields.Integer()
total_amount = fields.Float()
class Escrow(Base):
address = fields.String(default="")
asset = fields.String(default="")
details = fields.List(fields.Object(EscrowDetail))
class PaymentDetail(Base):
| 64 | 64 | 23 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | PaymentDetail | PaymentDetail | 485 | 487 | 485 | 485 | 699ce353653e4abc09b553fffdefc3f8df0c6e2c | bigcode/the-stack | train |
d23606da319086ad88fedf36 | train | class | class Reservation(Base):
id = fields.Integer()
json = fields.String(default="")
data_reservation = fields.Object(ReservationData)
customer_tid = fields.Integer()
customer_signature = fields.String(default="")
next_action = fields.Enum(NextAction)
signatures_provision = fields.List(fields.Obj... | class Reservation(Base):
| id = fields.Integer()
json = fields.String(default="")
data_reservation = fields.Object(ReservationData)
customer_tid = fields.Integer()
customer_signature = fields.String(default="")
next_action = fields.Enum(NextAction)
signatures_provision = fields.List(fields.Object(Signature))
signa... | Subdomain))
domain_delegates = fields.List(fields.Object(GatewayDelegate))
gateway4to6 = fields.List(fields.Object(Gateway4to6))
expiration_provisioning = fields.DateTime()
expiration_reservation = fields.DateTime()
currencies = fields.List(fields.String())
class Reservation(Base):
| 64 | 64 | 116 | 4 | 60 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Reservation | Reservation | 614 | 626 | 614 | 614 | 430322280d25ae0c6e712dad8a640d43ee293733 | bigcode/the-stack | train |
c8fd4c55b2b70f83fabd34f9 | train | class | class DeployedReservation(Base):
reservation_id = fields.Integer()
customer_tid = fields.Integer()
| class DeployedReservation(Base):
| reservation_id = fields.Integer()
customer_tid = fields.Integer()
| Gateway4to6 = 9
Network_resource = 10
Public_IP = 11
class ZDBMode(Enum):
Seq = 0
User = 1
class DiskType(Enum):
HDD = 0
SSD = 1
class DeployedReservation(Base):
| 64 | 64 | 20 | 6 | 57 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | DeployedReservation | DeployedReservation | 268 | 270 | 268 | 268 | 60cb4bc9e346f6f75386f334d8b5222383ddd171 | bigcode/the-stack | train |
61a7d3d50e050afe278d96d5 | train | class | class PoolCreateData(Base):
pool_id = fields.Integer()
cus = fields.Integer()
sus = fields.Integer()
ipv4us = fields.Integer()
node_ids = fields.List(fields.String())
currencies = fields.List(fields.String())
| class PoolCreateData(Base):
| pool_id = fields.Integer()
cus = fields.Integer()
sus = fields.Integer()
ipv4us = fields.Integer()
node_ids = fields.List(fields.String())
currencies = fields.List(fields.String())
| fields.List(fields.Object(Signature))
signatures_farmer = fields.List(fields.Object(Signature))
signatures_delete = fields.List(fields.Object(Signature))
epoch = fields.DateTime(default=datetime.utcnow)
metadata = fields.String(default="")
results = fields.List(fields.Object(ReservationResult))
cla... | 64 | 64 | 50 | 6 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | PoolCreateData | PoolCreateData | 629 | 635 | 629 | 629 | ead401efe9bfd145196e865d11fc1751b6983e97 | bigcode/the-stack | train |
ca0553500a22a531a4396876 | train | class | class SigningRequest(Base):
signers = fields.List(fields.Integer())
quorum_min = fields.Integer()
| class SigningRequest(Base):
| signers = fields.List(fields.Integer())
quorum_min = fields.Integer()
| = 11
class ZDBMode(Enum):
Seq = 0
User = 1
class DiskType(Enum):
HDD = 0
SSD = 1
class DeployedReservation(Base):
reservation_id = fields.Integer()
customer_tid = fields.Integer()
class SigningRequest(Base):
| 64 | 64 | 21 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | SigningRequest | SigningRequest | 273 | 275 | 273 | 273 | 235933ab20b3eed3a1d30a5bcbad0b7bf9ab8b6a | bigcode/the-stack | train |
72dfc89f99f995f9829fbb53 | train | class | class HardwareProof(Base):
created = fields.DateTime()
hardware_hash = fields.String(default="")
disk_hash = fields.String(default="")
hardware = fields.Typed(dict)
disks = fields.Typed(dict)
hypervisor = fields.List(fields.String())
| class HardwareProof(Base):
| created = fields.DateTime()
hardware_hash = fields.String(default="")
disk_hash = fields.String(default="")
hardware = fields.Typed(dict)
disks = fields.Typed(dict)
hypervisor = fields.List(fields.String())
| NodePublicIface(Base):
master = fields.String(default="")
type = fields.Enum(NicType)
ipv4 = fields.IPRange()
ipv6 = fields.IPRange()
gw4 = fields.IPRange()
gw6 = fields.IPRange()
version = fields.Integer()
class HardwareProof(Base):
| 64 | 64 | 51 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | HardwareProof | HardwareProof | 159 | 165 | 159 | 159 | c90f15f070142c579c2a0e64bb93cf66e8dfbee9 | bigcode/the-stack | train |
b3d9ea1d8cad7684c5f10e48 | train | class | class ReservationInfo(Base):
workload_id = fields.Integer()
node_id = fields.String()
pool_id = fields.Integer()
description = fields.String(default="")
reference = fields.String(default="")
customer_tid = fields.Integer()
customer_signature = fields.String()
next_action = fields.Enum(Ne... | class ReservationInfo(Base):
| workload_id = fields.Integer()
node_id = fields.String()
pool_id = fields.Integer()
description = fields.String(default="")
reference = fields.String(default="")
customer_tid = fields.Integer()
customer_signature = fields.String()
next_action = fields.Enum(NextAction)
signatures_prov... | .Enum(DiskType)
class ReservationResult(Base):
category = fields.Enum(Category)
workload_id = fields.String(default="")
data_json = fields.Json()
signature = fields.Bytes()
state = fields.Enum(State)
message = fields.String(default="")
epoch = fields.DateTime()
class ReservationInfo(Base):... | 64 | 64 | 159 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ReservationInfo | ReservationInfo | 327 | 344 | 327 | 327 | d130d79b25d77599d8b5e4b47225634f1241561f | bigcode/the-stack | train |
8f986cf8d4cfd3cb4fa13529 | train | class | class WalletAddress(Base):
asset = fields.String(default="")
address = fields.String(default="")
| class WalletAddress(Base):
| asset = fields.String(default="")
address = fields.String(default="")
| cale.core.base import Base, fields
from jumpscale.loader import j
"""
Explorer directory types
"""
class Currency(Enum):
Eur = 0
Usd = 1
Tft = 2
Aed = 3
Gbp = 4
class WalletAddress(Base):
| 64 | 64 | 19 | 5 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | WalletAddress | WalletAddress | 21 | 23 | 21 | 21 | 89172c4ba409908a9e755817321dac9534b352e9 | bigcode/the-stack | train |
fb3cd3a3af0c24803129b82b | train | class | class Currency(Enum):
Eur = 0
Usd = 1
Tft = 2
Aed = 3
Gbp = 4
| class Currency(Enum):
| Eur = 0
Usd = 1
Tft = 2
Aed = 3
Gbp = 4
| import ipaddress
from datetime import datetime
from enum import Enum
from jumpscale.core.base import Base, fields
from jumpscale.loader import j
"""
Explorer directory types
"""
class Currency(Enum):
| 41 | 64 | 38 | 4 | 37 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Currency | Currency | 13 | 18 | 13 | 13 | 2b7d8eecb0bf27f7d854a47544e5feeaad522e21 | bigcode/the-stack | train |
1750b02b55eead8ece5cf5f7 | train | class | class ReservationData(Base):
description = fields.String(default="")
signing_request_provision = fields.Object(SigningRequest)
signing_request_delete = fields.Object(SigningRequest)
containers = fields.List(fields.Object(Container))
volumes = fields.List(fields.Object(Volume))
zdbs = fields.List... | class ReservationData(Base):
| description = fields.String(default="")
signing_request_provision = fields.Object(SigningRequest)
signing_request_delete = fields.Object(SigningRequest)
containers = fields.List(fields.Object(Container))
volumes = fields.List(fields.Object(Volume))
zdbs = fields.List(fields.Object(ZdbNamespace))... |
class PublicIP(Base):
id = fields.Integer()
ipaddress = fields.IPRange()
info = fields.Object(ReservationInfo)
def resource_units(self):
resource_units = ResourceUnitAmount()
resource_units.ipv4u = 1
return resource_units
class ReservationData(Base):
| 64 | 64 | 184 | 5 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ReservationData | ReservationData | 595 | 611 | 595 | 595 | 2cb52701683d16751c8cf4bfd911c51d6cd6e0f9 | bigcode/the-stack | train |
a02e392c3219334772ac0edd | train | class | class ContainerLogsRedis(Base):
# deprecated, please use secret_stdout instead
stdout = fields.String(default="")
# deprecated, please use secret_stderr instead
stderr = fields.String(default="")
secret_stdout = fields.String(default="")
secret_stderr = fields.String(default="")
| class ContainerLogsRedis(Base):
# deprecated, please use secret_stdout instead
| stdout = fields.String(default="")
# deprecated, please use secret_stderr instead
stderr = fields.String(default="")
secret_stdout = fields.String(default="")
secret_stderr = fields.String(default="")
| ):
volume_id = fields.String(default="")
mountpoint = fields.String(default="")
class ContainerNetworkConnection(Base):
network_id = fields.String(default="")
ipaddress = fields.IPAddress()
public_ip6 = fields.Boolean()
class ContainerLogsRedis(Base):
# deprecated, please use secret_stdout ins... | 64 | 64 | 59 | 16 | 48 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ContainerLogsRedis | ContainerLogsRedis | 295 | 302 | 295 | 296 | 1161651c0eb548100d5968371e2ec2632d844d57 | bigcode/the-stack | train |
6ee3605a3aa3414e80ea9c02 | train | class | class PublicIP(Base):
id = fields.Integer()
ipaddress = fields.IPRange()
info = fields.Object(ReservationInfo)
def resource_units(self):
resource_units = ResourceUnitAmount()
resource_units.ipv4u = 1
return resource_units
| class PublicIP(Base):
| id = fields.Integer()
ipaddress = fields.IPRange()
info = fields.Object(ReservationInfo)
def resource_units(self):
resource_units = ResourceUnitAmount()
resource_units.ipv4u = 1
return resource_units
| def resource_units(self):
resource_units = ResourceUnitAmount()
if self.disk_type == DiskType.HDD:
resource_units.hru += self.size
elif self.disk_type == DiskType.SSD:
resource_units.sru += self.size
return resource_units
class PublicIP(Base):
| 64 | 64 | 58 | 5 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | PublicIP | PublicIP | 584 | 592 | 584 | 584 | a0714eae5dda6f7abe3ef4d204f9f991a31f1b33 | bigcode/the-stack | train |
d9d49542ada752a20cf3ee89 | train | class | class ContainerMount(Base):
volume_id = fields.String(default="")
mountpoint = fields.String(default="")
| class ContainerMount(Base):
| volume_id = fields.String(default="")
mountpoint = fields.String(default="")
| reservation_id = fields.Integer()
customer_tid = fields.Integer()
class SigningRequest(Base):
signers = fields.List(fields.Integer())
quorum_min = fields.Integer()
class Signature(Base):
tid = fields.Integer()
signature = fields.String(default="")
epoch = fields.DateTime()
class Containe... | 64 | 64 | 21 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ContainerMount | ContainerMount | 284 | 286 | 284 | 284 | 741dddabfc39dec66ce6504e6c63e73711f0e295 | bigcode/the-stack | train |
7cb10aaa4b89a49d268ae48d | train | class | class Category(Enum):
Zdb = 0
Container = 1
Volume = 2
Network = 3
Kubernetes = 4
Proxy = 5
Reverse_proxy = 6
Subdomain = 7
Domain_delegate = 8
Gateway4to6 = 9
Public_IP = 10
| class Category(Enum):
| Zdb = 0
Container = 1
Volume = 2
Network = 3
Kubernetes = 4
Proxy = 5
Reverse_proxy = 6
Subdomain = 7
Domain_delegate = 8
Gateway4to6 = 9
Public_IP = 10
| types
"""
class NextAction(Enum):
CREATE = 0
SIGN = 1
PAY = 2
DEPLOY = 3
DELETE = 4
INVALID = 5
DELETED = 6
MIGRATED = 7
class Category(Enum):
| 64 | 64 | 78 | 4 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Category | Category | 223 | 234 | 223 | 223 | 0818e623306d1d47b792e5d42b3aa3b5ed90a0c6 | bigcode/the-stack | train |
6001eabb3bb62d6e9239c3cd | train | class | class WorkloadsAmount(Base):
network = fields.Integer()
volume = fields.Integer()
zdb_namespace = fields.Integer()
container = fields.Integer()
k8s_vm = fields.Integer()
proxy = fields.Integer()
reverse_proxy = fields.Integer()
subdomain = fields.Integer()
delegate_domain = fields.In... | class WorkloadsAmount(Base):
| network = fields.Integer()
volume = fields.Integer()
zdb_namespace = fields.Integer()
container = fields.Integer()
k8s_vm = fields.Integer()
proxy = fields.Integer()
reverse_proxy = fields.Integer()
subdomain = fields.Integer()
delegate_domain = fields.Integer()
| fields.List(fields.Object(ResourceUnitPrice))
prefix_zero = fields.IPRange()
ipaddresses = fields.List(fields.Object(FarmerIP))
def __str__(self):
return " - ".join([x for x in [self.name, str(self.location)] if x])
class WorkloadsAmount(Base):
| 64 | 64 | 68 | 6 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | WorkloadsAmount | WorkloadsAmount | 68 | 77 | 68 | 68 | d0b1f92ffd7c79af2c07200d28f10b9b282ec163 | bigcode/the-stack | train |
92d97a9e2c78620caa008abe | train | class | class ContainerLogs(Base):
type = fields.String(default="")
data = fields.Object(ContainerLogsRedis)
| class ContainerLogs(Base):
| type = fields.String(default="")
data = fields.Object(ContainerLogsRedis)
| ContainerLogsRedis(Base):
# deprecated, please use secret_stdout instead
stdout = fields.String(default="")
# deprecated, please use secret_stderr instead
stderr = fields.String(default="")
secret_stdout = fields.String(default="")
secret_stderr = fields.String(default="")
class ContainerLogs(... | 63 | 64 | 21 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ContainerLogs | ContainerLogs | 305 | 307 | 305 | 305 | e83c0b76649e7e14b647fd07877fbb553c75c8c5 | bigcode/the-stack | train |
b7d266b2d53cc0c616f899e9 | train | class | class GatewayProxy(Base):
id = fields.Integer()
domain = fields.String(default="")
addr = fields.String(default="")
port = fields.Integer()
port_tls = fields.Integer()
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
| class GatewayProxy(Base):
| id = fields.Integer()
domain = fields.String(default="")
addr = fields.String(default="")
port = fields.Integer()
port_tls = fields.Integer()
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
| signatures_farmer = fields.List(fields.Object(Signature))
signatures_delete = fields.List(fields.Object(Signature))
epoch = fields.DateTime(default=datetime.utcnow)
metadata = fields.String(default="")
result = fields.Object(ReservationResult)
workload_type = fields.Enum(WorkloadType)
class Gateway... | 64 | 64 | 59 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | GatewayProxy | GatewayProxy | 347 | 356 | 347 | 347 | 74eaf0a22c7f3a86ea499efcad4acf36668d5fa1 | bigcode/the-stack | train |
e4ba9ce37fc9f8106eb4750e | train | class | class ZDBMode(Enum):
Seq = 0
User = 1
| class ZDBMode(Enum):
| Seq = 0
User = 1
| 3
Kubernetes = 4
Proxy = 5
Reverse_proxy = 6
Subdomain = 7
Domain_delegate = 8
Gateway4to6 = 9
Network_resource = 10
Public_IP = 11
class ZDBMode(Enum):
| 64 | 64 | 18 | 6 | 57 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ZDBMode | ZDBMode | 258 | 260 | 258 | 258 | 59996a5a49083c4f7e1b3408077a10918df5d13d | bigcode/the-stack | train |
4abaad3e4a5d41172823749c | train | class | class NicType(Enum):
Macvlan = 0
Vlan = 1
| class NicType(Enum):
| Macvlan = 0
Vlan = 1
| 0) / 1000
cloud_units.su = round((self.hru / 1200 + self.sru / 300) * 1000) / 1000
cloud_units.ipv4u = self.ipv4u
return cloud_units
class NicType(Enum):
| 64 | 64 | 20 | 5 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | NicType | NicType | 144 | 146 | 144 | 144 | 734a1a95433e576d8730959ea8b55ea187073ebd | bigcode/the-stack | train |
c2f1efb736e379c328f59f09 | train | class | class ZdbNamespace(Base):
id = fields.Integer()
node_id = fields.String(default="")
size = fields.Integer()
mode = fields.Enum(ZDBMode)
password = fields.String(default="")
disk_type = fields.Enum(DiskType)
public = fields.Boolean(default=False)
stats_aggregator = fields.List(fields.Obje... | class ZdbNamespace(Base):
| id = fields.Integer()
node_id = fields.String(default="")
size = fields.Integer()
mode = fields.Enum(ZDBMode)
password = fields.String(default="")
disk_type = fields.Enum(DiskType)
public = fields.Boolean(default=False)
stats_aggregator = fields.List(fields.Object(Statsaggregator))
i... | )
def resource_units(self):
resource_units = ResourceUnitAmount()
if self.type == DiskType.HDD:
resource_units.hru += self.size
elif self.type == DiskType.SSD:
resource_units.sru += self.size
return resource_units
class ZdbNamespace(Base):
| 64 | 64 | 143 | 6 | 57 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ZdbNamespace | ZdbNamespace | 564 | 581 | 564 | 564 | 7c9a70e22c06801f27881bd434dc9986736dc246 | bigcode/the-stack | train |
193c716b3488e2dc9f23a738 | train | class | class Volume(Base):
id = fields.Integer()
size = fields.Integer()
type = fields.Enum(DiskType)
stats_aggregator = fields.List(fields.Object(Statsaggregator))
info = fields.Object(ReservationInfo)
def resource_units(self):
resource_units = ResourceUnitAmount()
if self.type == Dis... | class Volume(Base):
| id = fields.Integer()
size = fields.Integer()
type = fields.Enum(DiskType)
stats_aggregator = fields.List(fields.Object(Statsaggregator))
info = fields.Object(ReservationInfo)
def resource_units(self):
resource_units = ResourceUnitAmount()
if self.type == DiskType.HDD:
... | fields.IPRange(default="10.10.0.0/16")
stats_aggregator = fields.List(fields.Object(Statsaggregator))
network_resources = fields.List(fields.Object(NetworkResource))
farmer_tid = fields.Integer()
def resource_units(self):
return ResourceUnitAmount()
class Volume(Base):
| 64 | 64 | 106 | 4 | 60 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Volume | Volume | 548 | 561 | 548 | 548 | aea7c20f1a203641c33aff07ed27db154626f804 | bigcode/the-stack | train |
abf5b474680f82144fdb7b81 | train | class | class DiskType(Enum):
HDD = 0
SSD = 1
| class DiskType(Enum):
| HDD = 0
SSD = 1
| = 6
Subdomain = 7
Domain_delegate = 8
Gateway4to6 = 9
Network_resource = 10
Public_IP = 11
class ZDBMode(Enum):
Seq = 0
User = 1
class DiskType(Enum):
| 64 | 64 | 17 | 5 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | DiskType | DiskType | 263 | 265 | 263 | 263 | 9d02e934c4b2694997758387528c13f81d94b701 | bigcode/the-stack | train |
23fd7600d9b609e2c9cba6f3 | train | class | class State(Enum):
Error = 0
Ok = 1
Deleted = 2
| class State(Enum):
| Error = 0
Ok = 1
Deleted = 2
| Volume = 2
Network = 3
Kubernetes = 4
Proxy = 5
Reverse_proxy = 6
Subdomain = 7
Domain_delegate = 8
Gateway4to6 = 9
Public_IP = 10
class State(Enum):
| 64 | 64 | 22 | 4 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | State | State | 237 | 240 | 237 | 237 | 36f6314a73a8f28953c48ac05da57143437780a1 | bigcode/the-stack | train |
83e4332d5d5de862ba8ce4e2 | train | class | class PoolCreate(Base):
json = fields.String()
data_reservation = fields.Object(PoolCreateData)
customer_tid = fields.Integer()
customer_signature = fields.String()
| class PoolCreate(Base):
| json = fields.String()
data_reservation = fields.Object(PoolCreateData)
customer_tid = fields.Integer()
customer_signature = fields.String()
| = fields.List(fields.Object(ReservationResult))
class PoolCreateData(Base):
pool_id = fields.Integer()
cus = fields.Integer()
sus = fields.Integer()
ipv4us = fields.Integer()
node_ids = fields.List(fields.String())
currencies = fields.List(fields.String())
class PoolCreate(Base):
| 64 | 64 | 37 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | PoolCreate | PoolCreate | 638 | 642 | 638 | 638 | e92f93384032cf6334365a34fff1eccc85bf3d55 | bigcode/the-stack | train |
f935532014c65f34ab822757 | train | class | class ResourceUnitAmount(Base):
cru = fields.Integer()
mru = fields.Float()
hru = fields.Float()
sru = fields.Float()
ipv4u = fields.Float()
def cloud_units(self) -> CloudUnits:
# converts resource units to cloud units. Cloud units are rounded to 3
# decimal places
cloud... | class ResourceUnitAmount(Base):
| cru = fields.Integer()
mru = fields.Float()
hru = fields.Float()
sru = fields.Float()
ipv4u = fields.Float()
def cloud_units(self) -> CloudUnits:
# converts resource units to cloud units. Cloud units are rounded to 3
# decimal places
cloud_units = CloudUnits()
cl... | duration (int): duration in second
Returns:
[float]: price
"""
price_per_second = self.cu * cu_price + self.su * su_price + self.ipv4u * ipv4u_price
return price_per_second * duration
class ResourceUnitAmount(Base):
| 64 | 64 | 164 | 6 | 57 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ResourceUnitAmount | ResourceUnitAmount | 127 | 141 | 127 | 127 | e133da71e33b05d80523d9b7fedb904e9a1d7163 | bigcode/the-stack | train |
bfea3e4ed6092894ea141601 | train | class | class ContainerCapacity(Base):
cpu = fields.Integer()
memory = fields.Integer()
disk_size = fields.Integer()
disk_type = fields.Enum(DiskType)
| class ContainerCapacity(Base):
| cpu = fields.Integer()
memory = fields.Integer()
disk_size = fields.Integer()
disk_type = fields.Enum(DiskType)
| ="")
# deprecated, please use secret_stderr instead
stderr = fields.String(default="")
secret_stdout = fields.String(default="")
secret_stderr = fields.String(default="")
class ContainerLogs(Base):
type = fields.String(default="")
data = fields.Object(ContainerLogsRedis)
class ContainerCapaci... | 64 | 64 | 34 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ContainerCapacity | ContainerCapacity | 310 | 314 | 310 | 310 | 1f038ff2f11ff504fb2875b73daeaeee4934b392 | bigcode/the-stack | train |
03563fc82b879fd0fe8e89cc | train | class | class Escrow(Base):
address = fields.String(default="")
asset = fields.String(default="")
details = fields.List(fields.Object(EscrowDetail))
| class Escrow(Base):
| address = fields.String(default="")
asset = fields.String(default="")
details = fields.List(fields.Object(EscrowDetail))
| # content = fields.Typed(dict)
# created = fields.DateTime()
# duration = fields.Integer()
# signature = fields.String(default="")
# to_delete = fields.Boolean()
class EscrowDetail(Base):
farmer_id = fields.Integer()
total_amount = fields.Float()
class Escrow(Base):
| 64 | 64 | 31 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Escrow | Escrow | 479 | 482 | 479 | 479 | a36876213a41b7d2d6f25f1845312ae87b24b594 | bigcode/the-stack | train |
1cadc0f819bf17933d1d2c2c | train | class | class WorkloadType(Enum):
Zdb = 0
Container = 1
Volume = 2
Network = 3
Kubernetes = 4
Proxy = 5
Reverse_proxy = 6
Subdomain = 7
Domain_delegate = 8
Gateway4to6 = 9
Network_resource = 10
Public_IP = 11
| class WorkloadType(Enum):
| Zdb = 0
Container = 1
Volume = 2
Network = 3
Kubernetes = 4
Proxy = 5
Reverse_proxy = 6
Subdomain = 7
Domain_delegate = 8
Gateway4to6 = 9
Network_resource = 10
Public_IP = 11
| Reverse_proxy = 6
Subdomain = 7
Domain_delegate = 8
Gateway4to6 = 9
Public_IP = 10
class State(Enum):
Error = 0
Ok = 1
Deleted = 2
class WorkloadType(Enum):
| 64 | 64 | 87 | 6 | 57 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | WorkloadType | WorkloadType | 243 | 255 | 243 | 243 | 80130f61518c74c78b8f9ca3a0d5c542e8d88f4a | bigcode/the-stack | train |
629dec2b696257c0bdb97feb | train | class | class GatewaySubdomain(Base):
id = fields.Integer()
domain = fields.String(default="")
ips = fields.List(fields.String())
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
| class GatewaySubdomain(Base):
| id = fields.Integer()
domain = fields.String(default="")
ips = fields.List(fields.String())
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
| def resource_units(self):
return ResourceUnitAmount()
class GatewayReverseProxy(Base):
id = fields.Integer()
domain = fields.String(default="")
secret = fields.String(default="")
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class Gat... | 64 | 64 | 48 | 6 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | GatewaySubdomain | GatewaySubdomain | 369 | 376 | 369 | 369 | 799fda1478f97671ef210e01778627bd7d87c62b | bigcode/the-stack | train |
fe63d3bd46a2aa1bf021e57c | train | class | class NodePublicIface(Base):
master = fields.String(default="")
type = fields.Enum(NicType)
ipv4 = fields.IPRange()
ipv6 = fields.IPRange()
gw4 = fields.IPRange()
gw6 = fields.IPRange()
version = fields.Integer()
| class NodePublicIface(Base):
| master = fields.String(default="")
type = fields.Enum(NicType)
ipv4 = fields.IPRange()
ipv6 = fields.IPRange()
gw4 = fields.IPRange()
gw6 = fields.IPRange()
version = fields.Integer()
| 0 + self.sru / 300) * 1000) / 1000
cloud_units.ipv4u = self.ipv4u
return cloud_units
class NicType(Enum):
Macvlan = 0
Vlan = 1
class NodePublicIface(Base):
| 64 | 64 | 60 | 6 | 57 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | NodePublicIface | NodePublicIface | 149 | 156 | 149 | 149 | b5895e66f1e262b92e1354aa0028bd6fe2be8ca8 | bigcode/the-stack | train |
c1626be8e9370455f16af0ed | train | class | class Gateway4to6(Base):
id = fields.Integer()
public_key = fields.String(default="")
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
| class Gateway4to6(Base):
| id = fields.Integer()
public_key = fields.String(default="")
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
| fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class GatewayDelegate(Base):
id = fields.Integer()
domain = fields.String(default="")
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class Gateway4to... | 64 | 64 | 42 | 7 | 57 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Gateway4to6 | Gateway4to6 | 388 | 394 | 388 | 388 | 2dfb73766232fb58e118e7f67f50b624925a5ca5 | bigcode/the-stack | train |
a5d0e4cd17c694b4fc9e1225 | train | class | class ReservationResult(Base):
category = fields.Enum(Category)
workload_id = fields.String(default="")
data_json = fields.Json()
signature = fields.Bytes()
state = fields.Enum(State)
message = fields.String(default="")
epoch = fields.DateTime()
| class ReservationResult(Base):
| category = fields.Enum(Category)
workload_id = fields.String(default="")
data_json = fields.Json()
signature = fields.Bytes()
state = fields.Enum(State)
message = fields.String(default="")
epoch = fields.DateTime()
| .String(default="")
class ContainerLogs(Base):
type = fields.String(default="")
data = fields.Object(ContainerLogsRedis)
class ContainerCapacity(Base):
cpu = fields.Integer()
memory = fields.Integer()
disk_size = fields.Integer()
disk_type = fields.Enum(DiskType)
class ReservationResult(Base... | 64 | 64 | 54 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ReservationResult | ReservationResult | 317 | 324 | 317 | 317 | 4d4372e493f0c304c54959ff0ea682e7ef6906d5 | bigcode/the-stack | train |
69dafda9ea93e29c7c7bc907 | train | class | class Node(Base):
node_id = fields.String(default="")
node_id_v1 = fields.String(default="")
farm_id = fields.Integer()
os_version = fields.String(default="")
created = fields.DateTime()
updated = fields.DateTime()
uptime = fields.Integer()
address = fields.String(default="")
locatio... | class Node(Base):
| node_id = fields.String(default="")
node_id_v1 = fields.String(default="")
farm_id = fields.Integer()
os_version = fields.String(default="")
created = fields.DateTime()
updated = fields.DateTime()
uptime = fields.Integer()
address = fields.String(default="")
location = fields.Object(... | .IPRange()
version = fields.Integer()
class HardwareProof(Base):
created = fields.DateTime()
hardware_hash = fields.String(default="")
disk_hash = fields.String(default="")
hardware = fields.Typed(dict)
disks = fields.Typed(dict)
hypervisor = fields.List(fields.String())
class Node(Base):
| 64 | 64 | 184 | 4 | 60 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Node | Node | 168 | 189 | 168 | 168 | a3156ae42a42697ab29471b4e7056b8592ea3f5d | bigcode/the-stack | train |
240bfa3035450fda710bad5c | train | class | class User(Base):
id = fields.Integer()
name = fields.String(default="")
email = fields.String(default="")
pubkey = fields.String(default="")
host = fields.String(default="")
description = fields.String(default="")
signature = fields.String(default="")
| class User(Base):
| id = fields.Integer()
name = fields.String(default="")
email = fields.String(default="")
pubkey = fields.String(default="")
host = fields.String(default="")
description = fields.String(default="")
signature = fields.String(default="")
| Iface))
public_config = fields.Object(NodePublicIface)
exit_node = fields.Boolean()
approved = fields.Boolean(default=False)
public_key_hex = fields.String(default="")
wg_ports = fields.List(fields.Integer())
free_to_use = fields.Boolean()
"""
Explorer phonebook types
"""
class User(Base):
| 64 | 64 | 53 | 4 | 60 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | User | User | 197 | 204 | 197 | 197 | deb6045657afa17ca6a117e0059a409166456ef1 | bigcode/the-stack | train |
2fbaa7e8bbfc8270e62349b9 | train | class | class ContainerNetworkConnection(Base):
network_id = fields.String(default="")
ipaddress = fields.IPAddress()
public_ip6 = fields.Boolean()
| class ContainerNetworkConnection(Base):
| network_id = fields.String(default="")
ipaddress = fields.IPAddress()
public_ip6 = fields.Boolean()
| fields.List(fields.Integer())
quorum_min = fields.Integer()
class Signature(Base):
tid = fields.Integer()
signature = fields.String(default="")
epoch = fields.DateTime()
class ContainerMount(Base):
volume_id = fields.String(default="")
mountpoint = fields.String(default="")
class ContainerN... | 63 | 64 | 30 | 6 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ContainerNetworkConnection | ContainerNetworkConnection | 289 | 292 | 289 | 289 | 7ec6e21470d9aaaf91678cc7d5af362a2b492529 | bigcode/the-stack | train |
2c30eac08426cf7af91597c0 | train | class | class FarmerIP(Base):
address = fields.IPRange()
gateway = fields.IPAddress()
reservation_id = fields.Integer()
| class FarmerIP(Base):
| address = fields.IPRange()
gateway = fields.IPAddress()
reservation_id = fields.Integer()
| (default="")
country = fields.String(default="")
continent = fields.String(default="")
latitude = fields.Float()
longitude = fields.Float()
def __str__(self):
return ",".join([x for x in [self.continent, self.country, self.city] if x])
class FarmerIP(Base):
| 64 | 64 | 26 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | FarmerIP | FarmerIP | 46 | 49 | 46 | 46 | 3a0499edba9e0652ba40636b7857aa50507cc7a9 | bigcode/the-stack | train |
45cce18e99c09aafaf969cb0 | train | class | class NextAction(Enum):
CREATE = 0
SIGN = 1
PAY = 2
DEPLOY = 3
DELETE = 4
INVALID = 5
DELETED = 6
MIGRATED = 7
| class NextAction(Enum):
| CREATE = 0
SIGN = 1
PAY = 2
DEPLOY = 3
DELETE = 4
INVALID = 5
DELETED = 6
MIGRATED = 7
| ):
id = fields.Integer()
name = fields.String(default="")
email = fields.String(default="")
pubkey = fields.String(default="")
host = fields.String(default="")
description = fields.String(default="")
signature = fields.String(default="")
"""
Explorer worklaods types
"""
class NextAction(En... | 64 | 64 | 57 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | NextAction | NextAction | 212 | 220 | 212 | 212 | 371f27b36c10dd866faa59027930e2375eb95f2f | bigcode/the-stack | train |
4b1e33430e9b7a5b798400e7 | train | class | class Network(Base):
name = fields.String(default="")
workload_id = fields.Integer()
iprange = fields.IPRange(default="10.10.0.0/16")
stats_aggregator = fields.List(fields.Object(Statsaggregator))
network_resources = fields.List(fields.Object(NetworkResource))
farmer_tid = fields.Integer()
... | class Network(Base):
| name = fields.String(default="")
workload_id = fields.Integer()
iprange = fields.IPRange(default="10.10.0.0/16")
stats_aggregator = fields.List(fields.Object(Statsaggregator))
network_resources = fields.List(fields.Object(NetworkResource))
farmer_tid = fields.Integer()
def resource_units(se... | guard_listen_port = fields.Integer()
iprange = fields.IPRange(default="10.10.10.0/24")
peers = fields.List(fields.Object(WireguardPeer))
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class Network(Base):
| 64 | 64 | 82 | 4 | 60 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Network | Network | 536 | 545 | 536 | 536 | 35cbe0bb2b16b0a5419c7dd252505475858429a5 | bigcode/the-stack | train |
b3adbcaf7d4802cc40445afc | train | class | class Location(Base):
city = fields.String(default="")
country = fields.String(default="")
continent = fields.String(default="")
latitude = fields.Float()
longitude = fields.Float()
def __str__(self):
return ",".join([x for x in [self.continent, self.country, self.city] if x])
| class Location(Base):
| city = fields.String(default="")
country = fields.String(default="")
continent = fields.String(default="")
latitude = fields.Float()
longitude = fields.Float()
def __str__(self):
return ",".join([x for x in [self.continent, self.country, self.city] if x])
| = fields.String(default="")
address = fields.String(default="")
class ResourceUnitPrice(Base):
currency = fields.Enum(Currency)
cru = fields.Float()
mru = fields.Float()
hru = fields.Float()
sru = fields.Float()
nru = fields.Float()
class Location(Base):
| 64 | 64 | 68 | 4 | 60 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Location | Location | 35 | 43 | 35 | 35 | 4b930d36442878086163a8a902d28e03acd0ac4d | bigcode/the-stack | train |
01701df852c3f3c8a3964731 | train | class | class NetworkResource(Base):
id = fields.Integer()
name = fields.String(default="")
network_iprange = fields.IPRange(default="10.10.0.0/16")
wireguard_private_key_encrypted = fields.String(default="")
wireguard_public_key = fields.String(default="")
wireguard_listen_port = fields.Integer()
i... | class NetworkResource(Base):
| id = fields.Integer()
name = fields.String(default="")
network_iprange = fields.IPRange(default="10.10.0.0/16")
wireguard_private_key_encrypted = fields.String(default="")
wireguard_public_key = fields.String(default="")
wireguard_listen_port = fields.Integer()
iprange = fields.IPRange(defau... | we offer the 50 first GB of storage for container root filesystem
if cap.disk_type == DiskType.HDD:
resource_units.hru += storage_size
elif cap.disk_type == DiskType.SSD:
resource_units.sru += storage_size
return resource_units
class NetworkResource(Base):
| 64 | 64 | 122 | 5 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | NetworkResource | NetworkResource | 521 | 533 | 521 | 521 | 3e7b6f284c1d3654d93b60ea5b980bb8d48b812d | bigcode/the-stack | train |
7eb48ff1299e6c1926be759f | train | class | class GatewayReverseProxy(Base):
id = fields.Integer()
domain = fields.String(default="")
secret = fields.String(default="")
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
| class GatewayReverseProxy(Base):
| id = fields.Integer()
domain = fields.String(default="")
secret = fields.String(default="")
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
| GatewayProxy(Base):
id = fields.Integer()
domain = fields.String(default="")
addr = fields.String(default="")
port = fields.Integer()
port_tls = fields.Integer()
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class GatewayReverseProxy(Ba... | 64 | 64 | 47 | 6 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | GatewayReverseProxy | GatewayReverseProxy | 359 | 366 | 359 | 359 | 3f78608ce3d58dfebdd6b29d489bcbb27c5043b2 | bigcode/the-stack | train |
eec08cabfbffeb7687b7c9f0 | train | class | class Signature(Base):
tid = fields.Integer()
signature = fields.String(default="")
epoch = fields.DateTime()
| class Signature(Base):
| tid = fields.Integer()
signature = fields.String(default="")
epoch = fields.DateTime()
| 1
class DiskType(Enum):
HDD = 0
SSD = 1
class DeployedReservation(Base):
reservation_id = fields.Integer()
customer_tid = fields.Integer()
class SigningRequest(Base):
signers = fields.List(fields.Integer())
quorum_min = fields.Integer()
class Signature(Base):
| 64 | 64 | 24 | 4 | 60 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Signature | Signature | 278 | 281 | 278 | 278 | 5eba5df3ffdd1d3072f2a4908d04f4c6bb77f220 | bigcode/the-stack | train |
b00406da73f648dcf9614ee7 | train | class | class WireguardPeer(Base):
public_key = fields.String(default="")
allowed_iprange = fields.List(fields.IPRange())
endpoint = fields.String(default="")
iprange = fields.IPRange(default="10.10.11.0/24")
| class WireguardPeer(Base):
| public_key = fields.String(default="")
allowed_iprange = fields.List(fields.IPRange())
endpoint = fields.String(default="")
iprange = fields.IPRange(default="10.10.11.0/24")
| not size:
raise j.exceptions.Input(f"k8s size {self.size} not supported")
resource_units.cru += size["cru"]
resource_units.mru += size["mru"]
resource_units.sru += size["sru"]
return resource_units
class WireguardPeer(Base):
| 64 | 64 | 51 | 6 | 57 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | WireguardPeer | WireguardPeer | 456 | 460 | 456 | 456 | 1d629ca131e923206d11dcff497936b1dce9d456 | bigcode/the-stack | train |
fe669cc08f10f6a518f65964 | train | class | class ContainerStats(Base):
type = fields.String(default="")
data = fields.Object(ContainerStatsRedis)
| class ContainerStats(Base):
| type = fields.String(default="")
data = fields.Object(ContainerStatsRedis)
| fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class Statsaggregator(Base):
addr = fields.String(default="")
port = fields.Integer()
secret = fields.String(default="")
class ContainerStatsRedis(Base):
endpoint = fields.String(default="")
class Cont... | 63 | 64 | 21 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ContainerStats | ContainerStats | 407 | 409 | 407 | 407 | ec0a362a0e79d690ed5b4ca44ef79d204fbef6a7 | bigcode/the-stack | train |
a276354ffffd2f9354e79a5f | train | class | class ResourceUnitPrice(Base):
currency = fields.Enum(Currency)
cru = fields.Float()
mru = fields.Float()
hru = fields.Float()
sru = fields.Float()
nru = fields.Float()
| class ResourceUnitPrice(Base):
| currency = fields.Enum(Currency)
cru = fields.Float()
mru = fields.Float()
hru = fields.Float()
sru = fields.Float()
nru = fields.Float()
| class Currency(Enum):
Eur = 0
Usd = 1
Tft = 2
Aed = 3
Gbp = 4
class WalletAddress(Base):
asset = fields.String(default="")
address = fields.String(default="")
class ResourceUnitPrice(Base):
| 63 | 64 | 47 | 6 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ResourceUnitPrice | ResourceUnitPrice | 26 | 32 | 26 | 26 | 1a781f71528e2b4840def55f3ef17a88948ae4ae | bigcode/the-stack | train |
3cb529a2346e573f486c915a | train | class | class EscrowDetail(Base):
farmer_id = fields.Integer()
total_amount = fields.Float()
| class EscrowDetail(Base):
| farmer_id = fields.Integer()
total_amount = fields.Float()
| # user = fields.String(default="")
# type = fields.Enum(WorkloadType)
# content = fields.Typed(dict)
# created = fields.DateTime()
# duration = fields.Integer()
# signature = fields.String(default="")
# to_delete = fields.Boolean()
class EscrowDetail(Base):
| 64 | 64 | 20 | 6 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | EscrowDetail | EscrowDetail | 474 | 476 | 474 | 474 | bbe67115fc7c9adf2cdb064e0a4292d90fb9c5a5 | bigcode/the-stack | train |
106c24407a7012adba695d23 | train | class | class ContainerStatsRedis(Base):
endpoint = fields.String(default="")
| class ContainerStatsRedis(Base):
| endpoint = fields.String(default="")
| .Integer()
public_key = fields.String(default="")
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class Statsaggregator(Base):
addr = fields.String(default="")
port = fields.Integer()
secret = fields.String(default="")
class ContainerStatsRe... | 63 | 64 | 13 | 6 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | ContainerStatsRedis | ContainerStatsRedis | 403 | 404 | 403 | 403 | b660bb7c2208153e04b4ee98aa38c368141f5de3 | bigcode/the-stack | train |
dbd7011b62a8be67251392fb | train | class | class Gateway(Base):
node_id = fields.String(default="")
os_version = fields.String(default="")
farm_id = fields.Integer()
created = fields.DateTime()
updated = fields.DateTime()
uptime = fields.Integer()
address = fields.String(default="")
location = fields.Object(Location)
public_k... | class Gateway(Base):
| node_id = fields.String(default="")
os_version = fields.String(default="")
farm_id = fields.Integer()
created = fields.DateTime()
updated = fields.DateTime()
uptime = fields.Integer()
address = fields.String(default="")
location = fields.Object(Location)
public_key_hex = fields.Strin... | = fields.Integer()
volume = fields.Integer()
zdb_namespace = fields.Integer()
container = fields.Integer()
k8s_vm = fields.Integer()
proxy = fields.Integer()
reverse_proxy = fields.Integer()
subdomain = fields.Integer()
delegate_domain = fields.Integer()
class Gateway(Base):
| 64 | 64 | 115 | 4 | 60 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Gateway | Gateway | 80 | 94 | 80 | 80 | 8cb0354de67728fa2f760441f41039e6d0415203 | bigcode/the-stack | train |
4b6d841e373182181047e7d1 | train | class | class Container(Base):
id = fields.Integer()
flist = fields.String(default="")
hub_url = fields.String(default="")
storage_url = fields.String(default="")
environment = fields.Typed(dict)
secret_environment = fields.Typed(dict)
entrypoint = fields.String(default="")
interactive = fields.... | class Container(Base):
| id = fields.Integer()
flist = fields.String(default="")
hub_url = fields.String(default="")
storage_url = fields.String(default="")
environment = fields.Typed(dict)
secret_environment = fields.Typed(dict)
entrypoint = fields.String(default="")
interactive = fields.Boolean(default=True)
... | to_delete = fields.Boolean()
class EscrowDetail(Base):
farmer_id = fields.Integer()
total_amount = fields.Float()
class Escrow(Base):
address = fields.String(default="")
asset = fields.String(default="")
details = fields.List(fields.Object(EscrowDetail))
class PaymentDetail(Base):
reserva... | 84 | 84 | 280 | 4 | 80 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Container | Container | 490 | 518 | 490 | 490 | 12fd8ab934a0c1ebb8605b64f3e79f0b8138d4fd | bigcode/the-stack | train |
dba51d7abccac19d7f591fbd | train | class | class CloudUnits(Base):
# compute units
cu = fields.Float()
# storage units
su = fields.Float()
# ipv4 units
ipv4u = fields.Float()
def cost(self, cu_price, su_price, ipv4u_price, duration):
"""
compute the total cost
Args:
cu_price (float): price of com... | class CloudUnits(Base):
# compute units
| cu = fields.Float()
# storage units
su = fields.Float()
# ipv4 units
ipv4u = fields.Float()
def cost(self, cu_price, su_price, ipv4u_price, duration):
"""
compute the total cost
Args:
cu_price (float): price of compute unit per second
su_price (f... | _port = fields.Integer()
dns_nameserver = fields.List(fields.String())
free_to_use = fields.Boolean()
class NodeIface(Base):
name = fields.String(default="")
addrs = fields.List(fields.IPRange())
gateway = fields.List(fields.IPRange())
class CloudUnits(Base):
# compute units
| 64 | 64 | 154 | 10 | 54 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | CloudUnits | CloudUnits | 103 | 124 | 103 | 104 | a970998dd1ca2f46aa2f61fb8e180092d3d77b18 | bigcode/the-stack | train |
07c3fb5f314171b91d3d405f | train | class | class PoolCreated(Base):
reservation_id = fields.Integer()
escrow_information = fields.Object(PoolEscrow)
| class PoolCreated(Base):
| reservation_id = fields.Integer()
escrow_information = fields.Object(PoolEscrow)
| fields.Integer() # can't be set to date because of max int64 value
customer_tid = fields.Integer()
active_workload_ids = fields.List(fields.Integer())
class PoolEscrow(Base):
address = fields.String()
asset = fields.String()
amount = fields.Integer()
class PoolCreated(Base):
| 64 | 64 | 23 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | PoolCreated | PoolCreated | 665 | 667 | 665 | 665 | ef0562cd41afa65b9d929453555ae3b6df9392c2 | bigcode/the-stack | train |
363056636182af6c57dfe830 | train | class | class Statsaggregator(Base):
addr = fields.String(default="")
port = fields.Integer()
secret = fields.String(default="")
| class Statsaggregator(Base):
| addr = fields.String(default="")
port = fields.Integer()
secret = fields.String(default="")
| (ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class Gateway4to6(Base):
id = fields.Integer()
public_key = fields.String(default="")
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class Statsaggregator(Base):
| 64 | 64 | 26 | 6 | 58 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | Statsaggregator | Statsaggregator | 397 | 400 | 397 | 397 | c3ec3d8d348e281e9c146eb544d193a5d6f42bb0 | bigcode/the-stack | train |
abfebb9e2257ac96f7c1061f | train | class | class GatewayDelegate(Base):
id = fields.Integer()
domain = fields.String(default="")
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
| class GatewayDelegate(Base):
| id = fields.Integer()
domain = fields.String(default="")
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
| def resource_units(self):
return ResourceUnitAmount()
class GatewaySubdomain(Base):
id = fields.Integer()
domain = fields.String(default="")
ips = fields.List(fields.String())
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class Gatewa... | 64 | 64 | 39 | 5 | 59 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | GatewayDelegate | GatewayDelegate | 379 | 385 | 379 | 379 | 65856dd93db24200f18c2bc49b76cfb87ad45c09 | bigcode/the-stack | train |
8c38704077a9a4418b6816eb | train | class | class K8s(Base):
id = fields.Integer()
size = fields.Integer()
network_id = fields.String(default="")
ipaddress = fields.IPAddress()
cluster_secret = fields.String(default="")
master_ips = fields.List(fields.IPAddress())
ssh_keys = fields.List(fields.String())
public_ip = fields.Integer(... | class K8s(Base):
| id = fields.Integer()
size = fields.Integer()
network_id = fields.String(default="")
ipaddress = fields.IPAddress()
cluster_secret = fields.String(default="")
master_ips = fields.List(fields.IPAddress())
ssh_keys = fields.List(fields.String())
public_ip = fields.Integer()
stats_aggre... | fields.String(default="")
ips = fields.List(fields.String())
info = fields.Object(ReservationInfo)
def resource_units(self):
return ResourceUnitAmount()
class GatewayDelegate(Base):
id = fields.Integer()
domain = fields.String(default="")
info = fields.Object(ReservationInfo)
de... | 182 | 182 | 607 | 6 | 176 | zaibon/js-sdk | jumpscale/clients/explorer/models.py | Python | K8s | K8s | 412 | 453 | 412 | 412 | b20d6a9946b62c5facea72447b8aecd7f22e7978 | bigcode/the-stack | train |
a63ca48e2655e18e43031bd2 | train | function | def validate(
response: Any, osize: bool = True, vsize: bool = True
) -> None:
"""Validate no such instance response."""
assert response['osize'] == len(oid)
if osize:
assert np.array_equal(
response['oid'], np.array(oid)
)
assert response['type'] == 0x4
assert re... | def validate(
response: Any, osize: bool = True, vsize: bool = True
) -> None:
| """Validate no such instance response."""
assert response['osize'] == len(oid)
if osize:
assert np.array_equal(
response['oid'], np.array(oid)
)
assert response['type'] == 0x4
assert response['vsize'] == 2
if vsize:
assert response['value'] == b'tt'
| 2, 1, 1, 5, 0)
var_bind = (oid, (len(oid) << 3, 255))
dtype = 'S256'
def validate(
response: Any, osize: bool = True, vsize: bool = True
) -> None:
| 64 | 64 | 108 | 26 | 38 | higherorderfunctor/snmp-fetch | tests/api/templates/get_string.py | Python | validate | validate | 15 | 27 | 15 | 17 | de9a23aa8f86c7edefb03bc4967966ea8a9963cb | bigcode/the-stack | train |
bccec583dd03699aa1513c41 | train | class | class JSONWebTokenAuthentication(BaseAuthentication):
"""Token based authentication using the JSON Web Token standard."""
def authenticate(self, request):
"""Entrypoint for Django Rest Framework"""
jwt_token = self.get_jwt_token(request)
if jwt_token is None:
return None
... | class JSONWebTokenAuthentication(BaseAuthentication):
| """Token based authentication using the JSON Web Token standard."""
def authenticate(self, request):
"""Entrypoint for Django Rest Framework"""
jwt_token = self.get_jwt_token(request)
if jwt_token is None:
return None
# Authenticate token
try:
to... | import logging
from django.apps import apps as django_apps
from django.conf import settings
from django.utils.encoding import smart_text
from django.utils.translation import ugettext as _
from rest_framework import exceptions
from django.contrib.auth.models import User
from rest_framework.authentication import BaseAut... | 92 | 117 | 392 | 8 | 84 | fuad008/django-cognito-jwt | src/django_cognito_jwt/backend.py | Python | JSONWebTokenAuthentication | JSONWebTokenAuthentication | 16 | 69 | 16 | 16 | 71cb7516b040ae67c65d2045fce1645e35fb04a3 | bigcode/the-stack | train |
aef015d7e8501e46ed55ec93 | train | class | class League(BaseLeague):
'''Creates a League instance for Public/Private ESPN league'''
def __init__(self, league_id: int, year: int, espn_s2=None, swid=None, username=None, password=None, debug=False):
super().__init__(league_id=league_id, year=year, sport='nfl', espn_s2=espn_s2, swid=swid, username=u... | class League(BaseLeague):
| '''Creates a League instance for Public/Private ESPN league'''
def __init__(self, league_id: int, year: int, espn_s2=None, swid=None, username=None, password=None, debug=False):
super().__init__(league_id=league_id, year=year, sport='nfl', espn_s2=espn_s2, swid=swid, username=username, password=password... | import datetime
import time
import json
from typing import List, Tuple
from ..base_league import BaseLeague
from .team import Team
from .matchup import Matchup
from .pick import Pick
from .box_score import BoxScore
from .box_player import BoxPlayer
from .player import Player
from .activity import Activity
from .utils ... | 102 | 256 | 2,875 | 5 | 96 | bpennisi/espn-api | espn_api/football/league.py | Python | League | League | 17 | 316 | 17 | 17 | 60d7e243d1cf25b13937eba7ef130eb2d2b2f223 | bigcode/the-stack | train |
adc9eb52cfbd546ba2f0d980 | train | class | class CSafeDumper(CEmitter, SafeRepresenter, Resolver):
def __init__(self, stream,
default_style=None, default_flow_style=None,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding=None, explicit_start=None, explicit_end=None,
... | class CSafeDumper(CEmitter, SafeRepresenter, Resolver):
| def __init__(self, stream,
default_style=None, default_flow_style=None,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding=None, explicit_start=None, explicit_end=None,
version=None, tags=None):
CEmitter.__init__... | _start=explicit_start, explicit_end=explicit_end,
version=version, tags=tags)
Representer.__init__(self, default_style=default_style,
default_flow_style=default_flow_style)
Resolver.__init__(self)
class CSafeDumper(CEmitter, SafeRepresenter, Resolver):
| 64 | 64 | 163 | 14 | 50 | bopopescu/searchparty | google-cloud-sdk/platform/bq/third_party/yaml/cyaml.py | Python | CSafeDumper | CSafeDumper | 53 | 68 | 53 | 54 | 0ecbee5a342b8530d72e9cb8009937e7557774ed | bigcode/the-stack | train |
f3e651baf069d59415361ab0 | train | class | class CLoader(CParser, Constructor, Resolver):
def __init__(self, stream):
CParser.__init__(self, stream)
Constructor.__init__(self)
Resolver.__init__(self)
| class CLoader(CParser, Constructor, Resolver):
| def __init__(self, stream):
CParser.__init__(self, stream)
Constructor.__init__(self)
Resolver.__init__(self)
| BaseResolver.__init__(self)
class CSafeLoader(CParser, SafeConstructor, Resolver):
def __init__(self, stream):
CParser.__init__(self, stream)
SafeConstructor.__init__(self)
Resolver.__init__(self)
class CLoader(CParser, Constructor, Resolver):
| 64 | 64 | 43 | 10 | 54 | bopopescu/searchparty | google-cloud-sdk/platform/bq/third_party/yaml/cyaml.py | Python | CLoader | CLoader | 29 | 34 | 29 | 30 | 808c4e319967edd1412b498a5eabb9e3de78ee62 | bigcode/the-stack | train |
4a8af079a6addad29894058f | train | class | class CBaseLoader(CParser, BaseConstructor, BaseResolver):
def __init__(self, stream):
CParser.__init__(self, stream)
BaseConstructor.__init__(self)
BaseResolver.__init__(self)
| class CBaseLoader(CParser, BaseConstructor, BaseResolver):
| def __init__(self, stream):
CParser.__init__(self, stream)
BaseConstructor.__init__(self)
BaseResolver.__init__(self)
| afeLoader', 'CLoader',
'CBaseDumper', 'CSafeDumper', 'CDumper']
from _yaml import CParser, CEmitter
from constructor import *
from serializer import *
from representer import *
from resolver import *
class CBaseLoader(CParser, BaseConstructor, BaseResolver):
| 64 | 64 | 48 | 13 | 51 | bopopescu/searchparty | google-cloud-sdk/platform/bq/third_party/yaml/cyaml.py | Python | CBaseLoader | CBaseLoader | 15 | 20 | 15 | 16 | 2f52b72f1a7784652355dc4b64483b96ba7d054d | bigcode/the-stack | train |
d360825f0ee11ddec891fd0a | train | class | class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver):
def __init__(self, stream,
default_style=None, default_flow_style=None,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding=None, explicit_start=None, explicit_end=None,
... | class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver):
| def __init__(self, stream,
default_style=None, default_flow_style=None,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding=None, explicit_start=None, explicit_end=None,
version=None, tags=None):
CEmitter.__init__... | Resolver.__init__(self)
class CLoader(CParser, Constructor, Resolver):
def __init__(self, stream):
CParser.__init__(self, stream)
Constructor.__init__(self)
Resolver.__init__(self)
class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver):
| 64 | 64 | 163 | 15 | 49 | bopopescu/searchparty | google-cloud-sdk/platform/bq/third_party/yaml/cyaml.py | Python | CBaseDumper | CBaseDumper | 36 | 51 | 36 | 37 | ddc7f378e522325556c8ad4c5710135c35a573ee | bigcode/the-stack | train |
a3dbb12dde099658be47ea4e | train | class | class CSafeLoader(CParser, SafeConstructor, Resolver):
def __init__(self, stream):
CParser.__init__(self, stream)
SafeConstructor.__init__(self)
Resolver.__init__(self)
| class CSafeLoader(CParser, SafeConstructor, Resolver):
| def __init__(self, stream):
CParser.__init__(self, stream)
SafeConstructor.__init__(self)
Resolver.__init__(self)
| from resolver import *
class CBaseLoader(CParser, BaseConstructor, BaseResolver):
def __init__(self, stream):
CParser.__init__(self, stream)
BaseConstructor.__init__(self)
BaseResolver.__init__(self)
class CSafeLoader(CParser, SafeConstructor, Resolver):
| 64 | 64 | 46 | 12 | 52 | bopopescu/searchparty | google-cloud-sdk/platform/bq/third_party/yaml/cyaml.py | Python | CSafeLoader | CSafeLoader | 22 | 27 | 22 | 23 | 1fba465207c7514c49cc82f905887169e87067bc | bigcode/the-stack | train |
9be2b981e559e6a377e86c78 | train | class | class CDumper(CEmitter, Serializer, Representer, Resolver):
def __init__(self, stream,
default_style=None, default_flow_style=None,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding=None, explicit_start=None, explicit_end=None,
... | class CDumper(CEmitter, Serializer, Representer, Resolver):
| def __init__(self, stream,
default_style=None, default_flow_style=None,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding=None, explicit_start=None, explicit_end=None,
version=None, tags=None):
CEmitter.__init__... | _start=explicit_start, explicit_end=explicit_end,
version=version, tags=tags)
SafeRepresenter.__init__(self, default_style=default_style,
default_flow_style=default_flow_style)
Resolver.__init__(self)
class CDumper(CEmitter, Serializer, Representer, Resolver):
| 64 | 64 | 161 | 13 | 51 | bopopescu/searchparty | google-cloud-sdk/platform/bq/third_party/yaml/cyaml.py | Python | CDumper | CDumper | 70 | 85 | 70 | 71 | a1ca680cbffac8426b9c36548e0fcabbb94f95ac | bigcode/the-stack | train |
3aaded83572f30a819332529 | train | class | class OAuth2API(object):
host = None
base_path = None
authorize_url = None
access_token_url = None
redirect_uri = None
# some providers use "oauth_token"
access_token_field = "access_token"
protocol = "https"
# override with 'Instagram', etc
api_name = "Generic API"
def __in... | class OAuth2API(object):
| host = None
base_path = None
authorize_url = None
access_token_url = None
redirect_uri = None
# some providers use "oauth_token"
access_token_field = "access_token"
protocol = "https"
# override with 'Instagram', etc
api_name = "Generic API"
def __init__(self, client_id=None... | from json_import import simplejson
import urllib
from httplib2 import Http
import mimetypes
class OAuth2AuthExchangeError(Exception):
def __init__(self, description):
self.description = description
def __str__(self):
return self.description
class OAuth2API(object):
| 63 | 105 | 353 | 6 | 56 | danielroseman/python-instagram | instagram/oauth2.py | Python | OAuth2API | OAuth2API | 15 | 55 | 15 | 15 | deb9647aa5fd3b144006ba9629f94d3879f503a8 | bigcode/the-stack | train |
986a684fa43156e2e5a54357 | train | class | class OAuth2AuthExchangeRequest(object):
def __init__(self, api):
self.api = api
def _url_for_authorize(self, scope=None):
client_params = {
"client_id": self.api.client_id,
"response_type": "code",
"redirect_uri": self.api.redirect_uri
}
if s... | class OAuth2AuthExchangeRequest(object):
| def __init__(self, api):
self.api = api
def _url_for_authorize(self, scope=None):
client_params = {
"client_id": self.api.client_id,
"response_type": "code",
"redirect_uri": self.api.redirect_uri
}
if scope:
client_params.update(sc... | Request(self)
return req.get_authorize_login_url(scope=scope)
def exchange_code_for_access_token(self, code):
req = OAuth2AuthExchangeRequest(self)
return req.exchange_for_access_token(code=code)
def exchange_user_id_for_access_token(self, user_id):
req = OAuth2AuthExchangeRequ... | 151 | 151 | 506 | 8 | 143 | danielroseman/python-instagram | instagram/oauth2.py | Python | OAuth2AuthExchangeRequest | OAuth2AuthExchangeRequest | 58 | 113 | 58 | 58 | f984f844a0345bf3fe9cf838bcfc5c3e9fe94c8f | bigcode/the-stack | train |
fff9c631022933c4e04060e6 | train | class | class OAuth2Request(object):
def __init__(self, api):
self.api = api
def url_for_get(self, path, parameters):
return self._full_url_with_params(path, parameters)
def get_request(self, path, **kwargs):
return self.make_request(self.prepare_request("GET", path, kwargs))
def post... | class OAuth2Request(object):
| def __init__(self, api):
self.api = api
def url_for_get(self, path, parameters):
return self._full_url_with_params(path, parameters)
def get_request(self, path, **kwargs):
return self.make_request(self.prepare_request("GET", path, kwargs))
def post_request(self, path, **kwargs... | (self, scope=None):
return self._url_for_authorize(scope=scope)
def get_authorize_login_url(self, scope=None):
http_object = Http(disable_ssl_certificate_validation=True)
url = self._url_for_authorize(scope=scope)
response, content = http_object.request(url)
if response['st... | 252 | 252 | 843 | 6 | 246 | danielroseman/python-instagram | instagram/oauth2.py | Python | OAuth2Request | OAuth2Request | 116 | 212 | 116 | 116 | f1fdbc9446aeab508dde16b0c62f2023c502c826 | bigcode/the-stack | train |
108f2d5f635176d30a91f8e9 | train | class | class OAuth2AuthExchangeError(Exception):
def __init__(self, description):
self.description = description
def __str__(self):
return self.description
| class OAuth2AuthExchangeError(Exception):
| def __init__(self, description):
self.description = description
def __str__(self):
return self.description
| from json_import import simplejson
import urllib
from httplib2 import Http
import mimetypes
class OAuth2AuthExchangeError(Exception):
| 30 | 64 | 35 | 8 | 21 | danielroseman/python-instagram | instagram/oauth2.py | Python | OAuth2AuthExchangeError | OAuth2AuthExchangeError | 7 | 12 | 7 | 7 | 4d33c911b5e6a527a88cf22f3038c407a9c3604d | bigcode/the-stack | train |
1ab6eb8b2121788ba7fc2d1c | train | function | def on_episode_step(info):
episode = info["episode"]
agent_ids = episode.agent_rewards.keys()
infos = [episode.last_info_for(id_[0]) for id_ in agent_ids]
cost1, cost2, mean_vel, outflow = 0, 0, 0, 0
if len(infos) != 0:
cost1 = np.mean([info['cost1'] for info in infos])
cost2 = np.me... | def on_episode_step(info):
| episode = info["episode"]
agent_ids = episode.agent_rewards.keys()
infos = [episode.last_info_for(id_[0]) for id_ in agent_ids]
cost1, cost2, mean_vel, outflow = 0, 0, 0, 0
if len(infos) != 0:
cost1 = np.mean([info['cost1'] for info in infos])
cost2 = np.mean([info['cost2'] for info ... | to use.")
def on_episode_start(info):
episode = info["episode"]
episode.user_data["cost1"] = []
episode.user_data["cost2"] = []
episode.user_data["mean_vel"] = []
episode.user_data["outflow"] = []
def on_episode_step(info):
| 63 | 64 | 192 | 6 | 57 | syuntoku14/flow | flow/benchmarks/rllib/ppo_resume.py | Python | on_episode_step | on_episode_step | 68 | 81 | 68 | 68 | 781477f6e2350c384ab342dbec32e7de4b245048 | bigcode/the-stack | train |
ca2d5dea16797e6dddb3cff2 | train | function | def on_episode_start(info):
episode = info["episode"]
episode.user_data["cost1"] = []
episode.user_data["cost2"] = []
episode.user_data["mean_vel"] = []
episode.user_data["outflow"] = []
| def on_episode_start(info):
| episode = info["episode"]
episode.user_data["cost1"] = []
episode.user_data["cost2"] = []
episode.user_data["mean_vel"] = []
episode.user_data["outflow"] = []
| ',
type=int,
default=60,
help="The number of rollouts to train over.")
# optional input parameters
parser.add_argument(
'--num_cpus',
type=int,
default=63,
help="The number of cpus to use.")
def on_episode_start(info):
| 63 | 64 | 53 | 6 | 57 | syuntoku14/flow | flow/benchmarks/rllib/ppo_resume.py | Python | on_episode_start | on_episode_start | 60 | 65 | 60 | 60 | dd29ceb72f334563712bf0a4b86b43d79bd6049e | bigcode/the-stack | train |
5946a2beccd98a946b4f55d3 | train | function | def on_episode_end(info):
episode = info["episode"]
cost1 = np.sum(episode.user_data["cost1"])
cost2 = np.sum(episode.user_data["cost2"])
mean_vel = np.mean(episode.user_data["mean_vel"])
outflow = np.mean(episode.user_data["outflow"][-500:]) # 1/3 of the whole steps
episode.custom_metrics["cos... | def on_episode_end(info):
| episode = info["episode"]
cost1 = np.sum(episode.user_data["cost1"])
cost2 = np.sum(episode.user_data["cost2"])
mean_vel = np.mean(episode.user_data["mean_vel"])
outflow = np.mean(episode.user_data["outflow"][-500:]) # 1/3 of the whole steps
episode.custom_metrics["cost1"] = cost1
episode.c... | ['outflow'] for info in infos])
episode.user_data["cost1"].append(cost1)
episode.user_data["cost2"].append(cost2)
episode.user_data["mean_vel"].append(mean_vel)
episode.user_data["outflow"].append(outflow)
def on_episode_end(info):
| 63 | 64 | 134 | 6 | 57 | syuntoku14/flow | flow/benchmarks/rllib/ppo_resume.py | Python | on_episode_end | on_episode_end | 84 | 93 | 84 | 84 | 45e5dbd4dacb4d91b2de816c54a29b15af9d277a | bigcode/the-stack | train |
692945fef0181a4827fa7216 | train | class | class NeteaseConstants:
AES_KEY: bytes = b"0CoJUm6Qyw8W8jud"
AES_IV: bytes = b"0102030405060708"
RSA_PUBKEY: int = int("010001", 16)
RSA_MODULUS: int = int(
"00e0b509f6259df8642dbc3566290147"
"7df22677ec152b5ff68ace615bb7b725"
"152b3ab17a876aea8a5aa76d2e417629"
"ec4ee341f... | class NeteaseConstants:
| AES_KEY: bytes = b"0CoJUm6Qyw8W8jud"
AES_IV: bytes = b"0102030405060708"
RSA_PUBKEY: int = int("010001", 16)
RSA_MODULUS: int = int(
"00e0b509f6259df8642dbc3566290147"
"7df22677ec152b5ff68ace615bb7b725"
"152b3ab17a876aea8a5aa76d2e417629"
"ec4ee341f56135fccf695280104e0312"... | from http.cookies import SimpleCookie
from typing import Dict
from utils.config import APIConfig
_Config = APIConfig("netease")
class NeteaseConstants:
| 33 | 96 | 322 | 6 | 27 | Kyomotoi/HibiAPI | api/netease/constants.py | Python | NeteaseConstants | NeteaseConstants | 9 | 30 | 9 | 9 | 269c3cb272e75fb40657de041bf310ab42510912 | bigcode/the-stack | train |
b2c07c89fe5411a9b6473a22 | train | function | def flatten(lst):
"""For an iterable of sub-iterables, generate each member of each
sub-iterable in turn, i.e. a flattened version of that super-iterable.
Example: Turn [[a,b,c],[d,e,f]] into [a,b,c,d,e,f].
"""
for sublist in lst:
for j in sublist:
yield j
| def flatten(lst):
| """For an iterable of sub-iterables, generate each member of each
sub-iterable in turn, i.e. a flattened version of that super-iterable.
Example: Turn [[a,b,c],[d,e,f]] into [a,b,c,d,e,f].
"""
for sublist in lst:
for j in sublist:
yield j
| installation of numpy.
if isinstance(extension, ExtensionUsingNumpy):
numpy_incpath = get_numpy_incpath()
if numpy_incpath not in extension.include_dirs:
extension.include_dirs.append(numpy_incpath)
BaseBuildExtCommand.build_extension(self, extension)
# {{{ to... | 64 | 64 | 84 | 4 | 59 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | flatten | flatten | 107 | 115 | 107 | 107 | 81422104bc742ac1f499653a9508f819c2a6c8bd | bigcode/the-stack | train |
45bc7fcc76def14ab9748000 | train | function | def default_or(a, b):
if a is None:
return b
else:
return a
| def default_or(a, b):
| if a is None:
return b
else:
return a
| = cvars.get(varname)
if ldsharedflags:
ldsharedflags = remove_prefixes(ldsharedflags.split(),
["-Wl,-O"])
cvars[varname] = str.join(" ", ldsharedflags)
# }}}
# {{{ configure guts
def default_or(a, b):
| 64 | 64 | 24 | 7 | 56 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | default_or | default_or | 212 | 216 | 212 | 212 | 7604900f8469cea80d9906adbfbc634bf94555be | bigcode/the-stack | train |
b72e7dcaf59812280d1c8a90 | train | function | def humanize(sym_str):
words = sym_str.lower().replace("_", " ").split(" ")
return " ".join([word.capitalize() for word in words])
| def humanize(sym_str):
| words = sym_str.lower().replace("_", " ").split(" ")
return " ".join([word.capitalize() for word in words])
| in turn, i.e. a flattened version of that super-iterable.
Example: Turn [[a,b,c],[d,e,f]] into [a,b,c,d,e,f].
"""
for sublist in lst:
for j in sublist:
yield j
def humanize(sym_str):
| 64 | 64 | 35 | 6 | 57 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | humanize | humanize | 118 | 120 | 118 | 118 | 858f9a0cce1cf58193e41304bf6b21f0d762469b | bigcode/the-stack | train |
84b6cc16864b9a97c12dd273 | train | function | def count_down_delay(delay):
from time import sleep
while delay:
sys.stdout.write("Continuing in %d seconds... \r" % delay)
sys.stdout.flush()
delay -= 1
sleep(1)
print("")
| def count_down_delay(delay):
| from time import sleep
while delay:
sys.stdout.write("Continuing in %d seconds... \r" % delay)
sys.stdout.flush()
delay -= 1
sleep(1)
print("")
| import sys
try:
from setuptools import Extension
from setuptools.command.build_ext import ( # noqa: N812
build_ext as BaseBuildExtCommand)
except ImportError:
class Extension:
pass
class BaseBuildExtCommand:
pass
def count_down_delay(delay):
| 62 | 64 | 54 | 6 | 55 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | count_down_delay | count_down_delay | 15 | 22 | 15 | 15 | ca6c1ce188635e61350ec30ce289f9bd54274ba8 | bigcode/the-stack | train |
19f4509591d6eb23a1f67160 | train | class | class get_pybind_include(object): # noqa: N801
"""Helper class to determine the pybind11 include path
The purpose of this class is to postpone importing pybind11
until it is actually installed, so that the ``get_include()``
method can be invoked. """
def __init__(self, user=False):
self.u... | class get_pybind_include(object): # noqa: N801
| """Helper class to determine the pybind11 include path
The purpose of this class is to postpone importing pybind11
until it is actually installed, so that the ``get_include()``
method can be invoked. """
def __init__(self, user=False):
self.user = user
def __str__(self):
impor... | # {{{ (modified) boilerplate from https://github.com/pybind/python_example/blob/2ed5a68759cd6ff5d2e5992a91f08616ef457b5c/setup.py # noqa
class get_pybind_include(object): # noqa: N801
| 64 | 64 | 102 | 14 | 49 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | get_pybind_include | get_pybind_include | 901 | 913 | 901 | 901 | 684598825cce888c8bf62ca2476e7abd0c6be591 | bigcode/the-stack | train |
2ccba70b4e5b4079c7a40af6 | train | function | def set_up_shipped_boost_if_requested(project_name, conf, source_path=None,
boost_chrono=False):
"""Set up the package to use a shipped version of Boost.
Return a tuple of a list of extra C files to build and extra
defines to be used.
:arg boost_chrono: one of *False* and ``"header_only"``
... | def set_up_shipped_boost_if_requested(project_name, conf, source_path=None,
boost_chrono=False):
| """Set up the package to use a shipped version of Boost.
Return a tuple of a list of extra C files to build and extra
defines to be used.
:arg boost_chrono: one of *False* and ``"header_only"``
(only relevant in shipped mode)
"""
from os.path import exists
if source_path is None:
... | Library directories for %s"
% (human_name or humanize(lib_name))))
class Libraries(StringListOption):
def __init__(self, lib_name, default=None, human_name=None, help=None):
StringListOption.__init__(self, "%s_LIBNAME" % lib_name, default,
help=help or ("Library names for %... | 256 | 256 | 882 | 24 | 232 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | set_up_shipped_boost_if_requested | set_up_shipped_boost_if_requested | 553 | 651 | 553 | 554 | ed57aeca4a6727470f83da5e1c8b027f45394ccc | bigcode/the-stack | train |
019accd3f71f3e04087efed4 | train | function | def check_git_submodules():
from os.path import isdir
if not isdir(".git"):
# not a git repository
return
if isdir("../.repo"):
# assume repo is in charge and bail
return
stdout, git_error = _run_git_command(["submodule", "status"])
if git_error is not None:
... | def check_git_submodules():
| from os.path import isdir
if not isdir(".git"):
# not a git repository
return
if isdir("../.repo"):
# assume repo is in charge and bail
return
stdout, git_error = _run_git_command(["submodule", "status"])
if git_error is not None:
return
pkg_warnings = [... | :
git_error = "(OS error, likely git not found)"
if git_error is not None:
print(DASH_SEPARATOR)
print("Trouble invoking git")
print(DASH_SEPARATOR)
print("The package directory appears to be a git repository, but I could")
print("not invoke git to check whether my s... | 160 | 161 | 538 | 6 | 154 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | check_git_submodules | check_git_submodules | 798 | 871 | 798 | 798 | 52f6b31d07fa4b642508615b2e64ea35df338031 | bigcode/the-stack | train |
befb8a1b19b56b9ebe631d6c | train | class | class NumpyBuildExtCommand(BaseBuildExtCommand):
def build_extension(self, extension):
# We add the numpy include dir right before building the
# extension, in order to avoid having to import numpy when
# the setup script is imported, which would prevent
# installation before manual ... | class NumpyBuildExtCommand(BaseBuildExtCommand):
| def build_extension(self, extension):
# We add the numpy include dir right before building the
# extension, in order to avoid having to import numpy when
# the setup script is imported, which would prevent
# installation before manual installation of numpy.
if isinstance(exte... | work. On the other hand, it requires the use of::
setup(...,
cmdclass={'build_ext': NumpyBuildExtCommand})
or
setup(...,
cmdclass={'build_ext': PybindBuildExtCommand})
"""
class NumpyBuildExtCommand(BaseBuildExtCommand):
| 63 | 64 | 119 | 11 | 52 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | NumpyBuildExtCommand | NumpyBuildExtCommand | 91 | 102 | 91 | 91 | a97bd65baed5ae27e38a1e304fb880e3a451f1b3 | bigcode/the-stack | train |
451ff3b43ba3d4993f88bdee | train | function | def cpp_flag(compiler):
"""Return the -std=c++[11/14] compiler flag.
The c++14 is preferred over c++11 (when it is available).
"""
if has_flag(compiler, "-std=gnu++14"):
return "-std=gnu++14"
elif has_flag(compiler, "-std=c++14"):
return "-std=c++14"
elif has_flag(compiler, "-st... | def cpp_flag(compiler):
| """Return the -std=c++[11/14] compiler flag.
The c++14 is preferred over c++11 (when it is available).
"""
if has_flag(compiler, "-std=gnu++14"):
return "-std=gnu++14"
elif has_flag(compiler, "-std=c++14"):
return "-std=c++14"
elif has_flag(compiler, "-std=c++11"):
retur... | int argc, char **argv) { return 0; }")
fname = f.name
import setuptools
try:
compiler.compile([fname], extra_postargs=[flagname])
except setuptools.distutils.errors.CompileError:
return False
return True
def cpp_flag(compiler):
| 64 | 64 | 129 | 6 | 57 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | cpp_flag | cpp_flag | 936 | 949 | 936 | 936 | 3a2cf0c5202f6ab7bb2504a8b3cbde899ee9b870 | bigcode/the-stack | train |
ce193cd15c66ea9a258d7ac7 | train | class | class NumpyExtension(Extension):
# nicked from
# http://mail.python.org/pipermail/distutils-sig/2007-September/008253.html
# solution by Michael Hoffmann
def __init__(self, *args, **kwargs):
Extension.__init__(self, *args, **kwargs)
self._include_dirs = self.include_dirs
del self... | class NumpyExtension(Extension):
# nicked from
# http://mail.python.org/pipermail/distutils-sig/2007-September/008253.html
# solution by Michael Hoffmann
| def __init__(self, *args, **kwargs):
Extension.__init__(self, *args, **kwargs)
self._include_dirs = self.include_dirs
del self.include_dirs # restore overwritten property
def get_additional_include_dirs(self):
return [get_numpy_incpath()]
def get_include_dirs(self):
... | from os.path import join
return join(pathname, "core", "include")
class NumpyExtension(Extension):
# nicked from
# http://mail.python.org/pipermail/distutils-sig/2007-September/008253.html
# solution by Michael Hoffmann
| 64 | 64 | 176 | 46 | 18 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | NumpyExtension | NumpyExtension | 52 | 73 | 52 | 55 | 6969c08b0081b4fb173459c92ded80b19f83c4aa | bigcode/the-stack | train |
1f782299ec3759d9656b4285 | train | function | def configure_frontend():
from optparse import OptionParser
from setup import get_config_schema
schema = get_config_schema()
if schema.have_config():
print("************************************************************")
print("*** I have detected that you have already run configure.")
... | def configure_frontend():
| from optparse import OptionParser
from setup import get_config_schema
schema = get_config_schema()
if schema.have_config():
print("************************************************************")
print("*** I have detected that you have already run configure.")
print("*** I'm taki... | RONO_HEADER_ONLY"] = 1
else:
raise ValueError("invalid value of 'boost_chrono'")
return (source_files, defines)
else:
return [], {}
def make_boost_base_options():
return [
IncludeDir("BOOST", []),
LibraryDir("BOOST", []),
Option("BOOST_COMPILER", de... | 114 | 114 | 382 | 5 | 108 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | configure_frontend | configure_frontend | 667 | 715 | 667 | 667 | f7637c64e356685daacf7e50d4ed29dcc688b9f3 | bigcode/the-stack | train |
dec35ea6b717dbbd2de26eae | train | class | class ExtensionUsingNumpy(Extension):
"""Unlike :class:`NumpyExtension`, this class does not require numpy to be
importable upon extension module creation, allowing ``setup_requires=["numpy"]``
to work. On the other hand, it requires the use of::
setup(...,
cmdclass={'build_ext': NumpyB... | class ExtensionUsingNumpy(Extension):
| """Unlike :class:`NumpyExtension`, this class does not require numpy to be
importable upon extension module creation, allowing ``setup_requires=["numpy"]``
to work. On the other hand, it requires the use of::
setup(...,
cmdclass={'build_ext': NumpyBuildExtCommand})
or
setu... | self._include_dirs + self.get_additional_include_dirs()
def set_include_dirs(self, value):
self._include_dirs = value
def del_include_dirs(self):
pass
include_dirs = property(get_include_dirs, set_include_dirs, del_include_dirs)
class ExtensionUsingNumpy(Extension):
| 64 | 64 | 98 | 8 | 56 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | ExtensionUsingNumpy | ExtensionUsingNumpy | 76 | 88 | 76 | 76 | 6a81fce43c94f10a64f2d8c735fb8377dbd271f6 | bigcode/the-stack | train |
b6f5fed8a33fa8af02fab3e6 | train | class | class Switch(Option):
def add_to_configparser(self, parser, default=None):
if not isinstance(self.default, bool):
raise ValueError("Switch options must have a default")
if default is None:
default = self.default
option_name = self.as_option()
if default:
... | class Switch(Option):
| def add_to_configparser(self, parser, default=None):
if not isinstance(self.default, bool):
raise ValueError("Switch options must have a default")
if default is None:
default = self.default
option_name = self.as_option()
if default:
option_name ... | self.value_to_str(default)
parser.add_option(
"--" + self.as_option(), dest=self.name,
default=default_str,
metavar=self.metavar(), help=self.get_help(default))
def take_from_configparser(self, options):
return getattr(options, self.name)
class Switch(Option):
| 64 | 64 | 125 | 5 | 59 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | Switch | Switch | 465 | 486 | 465 | 465 | faf59b06ba37ee32c7681cd8e9fdc7ee605f87ae | bigcode/the-stack | train |
1fa7b297feb260e25d54e705 | train | function | def hack_distutils(debug=False, fast_link=True, what_opt=3):
# hack distutils.sysconfig to eliminate debug flags
# stolen from mpi4py
def remove_prefixes(optlist, bad_prefixes):
for bad_prefix in bad_prefixes:
for i, flag in enumerate(optlist):
if flag.startswith(bad_pre... | def hack_distutils(debug=False, fast_link=True, what_opt=3):
# hack distutils.sysconfig to eliminate debug flags
# stolen from mpi4py
| def remove_prefixes(optlist, bad_prefixes):
for bad_prefix in bad_prefixes:
for i, flag in enumerate(optlist):
if flag.startswith(bad_prefix):
optlist.pop(i)
break
return optlist
if not sys.platform.lower().startswith("win"):
... | fail, just re-run configure.py with the")
print("*** correct arguments, and then retry. Good luck!")
print("*************************************************************")
print("*** HIT Ctrl-C NOW IF THIS IS NOT WHAT YOU WANT")
print("***************************************************... | 121 | 121 | 406 | 36 | 84 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | hack_distutils | hack_distutils | 156 | 205 | 156 | 159 | 2fe91a2768f93428a6c04d7f88b50edb42ab80b4 | bigcode/the-stack | train |
febdab089182369f588327fc | train | function | def expand_options(options):
return dict(
(k, expand_value(v, options)) for k, v in options.items())
| def expand_options(options):
| return dict(
(k, expand_value(v, options)) for k, v in options.items())
| options)
elif isinstance(v, list):
result = []
for i in v:
try:
exp_i = expand_value(i, options)
except Exception:
pass
else:
result.append(exp_i)
return result
else:
return v
def expand_options... | 64 | 64 | 27 | 5 | 58 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | expand_options | expand_options | 253 | 255 | 253 | 253 | 66fade567345f9dfd5b07960480459c36284c5dc | bigcode/the-stack | train |
02012ffb4a8155e5e0b651d9 | train | function | def check_pybind11():
try:
import pybind11 # noqa
except ImportError:
print(DASH_SEPARATOR)
print("Pybind11 is not installed.")
print(DASH_SEPARATOR)
print("Very likely, the build process after this message will fail.")
print("")
print("Simply press Ctrl+... | def check_pybind11():
| try:
import pybind11 # noqa
except ImportError:
print(DASH_SEPARATOR)
print("Pybind11 is not installed.")
print(DASH_SEPARATOR)
print("Very likely, the build process after this message will fail.")
print("")
print("Simply press Ctrl+C and type")
p... | stdout, git_error = _run_git_command(
["submodule", "update", "--init"])
if git_error is None:
print(DASH_SEPARATOR)
print("git submodules initialized successfully")
print(DASH_SEPARATOR)
# }}}
# {{{ pybind11
def check_pybind11():
| 64 | 64 | 155 | 6 | 57 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | check_pybind11 | check_pybind11 | 878 | 896 | 878 | 878 | ece8d0ae57fa6ddbf9da88cd5e2f5f07c142eaf8 | bigcode/the-stack | train |
9849a877eb1a6237e3d25310 | train | function | def expand_value(v, options):
if isinstance(v, str):
return expand_str(v, options)
elif isinstance(v, list):
result = []
for i in v:
try:
exp_i = expand_value(i, options)
except Exception:
pass
else:
resu... | def expand_value(v, options):
| if isinstance(v, str):
return expand_str(v, options)
elif isinstance(v, list):
result = []
for i in v:
try:
exp_i = expand_value(i, options)
except Exception:
pass
else:
result.append(exp_i)
retu... | ]
except KeyError:
from os import environ
repl = environ[sym]
return expand_str(repl, options)
return re.subn(r"\$\{([a-zA-Z0-9_]+)\}", my_repl, s)[0]
def expand_value(v, options):
| 64 | 64 | 79 | 7 | 57 | kanderso-nrel/pyopencl | aksetup_helper.py | Python | expand_value | expand_value | 235 | 250 | 235 | 235 | 96d13cf201687b7e45c7bbd0c9547f55adb5c5bc | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.